counting pixels of one color or color range

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

counting pixels of one color or color range

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
Reply | Threaded
Open this post in threaded view
|

Re: counting pixels of one color or color range

Christian Lutz
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
Reply | Threaded
Open this post in threaded view
|

Re: counting pixels of one color or color range

Harry Parker
In reply to this post by Adam Zeilinger
Hello Adam,

I think G. Landini's Threshold Colour plugin will help you.
It thresholds an image in any of the color spaces, RGB, HSB, YUV or LAB.
You can use an ROI or sliders to specify the color range you're looking for.
Then threshold the image and use the Histogram function to count what's
in range.

You can download it from
http://www.dentistry.bham.ac.uk/landinig/software/software.html

Another tool I like for investigating color distributions in images is
Kai Uwe Barthel's plugin, Color Inspector 3D, available from the
ImageJ web site Plugin page, under "3D Color Inspector". It will show
you the number of pixels of an exact color, but you cannot specify a
range. However, the 3D histograms are illuminating.

 
--
Harry Parker
Senior Imaging Systems Engineer
Digital Imaging Systems, Inc.



----- Original Message ----
From: Adam Zeilinger <[hidden email]>
To: [hidden email]
Sent: Saturday, September 20, 2008 11:10:27 AM
Subject: counting pixels of one color or color range

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



     
Reply | Threaded
Open this post in threaded view
|

Re: counting pixels of one color or color range

dscho
In reply to this post by Adam Zeilinger
Hi,

On Sat, 20 Sep 2008, Adam Zeilinger wrote:

> 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?

You can use Image>Adjust>Threshold to select the pixels of a certain value
(lower threshold must be that number, upper threshold that number plus
one), then create a selection from that with Edit>Selection>Create
Selection, and then clicking the Analyze>Measure item.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Using ImageJ for electron probe micro analysis images

Donald S. Ross
Greetings,  I am new to this list.  We have 16-bit images giving  
elemental maps of soil particles from EPMA (electron probe micro  
analysis).  I've been trying out ImageJ for awhile and can do the  
basics of importing, thresholding and determining areas.  I need to  
get a little more advanced such as calculating the area of a certain  
range in ratios of elements (e.g. Si:Al and Si:Al:Ca) from two or  
three maps, but I'm stuck.  It seems as if someone should have done  
this before.  Does anyone know a good resource, i.e. tutorial or link  
with info on this type of application?  I've searched through the  
plugin list but haven't found anything yet.

thanks very much,
Don Ross
Univ. Vermont
Reply | Threaded
Open this post in threaded view
|

Re: Using ImageJ for electron probe micro analysis images

Gabriel Landini
On Monday 22 September 2008 22:35:02 Donald S. Ross wrote:

> Greetings,  I am new to this list.  We have 16-bit images giving
> elemental maps of soil particles from EPMA (electron probe micro
> analysis).  I've been trying out ImageJ for awhile and can do the
> basics of importing, thresholding and determining areas.  I need to
> get a little more advanced such as calculating the area of a certain
> range in ratios of elements (e.g. Si:Al and Si:Al:Ca) from two or
> three maps, but I'm stuck.  It seems as if someone should have done
> this before.  Does anyone know a good resource, i.e. tutorial or link
> with info on this type of application?  I've searched through the
> plugin list but haven't found anything yet.

Would this work?

Assuming that image intensity gives the amount of material (I have no idea about EPMA) then you could go testing pixel by pixel the ratio of intensity of the 2 or 3 images. Let's say you want a ratio of a:b between 0.2 and 0.5

Or, you could divide one 32 bit image by another (using the Calculator Plus) and threshold the result image between 0.2 and 0.5

G.