ROI coordinates in multiple selection

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

ROI coordinates in multiple selection

Michael Doube
Hello,

If I make a multiple selection, e.g. with the wand while holding down
[Shift], then put the ROI coordinates into arrays with the macro command
getSelectionCoordinates(xCoordinates, yCoordinates), I get a strange
result, which does not seem to be the coordinates of the multiple
selection. I get 4-element arrays instead, regardless of the size of the
multiple ROI.  Am I getting the selection bounds in this case?

Mike
Reply | Threaded
Open this post in threaded view
|

Re: ROI coordinates in multiple selection

Michael Schmid
Hi Mike,

yes, you are right, you get the corners of the bounding rectangle.
I fear that list with all the points would not be helpful in your  
case as there would be no way to determine where one 'sub-selection'  
in the list ends and the next one starts.

If you want to have a look at the inner workings of ImageJ, by  
selecting different patches with SHIFT you get a ShapeRoi. This class  
does not override getPolygon(), so it is the getPolygon() method of  
the superclass Roi that is used. Roi is also a rectangular selection.

In a plugin you could split a shapeRoi into individual rois quite  
easily:

         Roi[] rois;
         if (roi instanceof ShapeRoi)                //split roi
             rois = ((ShapeRoi)roi).getRois();
         else
             rois = new Roi[] {roi};

In a macro, the only way of splitting a ShapeRoi that comes into my  
mind is creating a mask and running the Particle Analyzer with "Add  
to Manager".

Michael
________________________________________________________________

On 9 Jun 2009, at 16:23, Michael Doube wrote:

> Hello,
>
> If I make a multiple selection, e.g. with the wand while holding  
> down [Shift], then put the ROI coordinates into arrays with the  
> macro command
> getSelectionCoordinates(xCoordinates, yCoordinates), I get a  
> strange result, which does not seem to be the coordinates of the  
> multiple selection. I get 4-element arrays instead, regardless of  
> the size of the multiple ROI.  Am I getting the selection bounds in  
> this case?
>
> Mike
Reply | Threaded
Open this post in threaded view
|

Re: ROI coordinates in multiple selection

Michael Doube
Hi Michael

Thanks for the help; the easiest thing to do was set a threshold,
Analyze Particles with Add to Manager then iterate through the ROIs in
the manager.

Mike

Michael Schmid wrote:

> Hi Mike,
>
> yes, you are right, you get the corners of the bounding rectangle.
> I fear that list with all the points would not be helpful in your  
> case as there would be no way to determine where one 'sub-selection'  
> in the list ends and the next one starts.
>
> If you want to have a look at the inner workings of ImageJ, by  
> selecting different patches with SHIFT you get a ShapeRoi. This class  
> does not override getPolygon(), so it is the getPolygon() method of  
> the superclass Roi that is used. Roi is also a rectangular selection.
>
> In a plugin you could split a shapeRoi into individual rois quite  
> easily:
>
>          Roi[] rois;
>          if (roi instanceof ShapeRoi)                //split roi
>              rois = ((ShapeRoi)roi).getRois();
>          else
>              rois = new Roi[] {roi};
>
> In a macro, the only way of splitting a ShapeRoi that comes into my  
> mind is creating a mask and running the Particle Analyzer with "Add  
> to Manager".
>
> Michael
> ________________________________________________________________
>
> On 9 Jun 2009, at 16:23, Michael Doube wrote:
>
>> Hello,
>>
>> If I make a multiple selection, e.g. with the wand while holding  
>> down [Shift], then put the ROI coordinates into arrays with the  
>> macro command
>> getSelectionCoordinates(xCoordinates, yCoordinates), I get a  
>> strange result, which does not seem to be the coordinates of the  
>> multiple selection. I get 4-element arrays instead, regardless of  
>> the size of the multiple ROI.  Am I getting the selection bounds in  
>> this case?
>>
>> Mike
Reply | Threaded
Open this post in threaded view
|

Pixels to value

Teresajuliet
In reply to this post by Michael Schmid
I need to write a macro or plug in to get the value of the pixels inside a ROI, printing also the x,y coordinates.