Re: counting pixels of one color or color range
Posted by
Christian Lutz on
URL: http://imagej.273.s1.nabble.com/counting-pixels-of-one-color-or-color-range-tp3694997p3695002.html
Hello,
here is a short marco, that counts the value 72 through the stack. (8
bit Image)
--- Macro ---
searchValue = 72;
countValue = 0;
for( i = 1; i <= nSlices; i++ ) {
setSlice(i);
for( x = 0; x < getWidth(); x++ ) {
for( y = 0; y < getHeight(); y++ ) {
if( getPixel(x,y) == searchValue ) {
countValue += 1;
}
}
}
}
print(countValue);
--------------
Sincerely
Christian
Am 20.09.2008 um 17:10 schrieb Adam Zeilinger:
> Hi Image J list,
>
> Is there a way in Image J to select a color and to calculate the
> number of
> pixels of that color, or the number of pixels within a color range,
> in an image?
>
> If I can't do this in Image J, does anyone know of another program
> where I can?
>
> Thanks in advance for any help,
>
> Adam Zeilinger
> University of Minnesota