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 / Vertical_Stacker.groovy
Created September 11, 2019 16:33
Create a vertical stack of images, each horizontally centered
#@ ImageJ ij
#@ File[] imageFiles
#@ File(style = "save") outFile
#@ boolean showStack
import java.util.Arrays
import net.imglib2.FinalInterval
import net.imglib2.type.numeric.integer.UnsignedByteType
import net.imglib2.util.Intervals
@ctrueden
ctrueden / Generative_Image.groovy
Created June 18, 2019 18:06
Generate an image from a function in ImageJ
#@ Long(value = 3000) size
import java.util.function.BiConsumer
import net.imglib2.img.display.imagej.ImageJFunctions
import net.imglib2.position.FunctionRandomAccessible
import net.imglib2.type.numeric.integer.UnsignedByteType
import net.imglib2.view.Views
// Define a function in 2-space.
ndim = 2
@ctrueden
ctrueden / SCIFIO_Import_Region.py
Last active May 21, 2019 19:42
Import a cropped region of a 2D image using SCIFIO
#@ DatasetIOService dio
#@ File imageFile
#@ long x
#@ long y
#@ long width
#@ long height
#@output Dataset dataset
from io.scif.config import SCIFIOConfig
from io.scif.img import ImageRegion, Range
@ctrueden
ctrueden / boofcv-seeded-watershed.groovy
Last active March 25, 2019 21:21
Seeded watershed in ImageJ using BoofCV
#@dependency(group="org.boofcv", module="boofcv-core", version="0.33")
#@dependency(group="org.boofcv", module="boofcv-swing", version="0.32")
#@both ImagePlus imp
#@output ImagePlus (label="Watersheds") watersheds
#@output ImagePlus (label="Regions") regions
#@output ImagePlus (label="Seeds") seeds
import boofcv.alg.filter.binary.BinaryImageOps
import boofcv.alg.filter.binary.ThresholdImageOps
@ctrueden
ctrueden / ImageJ1-with-Jython-via-BeakerX.ipynb
Last active March 22, 2019 18:11
Use Jython to invoke ImageJ 1.x API in a BeakerX Groovy notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ctrueden
ctrueden / Open-as-numpy-array-via-Bio-Formats.ipynb
Last active April 20, 2019 18:26
Open an image with Bio-Formats as a numpy array via pyimagej
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ctrueden
ctrueden / automatic-module-names.log
Created March 1, 2019 22:43
Fiji dependencies Automatic-Module-Name entries
$ for jar in $(mvn dependency:build-classpath | grep -A1 'Dependencies classpath' | tail -n1 | gsed 's/:/\n/g') # C 1 {2019-03-01 16:41:33}
do
if [ -f "$jar" ]
then
autoModule=$(unzip -q -c "$jar" META-INF/MANIFEST.MF | grep 'Automatic-Module')
if [ "$autoModule" ]
then
echo "$jar: $autoModule"
# else
# echo "$jar: Automatic-Module ENTRY IS MISSING"
@ctrueden
ctrueden / Dynamic-Markdown.ipynb
Created February 14, 2019 18:03
Rendering Markdown dynamically from BeakerX/Groovy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ctrueden
ctrueden / Convert-to-ARGB-with-LUT.ipynb
Created February 3, 2019 15:58
Apply LUT to ImgLib2 image using RealLUTConverter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ctrueden
ctrueden / ImgLabelingTypeIllustration.java
Created November 14, 2018 18:01
How does the L type of ImgLabeling<L, I> work?
import java.util.Set;
import net.imagej.ImageJ;
import net.imglib2.FinalDimensions;
import net.imglib2.algorithm.labeling.ConnectedComponents.StructuringElement;
import net.imglib2.img.Img;
import net.imglib2.roi.labeling.ImgLabeling;
import net.imglib2.roi.labeling.LabelingType;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.type.numeric.integer.UnsignedByteType;