Skip to content

Instantly share code, notes, and snippets.

@thomie
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomie/9025224 to your computer and use it in GitHub Desktop.
Save thomie/9025224 to your computer and use it in GitHub Desktop.
ImageJ Macro to 3D project all images in directory
// ImageJ Macro to 3D project all images in directory
//
// Created by Thomas Miedema
// February 15th 2014
//
// Tested with: ImageJ = 1.48q
// Probably works with: ImageJ >= 1.47o
// Doesn't work with: ImageJ = 1.46a
// rsb.info.nih.gov/ij/developer/macro/functions.html
// Do not display images.
setBatchMode(true)
inputDirectory = getDirectory("");
outputDirectory = getDirectory("");
list = getFileList(inputDirectory);
for (i = 0; i < list.length; i++) {
open(inputDirectory + list[i]);
run("Set Scale...", "distance=1 known=0.166 pixel=1 unit=um global");
setSlice(nSlices / 2);
resetMinAndMax();
run("3D Project...", "projection=[Brightest Point] axis=Y-Axis slice=0.3 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=100 interior=50 interpolate");
saveAs("Tiff", outputDirectory + File.nameWithoutExtension + "-3dprojection");
close();
close();
}
setBatchMode(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment