On Jul 24, 2012, at 2:26 PM, Dejan Vuletic wrote:
> Hi,
> i'm starting to use ImageJ and I have some simple (I hope) problem:
> Stack is created of series black and white images. So there is only two
> pixel values: 0 and 255.
> I wish to create some output file which contains pixel values for each
> image in stack. Result which I like to have is something like this:
> image 1: 12543 of value 0 ; 23421 of value 255
> image 2: ....
> etc...
> Can anybody help me to solve this problem?
Here is a macro that does this:
String.resetBuffer;
for (i=1; i<=nSlices; i++) {
setSlice(i);
getRawStatistics(n, mean, min, max, std, histogram);
String.append(i+" "+histogram[0]+" "+histogram[255]+"\n");
}
File.saveString(String.buffer, getDirectory("home")+"counts.txt");
Instructions for running a macro are at
http://imagej.nih.gov/ij/developer/macro/macros.htmlThe functions used by this macro, such as setSlice() and String.append, are described at
http://imagej.nih.gov/ij/developer/macro/functions.html-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html