how ot find the center of an ROI

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

how ot find the center of an ROI

Aryeh Weiss
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?

--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how ot find the center of an ROI

Wayne Rasband-2
> 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);

-wayne
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how ot find the center of an ROI

Aryeh Weiss
On 23/07/2019 0:55, Wayne Rasband wrote:

>> 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.

Best regards
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html