http://imagej.273.s1.nabble.com/how-ot-find-the-center-of-an-ROI-tp5022337p5022339.html
>> On Jul 22, 2019, at 2:39 PM, Aryeh Weiss <
[hidden email]> wrote:
>>
>> The Roi class has a method called getCentroid() that returns the centroid of an Roi.]
>>
>> Is there a similarly simple way to find the center of mass of an Roi or Selection.
>> so far, it looks like I need to do the following:
>>
>> 1. define an Analyzer(imp) object
>> 2. Use Analyzer.measure() to put the mesurements into a ResultsTable
>> 3. Read the appropriate columns of the ResultsTable.
>>
>> Is this the way to do it, or is there a way to directly get it from the Roi, like the centroid?
> With the macro language and Image 1.52p or later, use
>
> xm = getValue("XM");
> ym = getValue("YM");
> print(xm,ym);
>
> To get uncalibrated values use
>
> xm = getValue("XM raw");
> ym = getValue("YM raw");
> print(xm,ym);
>
> With a scripting language and the 1.52q30 daily build, use
>
> img = IJ.getImage();
> xm = IJ.getValue(img,"XM");
> ym = IJ.getValue(img,"YM");
> IJ.log(xm+" "+ym);
>
> xm = IJ.getValue(img,"XM raw");
> ym = IJ.getValue(img,"YM raw");
> IJ.log(xm+" "+ym);
>
Thank you -- it does exactly what I need.