Skip to content

Instantly share code, notes, and snippets.

View ctrueden's full-sized avatar
🛸
Experiencing technical difficulties

Curtis Rueden ctrueden

🛸
Experiencing technical difficulties
View GitHub Profile
@ctrueden
ctrueden / Squash_Plugins_Menu.groovy
Created October 25, 2023 14:30
Fiji Plugins menu too tall
/*
* Is your Fiji installation's Plugins menu too tall on Linux,
* where it runs past the bottom of your screen?
* Here is a hacky script to shrink the font, so that you can
* fit more items before running out of screen real estate!
*
* License: CC0
*/
#@ Float squashFactor (value=0.75f)
@ctrueden
ctrueden / IDE_shortcuts.md
Last active October 11, 2023 08:45
IDE shortcuts
Operation IntelliJ calls it IntelliJ (Win/Linux) IntelliJ (macOS) Eclipse calls it Eclipse (Win/Linux) Eclipse (macOS)
Look up where a variable or class is actually used/referenced Find usages alt+shift+7 alt+F7 Global lookup ctrl+shift+G cmd+shift+G
Move the cursor to the next compile error or warning Jump to next problem F2 F2 Next ctrl+. cmd+.
Show recommended fixes for the selected problem Pop up context actions alt+enter alt+enter Show quick fixes ctrl+1
@ctrueden
ctrueden / MeshCursorTest.java
Created June 14, 2023 10:14
Hacky way to check whether points of a point cloud lie within a mesh
package net.imglib2.mesh.alg;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.function.BiConsumer;
import net.imglib2.Localizable;
import net.imglib2.mesh.io.ply.PLYMeshIO;
@ctrueden
ctrueden / Voxelize.java
Last active June 12, 2023 22:52
Convert a mesh to a binary mask using ImageJ Ops
import java.io.File;
import java.io.IOException;
import net.imagej.Dataset;
import net.imagej.ImageJ;
import net.imagej.mesh.Mesh;
import net.imagej.mesh.io.ply.PLYMeshIO;
import net.imagej.ops.OpService;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.converter.Converters;
@ctrueden
ctrueden / calibrated-axes-transform.groovy
Created April 28, 2023 17:54
Display an image with non-linear calibrated axes
#@ DatasetService ds
#@ net.imagej.units.UnitService units
#@ UIService ui
// Parameters to play with!
// log-linear equation: cal(raw) = a + b * ln(c + d*raw)
xa = 0; xb = 10; xc = 1; xd = 1 // cal(xRaw) = 10*ln(1+xRaw)
ya = 0; yb = 5000; yc = 1; yd = 3000 // cal(yRaw) = 5000*ln(1+3000*yRaw)
// units
@ctrueden
ctrueden / locations.txt
Last active March 11, 2023 12:56
Where is libjvm in various JDKs?
$ for f in *.tar.gz
do
echo
echo "[$f]"
result=$(tar tf "$f" | grep -i 'jvm\.\(dll\|dylib\|so\)$')
test "$result" && echo "$result" || echo "--> NOTHING FOUND"
done; for f in *.zip
do
echo
echo "[$f]"
@ctrueden
ctrueden / generate-pyramid-resolutions.py
Created September 28, 2021 21:06
Generate OME-TIFF pyramids using Python
#!/usr/env/bin python
# Generate pyramidal OME-TIFF.
# Adapted from:
# https://github.com/ome/bio-formats-examples/blob/88d3f109093fb3350242061b00624af001f495e8/src/main/java/GeneratePyramidResolutions.java#L39-L43
import sys
import scyjava
@ctrueden
ctrueden / bio-formats.py
Last active January 1, 2023 08:26
Jython example script for working with the Bio-Formats API in Fiji.
# read in and display ImagePlus object(s)
from loci.plugins import BF
file = "/Users/curtis/data/tubhiswt4D.ome.tif"
imps = BF.openImagePlus(file)
for imp in imps:
imp.show()
# read in and display ImagePlus(es) with arguments
from loci.common import Region
from loci.plugins.in import ImporterOptions
@ctrueden
ctrueden / BOM-Testing.md
Last active September 16, 2022 19:36
Testing BOM components

Background and Context

We have a set of many components (software libraries and/or applications) known as a Bill of Materials (BOM). Many of these components depend on other components, forming a dependency graph (no cycles).

These components are under active development, with new versions being released over time. The BOM lists each component at a specific version, with the idea that all components of the BOM will work successfully together when used as dependencies of a derivative work.

For example, suppose we have the following components:

  • Guava v21 ← no dependencies
  • Math v1 ← depends on Guava v21
@ctrueden
ctrueden / scifio.py
Last active March 1, 2022 20:34
Open images as numpy arrays using SCIFIO and Bio-Formats
#!/usr/bin/env python
#
# scifio.py - Open images as numpy arrays using SCIFIO and Bio-Formats.
#
# -- Settings --
max_mem_mb = '6144'
scifio_lifesci = False