measuring perimeter

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

measuring perimeter

Josep M. Lanau
Hello everyone,

I am interested in measuring the sum of perimeters of all particles in a
large set of images from fungal colonies with a macro (in fact I measure 3
threshold levels in each grayscale image, which contains a single colony).
My idea is to get some morphological indexes to characterize growth
paterns. In some growth patterns, threshold may result in a large amount of
particles on each image. These particles are quite irregular in shape.

I (obviously wrongly) thought of converting to binary, outline and then
measure the overall image. I have soon realized that the results are not
ok. By browsing the IJ list I have seen that the perimeter is measured by
applying dfifferent factors depending on the nature of the selected shape.

I have performed a test, trying to understand: Drawn a circle (ellipse
selection) of 200 pixel diameter. Then I have filled it, unselected, and
measured. The surprise has been that area is OK, (a little natural error of
some pixels occurs) but error in perimeter measure using analyze particles
is quite important:

Expected perimeter: P = 628.32
Measuring a 200 px diameter circle selection: 628.32
Fill->Select none->Threshold->Analyze particles: 661.7544 (>5% error!)
Outline and measure (wrong procedure): 796


Another unexpected phenomena happen when measuring multiple objects at the
same time (i.e. 2 circles) by selecting all of them and then measuring.
I.e.: Draw and fill two circles, one 50px diameter, and the other 10px
diameter.

Measuring perimeters with Analyze particles: 32.97 and 164.85 (expected
were 31.41 and 157.07)
Threshold->Create a selection for each particle independently, then
measure: same values.
Threshold->Create selection->Measure (both particles a the same time): 226
(!?)

I think this could be a bug that has been previously reported
(https://list.nih.gov/cgi-bin/wa?A2=ind0803&L=IMAGEJ&P=R2098&I=-3) but I am
not sure.

My questions are the following:

1.- Is that error (about 5%) considered normal, or am I doing something
wrong?

2.- Is it possible to select the overall threshold and measure obtaining
reliable results?  If it is not a bug, and I am doing a basic mistake,
could you point me where?

3.- As for measuring the perimeter of all particles in a large set of
images, Could you suggest me a way? Is there a factor I could apply to
outline -> measure results, or should I measure it differently?

Thank you very much in advance.

Regards,


J.M. Lanau

UBCC - Bank of Edible and Medicinal Fungi
Facultat de Biologia, Universitat de Barcelona.
Spain.
Reply | Threaded
Open this post in threaded view
|

Growth patterns was Re: measuring perimeter

karo03
Hi, I will not add to perimeter estimation discussion but to the term  
"growth pattern"

What I did in a similar case is shortly described in
K. Rodenacker, M. Hausner, and A. A. Gorbushina. Quantification and  
spatial relationship of microorganisms in sub-aquatic and sub-aerial  
biofilms. In W. E. Krumbein, D. M. Paterson, and G. A. Zavarzin,  
editors, Fossil and Recent Biofilms, A Natural History of Life on  
Earth, pages 387-399. Kluwer Acad. Publ., Dordrecht, 2003 (http://ibb.helmholtz-muenchen.de/preprints/2003/pp03-15.pdf 
) page 396

In fact I measured the areas of successive dilations or erosions resp.  
of smallest radius possible from a mask at threshold one to the mask  
of threshold two. This delivers some points of an "area growth  
function". The latter can be fitted by what ever function (the growth  
model?), e.g. 2nd order polynom for the area or linear for the  
squareroot of the area for the magnitude of growth extension.

I think with sufficient points at the border (in my case the  
difference of areas of succeeding dilation steps) the "exact" (what is  
that) estimation of perimeter is no question.

Regards
Karsten

Am 18.06.2009 um 08:05 schrieb Josep M.:

> Hello everyone,
>
> I am interested in measuring the sum of perimeters of all particles  
> in a
> large set of images from fungal colonies with a macro (in fact I  
> measure 3
> threshold levels in each grayscale image, which contains a single  
> colony).
> My idea is to get some morphological indexes to characterize growth
> paterns. In some growth patterns, threshold may result in a large  
> amount of
> particles on each image. These particles are quite irregular in shape.
>
> I (obviously wrongly) thought of converting to binary, outline and  
> then
> measure the overall image. I have soon realized that the results are  
> not
> ok. By browsing the IJ list I have seen that the perimeter is  
> measured by
> applying dfifferent factors depending on the nature of the selected  
> shape.
>
> I have performed a test, trying to understand: Drawn a circle (ellipse
> selection) of 200 pixel diameter. Then I have filled it, unselected,  
> and
> measured. The surprise has been that area is OK, (a little natural  
> error of
> some pixels occurs) but error in perimeter measure using analyze  
> particles
> is quite important:
>
> Expected perimeter: P = 628.32
> Measuring a 200 px diameter circle selection: 628.32
> Fill->Select none->Threshold->Analyze particles: 661.7544 (>5% error!)
> Outline and measure (wrong procedure): 796
>
>
> Another unexpected phenomena happen when measuring multiple objects  
> at the
> same time (i.e. 2 circles) by selecting all of them and then  
> measuring.
> I.e.: Draw and fill two circles, one 50px diameter, and the other 10px
> diameter.
>
> Measuring perimeters with Analyze particles: 32.97 and 164.85  
> (expected
> were 31.41 and 157.07)
> Threshold->Create a selection for each particle independently, then
> measure: same values.
> Threshold->Create selection->Measure (both particles a the same  
> time): 226
> (!?)
>
> I think this could be a bug that has been previously reported
> (https://list.nih.gov/cgi-bin/wa?A2=ind0803&L=IMAGEJ&P=R2098&I=-3)  
> but I am
> not sure.
>
> My questions are the following:
>
> 1.- Is that error (about 5%) considered normal, or am I doing  
> something
> wrong?
>
> 2.- Is it possible to select the overall threshold and measure  
> obtaining
> reliable results?  If it is not a bug, and I am doing a basic mistake,
> could you point me where?
>
> 3.- As for measuring the perimeter of all particles in a large set of
> images, Could you suggest me a way? Is there a factor I could apply to
> outline -> measure results, or should I measure it differently?
>
> Thank you very much in advance.
>
> Regards,
>
>
> J.M. Lanau
>
> UBCC - Bank of Edible and Medicinal Fungi
> Facultat de Biologia, Universitat de Barcelona.
> Spain.

Karsten
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: measuring perimeter

Gabriel Landini
In reply to this post by Josep M. Lanau
On Thursday 18 June 2009  09:19:47 Josep M. wrote:

> I am interested in measuring the sum of perimeters of all particles in a
> large set of images from fungal colonies with a macro (in fact I measure 3
> threshold levels in each grayscale image, which contains a single colony).
> My idea is to get some morphological indexes to characterize growth
> paterns. In some growth patterns, threshold may result in a large amount of
> particles on each image. These particles are quite irregular in shape.
>
> I (obviously wrongly) thought of converting to binary, outline and then
> measure the overall image. I have soon realized that the results are not
> ok. By browsing the IJ list I have seen that the perimeter is measured by
> applying dfifferent factors depending on the nature of the selected shape.
>
> I have performed a test, trying to understand: Drawn a circle (ellipse
> selection) of 200 pixel diameter. Then I have filled it, unselected, and
> measured. The surprise has been that area is OK, (a little natural error of
> some pixels occurs) but error in perimeter measure using analyze particles
> is quite important:
>
> Expected perimeter: P = 628.32
> Measuring a 200 px diameter circle selection: 628.32
> Fill->Select none->Threshold->Analyze particles: 661.7544 (>5% error!)
> Outline and measure (wrong procedure): 796
>
>
> Another unexpected phenomena happen when measuring multiple objects at the
> same time (i.e. 2 circles) by selecting all of them and then measuring.
> I.e.: Draw and fill two circles, one 50px diameter, and the other 10px
> diameter.
>
> Measuring perimeters with Analyze particles: 32.97 and 164.85 (expected
> were 31.41 and 157.07)
> Threshold->Create a selection for each particle independently, then
> measure: same values.
> Threshold->Create selection->Measure (both particles a the same time): 226
> (!?)
>
> I think this could be a bug that has been previously reported
> (https://list.nih.gov/cgi-bin/wa?A2=ind0803&L=IMAGEJ&P=R2098&I=-3) but I am
> not sure.
>
> My questions are the following:
>
> 1.- Is that error (about 5%) considered normal, or am I doing something
> wrong?

Nothing wrong in your part.
The discrepancy that you see is because the way that the perimeter is
computed.
You would obtain a perimeter of 628.32 if your screen had infinitely small
pixels. It has not, and so the way to measure this is to create a polygon from
pixel to pixel along the boundary of the object. Of course, connectivity
matters. If you compute the perimeter using 4-neighbours, this grows to 796 as
opposed to 660 with 8-neighbours. (these values were computed with Particles4
and 8 plugins which use Freeman's algorithm (the Particle analyzer, however
uses a different method which differs slightly from Freeman's).

 
> 2.- Is it possible to select the overall threshold and measure obtaining
> reliable results?  

You are getting reliable results.

> 3.- As for measuring the perimeter of all particles in a large set of
> images, Could you suggest me a way? Is there a factor I could apply to
> outline -> measure results, or should I measure it differently?

Add all the perimeters up!

Cheers

G.
Reply | Threaded
Open this post in threaded view
|

Re: measuring perimeter

Michael Schmid
In reply to this post by Josep M. Lanau
Hi Joseph,

to avoid the problem of pixel-induced roughness, the best would be  
Edit>Selection>Fit Spline.
If I create a circle with diameter 100, fill it, trace it by the wand  
and fit a spline, I get a perimeter of 313 - about 0.3% error. The  
error will be much worse for smaller objects, however, because the  
smoothing by splines will "cut the corners" (10% error for radius=10).

You can't do it on composite selections (non-contiguous selections or  
selections with holes) - Use 'analyze particles' to add the  
individual selections to the roi manager and loop through them.

Michael
________________________________________________________________

On 18 Jun 2009, at 08:05, Josep M. wrote:

> Hello everyone,
>
> I am interested in measuring the sum of perimeters of all particles  
> in a
> large set of images from fungal colonies with a macro (in fact I  
> measure 3
> threshold levels in each grayscale image, which contains a single  
> colony).
> My idea is to get some morphological indexes to characterize growth
> paterns. In some growth patterns, threshold may result in a large  
> amount of
> particles on each image. These particles are quite irregular in shape.
>
> I (obviously wrongly) thought of converting to binary, outline and  
> then
> measure the overall image. I have soon realized that the results  
> are not
> ok. By browsing the IJ list I have seen that the perimeter is  
> measured by
> applying dfifferent factors depending on the nature of the selected  
> shape.
>
> I have performed a test, trying to understand: Drawn a circle (ellipse
> selection) of 200 pixel diameter. Then I have filled it,  
> unselected, and
> measured. The surprise has been that area is OK, (a little natural  
> error of
> some pixels occurs) but error in perimeter measure using analyze  
> particles
> is quite important:
>
> Expected perimeter: P = 628.32
> Measuring a 200 px diameter circle selection: 628.32
> Fill->Select none->Threshold->Analyze particles: 661.7544 (>5% error!)
> Outline and measure (wrong procedure): 796
>
>
> Another unexpected phenomena happen when measuring multiple objects  
> at the
> same time (i.e. 2 circles) by selecting all of them and then  
> measuring.
> I.e.: Draw and fill two circles, one 50px diameter, and the other 10px
> diameter.
>
> Measuring perimeters with Analyze particles: 32.97 and 164.85  
> (expected
> were 31.41 and 157.07)
> Threshold->Create a selection for each particle independently, then
> measure: same values.
> Threshold->Create selection->Measure (both particles a the same  
> time): 226
> (!?)
>
> I think this could be a bug that has been previously reported
> (https://list.nih.gov/cgi-bin/wa?A2=ind0803&L=IMAGEJ&P=R2098&I=-3)  
> but I am
> not sure.
>
> My questions are the following:
>
> 1.- Is that error (about 5%) considered normal, or am I doing  
> something
> wrong?
>
> 2.- Is it possible to select the overall threshold and measure  
> obtaining
> reliable results?  If it is not a bug, and I am doing a basic mistake,
> could you point me where?
>
> 3.- As for measuring the perimeter of all particles in a large set of
> images, Could you suggest me a way? Is there a factor I could apply to
> outline -> measure results, or should I measure it differently?
>
> Thank you very much in advance.
>
> Regards,
>
>
> J.M. Lanau
>
> UBCC - Bank of Edible and Medicinal Fungi
> Facultat de Biologia, Universitat de Barcelona.
> Spain.
Reply | Threaded
Open this post in threaded view
|

Re: measuring perimeter

Gabriel Landini
On Thursday 18 June 2009  11:05:03 Michael Schmid wrote:
> to avoid the problem of pixel-induced roughness, the best would be  
> Edit>Selection>Fit Spline.
> If I create a circle with diameter 100, fill it, trace it by the wand  
> and fit a spline, I get a perimeter of 313 - about 0.3% error. The  
> error will be much worse for smaller objects, however, because the  
> smoothing by splines will "cut the corners" (10% error for radius=10).

Such approach would only be advisable if one is trying to measure the
perimeter of Euclidean shapes.
Apply the above to a fractal construct and the underestimation is massive
(about 55% in a koch island of about 512x512 pixels): 3138 (splines) vs 5697
pixels.

Cheers,

G.