Hi,
can anyone tell me which method (algorithm) is used for estimation of Feret's diameter in ImageJ? Best regards, Slobodan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Slobodan,
you can find the code for calculating Feret's diamater at https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#l242 In short: It uses the corner points of the selection. minFeret is calculated by finding the minimum caliper width when rotating the calipers in 0.5 degree increments. Thus it is only an approximation. maxFeret is the largest distance between any two corner points. This is exact. Michael ________________________________________________________________ On Jan 9, 2015, at 00:31, Slobodan Dražić wrote: > Hi, > > can anyone tell me which method (algorithm) is used for estimation of Feret's diameter in ImageJ? > > Best regards, > Slobodan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Slobodan Dražić
Hi Michael,
thanks for code and explanation. I looked through the code. Sorry for asking too much, I am not familiar with Java. As much as I understand it observes pixel as a point with integer coordinates. Does not consider it as a Voronoi region (whole square). It does not take into account the whole pixel when estimates diameter. I am not sure what you meant by "any two corner points"? Corner points of all the pixels? Slobodan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Slobodan,
regarding a minor aspect of your question: A pixel has no area/extension. It is an ideal mathematical point and its value is a number in the computer memory. The pixel-square on a computer display is a kind of coarse interpolation approach to make the spatially discrete pixel array continuous and visible. It is not per se accessible for computations. HTH Herbie :::::::::::::::::::::::::::::::::::::::: On 09.01.15 12:04, Slobodan Dražić wrote: > Hi Michael, > > thanks for code and explanation. > > I looked through the code. Sorry for asking too much, I am not > familiar with Java. As much as I understand it observes pixel as a > point with integer coordinates. Does not consider it as a Voronoi > region (whole square). It does not take into account the whole pixel > when estimates diameter. I am not sure what you meant by "any two > corner points"? Corner points of all the pixels? > > Slobodan > > > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Slobodan Dražić
Hi Slobodan,
for the Feret calculation the *corner points* of the selection are taken as points with zero size. 'Corner points' are the points of the outline that define the polygon of the selection. Selections that are not polygons (splined polygons, ovals) are converted to polygons (using the same method as if you press 'f' for 'fill', and then taking the outline). This causes a notable error for small ovals and circles. If you select a single pixel, the selection is a small square with four corner points and a side length of 1. So you get minFeret=1 and maxFeret=sqrt(2). Michael ________________________________________________________________ On Jan 9, 2015, at 12:04, Slobodan Dražić wrote: > Hi Michael, > > thanks for code and explanation. > > I looked through the code. Sorry for asking too much, I am not familiar with Java. As much as I understand it observes pixel as a point with integer coordinates. Does not consider it as a Voronoi region (whole square). It does not take into account the whole pixel when estimates diameter. I am not sure what you meant by "any two corner points"? Corner points of all the pixels? > > Slobodan > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Slobodan Dražić
Hi Michael,
thanks once more. I think I understand, but just to be sure: If a circle with radius 1.5 pixels is digitized such that it digitization is 3X3 neighborhood of pixels (a square of size 9 pixels) the maximal Feret's diameter would be 3*\sqrt(2) estimated from the farthest pixel corners (when angle is 45 degrees)? It will not be 2*\sqrt(2) if it is estimated from pixel centers? Best regards, Slobodan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Slobodan,
yes, if you create a circle (oval selection) with a diameter of 3 pixels it and fill it, you will get a square of 3x3 pixels. This square has a minFeret of 3 (if you measure it with calipers touching two sides) and a maxFeret of 3*sqrt(2) = 4.24 pixels (calipers measuring the diagonal). For larger circles (diameter >= 4), filling does not result in a square any more, but the maxFeret will be still too large. In any case, for calculating Feret diameters and areas, pixels are assumed to be small squares with a side length of 1, not single points. [ImageJ reports the same Feret values for a the circle and the shape obtained by filling it. In principle one could change this by handling oval selections separately when calculating the Feret diameters, but I am not sure whether it would be worthwhile.] You can easily try it yourself. It is best to create a small image and zoom in, then you can nicely see the pixels. Michael On Sat, January 10, 2015 10:22, Slobodan DražiÄ wrote: > Hi Michael, > > thanks once more. > > I think I understand, but just to be sure: If a circle with radius 1.5 > pixels is digitized such that it digitization is 3X3 neighborhood of > pixels (a square of size 9 pixels) the maximal Feret's diameter would be > 3*\sqrt(2) estimated from the farthest pixel corners (when angle is 45 > degrees)? It will not be 2*\sqrt(2) if it is estimated from pixel > centers? > > Best regards, > Slobodan > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sunday 11 Jan 2015 11:54:17 Michael Schmid wrote:
> Hi Slobodan, > > yes, if you create a circle (oval selection) with a diameter of 3 pixels > it and fill it, you will get a square of 3x3 pixels. This square has a > minFeret of 3 (if you measure it with calipers touching two sides) and a > maxFeret of 3*sqrt(2) = 4.24 pixels (calipers measuring the diagonal). > > For larger circles (diameter >= 4), filling does not result in a square > any more, but the maxFeret will be still too large. > > In any case, for calculating Feret diameters and areas, pixels are assumed > to be small squares with a side length of 1, not single points. The Particles8 plugin uses an different concept of the "area" of a region (it uses Freeman chaincodes algorithm which I find more intuitive) and among other things it computes the max Feret diameter based on the boundary of a region. Since a single pixel here is considered a point, not a region, it has no boundary and no inside area, so its max Feret diameter is 0. It does not compute the minimum Feret though. Here it is for plain IJ (in the Morphology zip) http://www.mecourse.com/landinig/software/software.html or add the Morphology repository for Fiji. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Slobodan Dražić
Thank you all for help,
I see that standard approach in ImageJ is to observe the whole pixel when Feret's diameter is estimated, but different plug-ins based on different methods can be used. I am writing a publication which subject is more accurate estimation of Feret's diameter. Our discussion was really helpful. Thanks for help one more time. Best regards, Slobodan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |