Hello everyone,
I was trying to write an algorithm for calculating the area of all the pixels in an image (8-bit thresholded) that have 0 intensity. I counted up the pixels that were black, but of course realized that this wasn't an area, since I didn't count up pixels ^ 2. I was just curious if anyone knows an easy way to do this, besides using the "Analyze Particle" feature. Thanks.. Tony Rotella |
Silly me, I just figured it out (I think..). For some reason, areas
displayed in Black in thresholded images, actually have intensities of 255. Maybe it's some option that I have, but it's all fixed. Needless to say, I was calculating the wrong area (but correctly!) Tony Rotella > _____________________________________________ > From: Rotella, Anthony M. (GRC)[] > Sent: Monday, June 18, 2007 11:14 AM > To: 'ImageJ Interest Group' > Subject: Measuring areas... > > Hello everyone, > > I was trying to write an algorithm for calculating the area of > all the pixels in an image (8-bit thresholded) that have 0 intensity. > I counted up the pixels that were black, but of course realized that > this wasn't an area, since I didn't count up pixels ^ 2. I was just > curious if anyone knows an easy way to do this, besides using the > "Analyze Particle" feature. Thanks.. > > Tony Rotella |
In reply to this post by Rotella, Anthony M. (GRC)[]
Sorry if i misunderstood your post, but I would think that a pixel is
more a surface unit than a length unit. A 4x4 pixels square is a 16 pixels area, or 16 pixels^2 if you prefer. Strictly speaking I'd say a pixel is a square that have a 1x1 pixel dimensions, so it's also a pixel^2 (I mean, for most acquistion systems, rectangular pixels do exist also). Christophe Leterrier Rotella, Anthony M. (GRC)[] a écrit : > Hello everyone, > > I was trying to write an algorithm for calculating the area of > all the pixels in an image (8-bit thresholded) that have 0 intensity. I > counted up the pixels that were black, but of course realized that this > wasn't an area, since I didn't count up pixels ^ 2. I was just curious > if anyone knows an easy way to do this, besides using the "Analyze > Particle" feature. Thanks.. > > Tony Rotella > |
No you're exactly correct. It was confusing to me to see pixels ^ 2 referenced some places, and just pixels in others. Yeah, I think a pixel is a 1 x 1 square, that is also a pixel ^ 2. Anyway, my whole problem was that due to some confusion with the thresholded images, with the colors black and white being somehow inverted, I was calculating the area I didn't want, which incidentally was much larger, causing some serious confusion! Thanks guys..
Tony >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of Christophe Leterrier >Sent: Monday, June 18, 2007 11:27 AM >To: [hidden email] >Subject: Re: Measuring areas... > >Sorry if i misunderstood your post, but I would think that a >pixel is more a surface unit than a length unit. A 4x4 pixels >square is a 16 pixels area, or 16 pixels^2 if you prefer. >Strictly speaking I'd say a pixel is a square that have a 1x1 >pixel dimensions, so it's also a >pixel^2 (I mean, for most acquistion systems, rectangular >pixels do exist also). > >Christophe Leterrier > > >Rotella, Anthony M. (GRC)[] a écrit : >> Hello everyone, >> >> I was trying to write an algorithm for calculating the >area of all >> the pixels in an image (8-bit thresholded) that have 0 intensity. I >> counted up the pixels that were black, but of course realized that >> this wasn't an area, since I didn't count up pixels ^ 2. I was just >> curious if anyone knows an easy way to do this, besides using the >> "Analyze Particle" feature. Thanks.. >> >> Tony Rotella >> > |
In reply to this post by lechristophe
On Monday 18 June 2007 16:26:59 Christophe Leterrier wrote:
> I would think that a pixel is > more a surface unit than a length unit. A 4x4 pixels square is a 16 > pixels area, or 16 pixels^2 if you prefer. Strictly speaking I'd say a > pixel is a square that have a 1x1 pixel dimensions, so it's also a > pixel^2 (I mean, for most acquistion systems, rectangular pixels do > exist also). Not always. A pixel may also be considered a point. Otherwise one could not draw/analyse lines. If you consider pixels to be sampling points, then a 4x4 pixel square has an area of 9 pixels^2 (since you count from the centre of the sampling points as the vertices of the polygon (and a square of 2x2 has an area of 1). There are more ways to handle areas and perimeters of polygons in discrete space. Because of this, Particles8_Plus plugin gives both the Area and the Pixels in a blob. You can have lots of pixels and no area. Cheers, G. |
Oh geez. So lets say I went through a thresholded image, and just simply
counted the pixels. Is this a compatible area measurement if I wanted to use these numbers with area calculated with the "Analyze Particle" operation? My number seems accurate, but it would be nice to make sure I'm not doing anything stupid. Thanks.. Tony >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of Gabriel Landini >Sent: Monday, June 18, 2007 11:44 AM >To: [hidden email] >Subject: Re: Measuring areas... > >On Monday 18 June 2007 16:26:59 Christophe Leterrier wrote: >> I would think that a pixel is >> more a surface unit than a length unit. A 4x4 pixels square is a 16 >> pixels area, or 16 pixels^2 if you prefer. Strictly >speaking I'd say >> a pixel is a square that have a 1x1 pixel dimensions, so it's also a >> pixel^2 (I mean, for most acquistion systems, rectangular pixels do >> exist also). > >Not always. A pixel may also be considered a point. Otherwise >one could not draw/analyse lines. >If you consider pixels to be sampling points, then a 4x4 pixel >square has an area of 9 pixels^2 (since you count from the >centre of the sampling points as the vertices of the polygon >(and a square of 2x2 has an area of 1). >There are more ways to handle areas and perimeters of polygons >in discrete space. Because of this, Particles8_Plus plugin >gives both the Area and the Pixels in a blob. You can have >lots of pixels and no area. > >Cheers, > >G. > |
On Monday 18 June 2007 16:57:01 Rotella, Anthony M. (GRC)[] wrote:
> Oh geez. So lets say I went through a thresholded image, and just simply > counted the pixels. Is this a compatible area measurement if I wanted to > use these numbers with area calculated with the "Analyze Particle" > operation? My number seems accurate, but it would be nice to make sure > I'm not doing anything stupid. Thanks.. I suppose that if you are counting total area of an image, then number of pixels is fine. I was just giving a follow up on the various logics to follow when encoding areas and perimeters. If you want to go and look at particle size distributions and so on, then you have to know what assumptions are behind the different algorithms. For example, what are 5 pixels on a row? You can consider it a blob of area=5 pixels or a line of length=4 and area=0. Cheers, G |
Thanks a lot for the reply Gabriel, very enlightening!
Tony >-----Original Message----- >From: ImageJ Interest Group [mailto:[hidden email]] On >Behalf Of Gabriel Landini >Sent: Monday, June 18, 2007 12:29 PM >To: [hidden email] >Subject: Re: Measuring areas... > >On Monday 18 June 2007 16:57:01 Rotella, Anthony M. (GRC)[] wrote: >> Oh geez. So lets say I went through a thresholded image, and just >> simply counted the pixels. Is this a compatible area >measurement if I >> wanted to use these numbers with area calculated with the >"Analyze Particle" >> operation? My number seems accurate, but it would be nice to >make sure >> I'm not doing anything stupid. Thanks.. > >I suppose that if you are counting total area of an image, >then number of pixels is fine. I was just giving a follow up >on the various logics to follow when encoding areas and perimeters. > >If you want to go and look at particle size distributions and >so on, then you have to know what assumptions are behind the >different algorithms. >For example, what are 5 pixels on a row? You can consider it a >blob of area=5 pixels or a line of length=4 and area=0. > >Cheers, >G > |
In reply to this post by Rotella, Anthony M. (GRC)[]
Rotella, Anthony M. (GRC)[] wrote:
> Hello everyone, > > I was trying to write an algorithm for calculating the area of > all the pixels in an image (8-bit thresholded) that have 0 intensity. I > counted up the pixels that were black, but of course realized that this > wasn't an area, since I didn't count up pixels ^ 2. I was just curious > if anyone knows an easy way to do this, besides using the "Analyze > Particle" feature. Thanks.. > > Tony Rotella > image, or calculate the size of a selected subset of the image? If you can determine the scale of your image, you know the area represented by a pixel, so a count of pixels will give you the cumulative area represented by a set of pixels. If you mean you want to identify the region(s) of the image occupied by black pixels, or determine the approppriate Region of Interest (ROI) in IJ-speak, you can select ROI by thresholding & other means. Brent Wood |
Free forum by Nabble | Edit this page |