getting ROI coordinates

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

getting ROI coordinates

Jérémy Ohana-2
Hello,
I need some help to handle ROIs in my plugins. My plugin processes a
serie of images, I would like the user to define a ROI on the first
image with the rectangle selection tool, then the same ROI will be used
on all the images of the serie. How can I get the coordinates of the
drawn ROI in my plugin in order to use this coordinates after on a serie
of pictures? Thank you for your help.
Jérémy

--
Jérémy Ohana
Groupe Matière Condensée et Matériaux
Campus de Beaulieu Bat 11A
263 Av Général Leclerc
35042 Rennes Cedex
Tel : 02.23.23.59.55
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: getting ROI coordinates

dscho
Hi,

On Thu, 5 Jul 2007, J?r?my Ohana wrote:

> How can I get the coordinates of the drawn ROI in my plugin in
> order to use this coordinates after on a serie of pictures?

You can get the ROI with the method "getRoi()" of ImagePlus. This Roi is
usually a subclass of ij.gui.Roi. In your case, I guess that it is either
ij.gui.PolygonRoi or ij.gui.PointRoi.

After casting to PolygonRoi (which is a superclass of PoitRoi, so it is
possible in both cases) you can access the coordinates with the methods
"getXCoordinates()" and "getYCoordinates()", both returning "int[]", and
with "getNCoordinates()" you can get the number of coordinates, which does
not have to be the same as the length of the x and y arrays.

Hth,
Dscho