Login  Register

Centre of a PolygonRoi instead of top Left coordinates

Posted by MrGLoOP on Nov 04, 2009; 1:02pm
URL: http://imagej.273.s1.nabble.com/Centre-of-a-PolygonRoi-instead-of-top-Left-coordinates-tp3690562.html

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