Perimeter measurement

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

Perimeter measurement

OlgaFishkis
Hello,
Could someone explain me please why if I measure a square particle 1x1 sq. px the values of the area is correct (1 sq px) but the perimeter is 2.8 instead of 4 px?
If I apply a macro to measure a convex hull of the same square particle I get  the right value of the perimeter - 4.
Thank a lot
Olga  
Reply | Threaded
Open this post in threaded view
|

Re: Perimeter measurement

Michael Schmid
Hi Olga,

there are many ways how to define the perimeter.

For rectangular selections, ImageJ does take the (rectangular)
outline of a rectangle, so a rectangular selection of 1x1 pixel
has a perimeter of 1. The same for a polygon that happens to
be a 1x1 pixel square (e.g. the convex hull).

For a circle with diameter 1, the outline is pi=3.14159...
(even though one pixel is selected and the pixel has a square
outline).

If another type of selection happens to have only one pixel
selected, e.g. the result of clicking with the Wand tool,
ImageJ cuts the corners because such an operation will usually
result in a weird shape. If you follow the outline of such a
shape along the pixel boundaries, you would get a perimeter
that is too large for objects having sides not parallel to
the x or y axes.

---

Apart from this, I have the impression that the perimeter for
composite selections is not given correctly:

A single 10x10 square has a perimeter of 40 (rectangular) or
37.65 (traced by wand). Two separate 10x10 squares have a
perimeter of 60, three of them have 90, etc.

So it seems that there is a problem with the perimeter, but not
that of a single pixel.

Michael
________________________________________________________________

On 5 Mar 2008, at 12:37, OlgaFishkis wrote:

> Hello,
> Could someone explain me please why if I measure a square particle  
> 1x1 sq.
> px the values of the area is correct (1 sq px) but the perimeter is  
> 2.8
> instead of 4 px?
> If I apply a macro to measure a convex hull of the same square  
> particle I
> get  the right value of the perimeter - 4.
> Thank a lot
> Olga
Reply | Threaded
Open this post in threaded view
|

Re: Perimeter measurement

Marcel
In reply to this post by OlgaFishkis
I guess, because edge pixels are measured with sqrt(2) to approximate the real perimeter.

There are also plugins available which measure the perimeter different.


I hope this info helps.
Reply | Threaded
Open this post in threaded view
|

Re: Perimeter measurement

Gabriel Landini
In reply to this post by OlgaFishkis
On Wednesday 05 March 2008 11:37:11 OlgaFishkis wrote:
> Could someone explain me please why if I measure a square particle 1x1 sq.
> px the values of the area is correct (1 sq px) but the perimeter is 2.8
> instead of 4 px?
> If I apply a macro to measure a convex hull of the same square particle I
> get  the right value of the perimeter - 4.
> Thank a lot
> Olga

This answers your question:

http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/what-is-the-algorithm-used-to-calculate-particel-perimeters

Regards,

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

Re: Perimeter measurement

Saveliev, Peter
This method leads to 8% error - http://inperc.com/wiki/index.php?title=Lengths_of_curves.

Peter Saveliev



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini
Sent: Wednesday, March 05, 2008 9:12 AM
To: [hidden email]
Subject: Re: Perimeter measurement

On Wednesday 05 March 2008 11:37:11 OlgaFishkis wrote:
> Could someone explain me please why if I measure a square particle 1x1 sq.
> px the values of the area is correct (1 sq px) but the perimeter is 2.8
> instead of 4 px?
> If I apply a macro to measure a convex hull of the same square particle I
> get  the right value of the perimeter - 4.
> Thank a lot
> Olga

This answers your question:

http://imagejdocu.tudor.lu/imagej-documentation-wiki/faq/what-is-the-algorithm-used-to-calculate-particel-perimeters

Regards,

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

Re: Perimeter measurement

Michael Schmid
In reply to this post by OlgaFishkis
Hi Olga,

my only idea for this is the following:

For each particle, make the convex hull, create a mask from it
and convert the mask to a selection again (Edit/Selection/
Create Mask, Create Selection). This will give you a traced
roi of the convex hull that should be evaluated by the same
algorithm as the roi of the original particle.

Michael
________________________________________________________________

On 6 Mar 2008, at 15:59, [hidden email] wrote:

> Hi Michael,
>
> Thank you very much for your explanation.
> Actually I would like to calculate convexity of particles (convex  
> hull perimeter to particle perimeter). The values I have got are  
> sometimes higher than 1, whereas in theory convex hull perimeter is  
> not longer than the particle`s one. Perhaps, to get values not  
> larger than one I have to recalculate back from improved particle  
> perimeter to perimeter along the pixel boundaries?
>
> Thank you for investing your time
>
> Regards,
> Olga
>
>
> Michael Schmid-3 wrote:
>>
>> Hi Olga,
>>
>> there are many ways how to define the perimeter.
>>
>> For rectangular selections, ImageJ does take the (rectangular)
>> outline of a rectangle, so a rectangular selection of 1x1 pixel
>> has a perimeter of 1. The same for a polygon that happens to
>> be a 1x1 pixel square (e.g. the convex hull).
>>
>> For a circle with diameter 1, the outline is pi=3.14159...
>> (even though one pixel is selected and the pixel has a square
>> outline).
>>
>> If another type of selection happens to have only one pixel
>> selected, e.g. the result of clicking with the Wand tool,
>> ImageJ cuts the corners because such an operation will usually
>> result in a weird shape. If you follow the outline of such a
>> shape along the pixel boundaries, you would get a perimeter
>> that is too large for objects having sides not parallel to
>> the x or y axes.
>>
>> ---
>>
>> Apart from this, I have the impression that the perimeter for
>> composite selections is not given correctly:
>>
>> A single 10x10 square has a perimeter of 40 (rectangular) or
>> 37.65 (traced by wand). Two separate 10x10 squares have a
>> perimeter of 60, three of them have 90, etc.
>>
>> So it seems that there is a problem with the perimeter, but not
>> that of a single pixel.
>>
>> Michael
>> ________________________________________________________________
>>
>> On 5 Mar 2008, at 12:37, OlgaFishkis wrote:
>>
>>> Hello,
>>> Could someone explain me please why if I measure a square particle
>>> 1x1 sq.
>>> px the values of the area is correct (1 sq px) but the perimeter is
>>> 2.8
>>> instead of 4 px?
>>> If I apply a macro to measure a convex hull of the same square
>>> particle I
>>> get  the right value of the perimeter - 4.
>>> Thank a lot
>>> Olga
>>
>>
> Quoted from:
> http://www.nabble.com/Perimeter-measurement-tp15848177p15850553.html
>