How to find greatest and smallest diameter of an irregular shape
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
anastasia
el 17 de Mzo. de 2017
Comentada: Surbhi Dhingra
el 14 de Jun. de 2019
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 comentarios
Matt J
el 17 de Mzo. de 2017
Editada: Matt J
el 17 de Mzo. de 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.
Respuesta aceptada
Image Analyst
el 17 de Mzo. de 2017
The problem is, because youre image is digitized, there will be cases where no pixel lies on a line with the other two pixels, so you have to find the closest.
Find the centroid with regionprops. The equivDiameter doesn't matter.
Then find the boundaries with bwboundaries().
For each point on the boundary...
Those two points define a line.
For all other points, use the point-to-line formula to find the point on the other side that has the minimum point-to-line distance.
Compute the distance from that third point to the first point, keeping track of if it's the max or min length encountered so far.
It's not hard but will take a bit of programming, maybe a half hour or so. Give it a try.
6 comentarios
Image Analyst
el 19 de Mzo. de 2017
I'm working on something but I'm not done yet. It's taking a lot of time. Attached is a partially working version. I'll work more on it tomorrow and delete this one if I can get an update.
Actually I hesitate to upload it because you'll say it doesn't work. I know it doesn't work yet, but if you want to try to finish it yourself, go ahead.
Más respuestas (2)
Diwakar Gautam
el 19 de Mzo. de 2017
Editada: Image Analyst
el 19 de Mzo. de 2017
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?
0 comentarios
Abshaya N
el 25 de Mzo. de 2017
Editada: Abshaya N
el 25 de Mzo. de 2017
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 comentarios
Reza Pahlevi Bahruddin
el 11 de Jun. de 2018
Sorry, may I know the reference or journal from the above program code. Thank you, sorry for my bad english
Surbhi Dhingra
el 14 de Jun. de 2019
Hi, were you able to solve it, i have to write this in C#, request you direct me to the algorithm. Thanks!
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!