Re: ROI coordinates in multiple selection
Posted by
Michael Doube on
Jun 09, 2009; 3:54pm
URL: http://imagej.273.s1.nabble.com/ROI-coordinates-in-multiple-selection-tp3688777p3688780.html
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