Centre of a PolygonRoi instead of top Left coordinates

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

Centre of a PolygonRoi instead of top Left coordinates

MrGLoOP
Hi all,

I'm a Java beginner and I would like to adapt the "CustomParticle Analyzer" plugin (http://rsbweb.nih.gov/ij/plugins/particle-analyzer.html).

It uses :
Rectangle r = roi.getBoundingRect();
int x = r.x+((PolygonRoi)roi).getXCoordinates()[coordinates-1];
int y = r.y+((PolygonRoi)roi).getYCoordinates()[coordinates-1];

...to get each top left polygon coordinates but I would like to get each polygon centre of mass coordinates. Or even a better way could be detect my particules as circles and have their centre coordinates.

How can I do that ?

Thanks