Hi George,
Since you are using 8-bit images, it sounds like the macro functions below
are what you need. Check out the explanation here.
http://rsb.info.nih.gov/ij/developer/macro/functions.html#GBest,
George
getHistogram(values, counts, 256); //"values" and "counts" are arrays
returned based on the number of bins, 256 here.
num0Pixels=counts[0]; //Retrieve the number of pixels
num255Pixels=counts[255];
On Tue, Oct 7, 2014 at 9:34 AM, George_S <
[hidden email]> wrote:
> I am making a very simple macro for an 8 bit grayscale image:
> Threshold;
> make binary;
> erode;
> dilate;
> then retrieve the number of white (or black) pixels (pixels with a value of
> 255) from the histogram and put it in the results.
>
> It was simple in NIH Image but I am having problems with getting the number
> of pixels. I can get the % area and the number of pixels by a roundabout
> way
> but I would like to use the number in a calculation later on in the macro.
>
> Thank you,
> George
>
>
>
> --
> View this message in context:
>
http://imagej.1557.x6.nabble.com/How-do-I-get-a-single-value-from-the-histogram-and-put-it-in-the-results-tp5009939.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html