How to find greatest and smallest diameter of an irregular shape
Show older comments
I have an irregular shape in which I need to find the Greatest diameter and the smallest diameter.
Greatest diameter(GD): is The length of the line which connects the two farthest boundary points and passes across the lesion centroid (C), which is given by:

where n is the number of pixels inside the lesion, and (xi, yi) is the coordinates of the i-th lesion pixel.
Shortest Diameter (SD): The length of the line which connects the two nearest boundary points and passes across the lesion centroid.
I used regionprops to find out the centroid and equidiameter. How do I find the greatest and smallest diameter? Please help with the code.
Thank You.
4 Comments
Matt J
on 17 Mar 2017
How do you want to handle discretization? Your (xi,yi) are at discrete integer locations whereas the centroid is not. It is therefore almost impossible that two pairs of (discrete) boundary points will ever be co-linear with the centroid.
anastasia
on 17 Mar 2017
From the regionprops documentation, equivdiameter gives the diameter of a circle with the same area as the region . I don't see any direct relationship between that and what you define as SD and GD.
You have defined a shape property that regionprops does not seem to handle. You must complete the definitions to that we all know how to compute it. Rounding the centroid won't ensure colinearity with any of the other pairs of points.
anastasia
on 17 Mar 2017
Accepted Answer
More Answers (2)
Diwakar Gautam
on 19 Mar 2017
Edited: Image Analyst
on 19 Mar 2017
0 votes
Hello dear,
I had also come to your issue. The solution that I came up with is to detect all the boundary elements, and also identify the centroid of the shape. Now choose every possible pair of boundary elements and check it for its collinearity with the centroid (I opted for PCA here). That may help to filter out the largest and smallest diameter. But the issue is its computational load . . . so can anyone suggest me a faster approach to perform it?
Can anyone give me the java code to find the largest and smallest diameter for the labeled objects in an image please....... I use bounding box but its not work well for the irregular shapes.
3 Comments
Image Analyst
on 25 Mar 2017
Define diameter. Do you mean the Equivalent Circular Diameter, or the Feret diameter? And what is the min diameter? Is it the minimum of the max diameters of all the blobs? Because the min diameter could be the distance between two points on a given blob which would just be 1. Or do you mean the min diameter is the min perpendicular distance? See attached demo.
Reza Pahlevi Bahruddin
on 11 Jun 2018
Sorry, may I know the reference or journal from the above program code. Thank you, sorry for my bad english
Surbhi Dhingra
on 14 Jun 2019
Hi, were you able to solve it, i have to write this in C#, request you direct me to the algorithm. Thanks!
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!