Login  Register

applying macro to all slices in a stack

Posted by Kenneth Sloan-2 on Jun 09, 2020; 9:42pm
URL: http://imagej.273.s1.nabble.com/applying-macro-to-all-slices-in-a-stack-tp5023462.html

Beginner questions about macros:

I have a macro: foo.ijm which processes a single image, takes a measurement, and displays the results in the Results window.

I need help with two modifications:

a) if the current image is a stack - I want to run the macro for every slice in the stack, producing
one line in the Results window for each slice (I assume the lines will be labelled with the slice labels?)
b) (probably trivial, but...as long as I'm here) write the contents of the Results window to a file.

Ordinarily, I would write this in Java, but it looks simple enough that a macro seems appropriate - but I am a complete beginner at writing macros.


Also...I'm *really* interested in the percentages of white/black pixels after thresholding.  I'm assuming that "Percent Area" is the correct measurement?  And...which percentage is reported - pct WHITE or pct BLACK?  Again - ordinarily I would simply write the Java code to count the pixels, but that's probably overkill for this application.

So...what I need is help with:

<apply to every slice> foo.ijm
<write Results to file>

Ideally, I'd like to write the Results to the "current directory" (presumably the directory the stack was read from?), so the interaction would be:

a) import an image sequence
b) apply macro



--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html