ROI object from co-ordinate arrays

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

ROI object from co-ordinate arrays

Tony Shepherd
I'm trying to create an ROI in the active image window, using co-ordinates
stored in 2 arrays. After looking through the documentation I have come up
with the lines of code below. Ncoords is the number of co-ordinate pairs and
2 denotes 'polygon' type (i.e. not oval or rectangle etc)

PolygonRoi segpoly = new PolygonRoi(Xcoords, Ycoords, Ncoords, 2);
Roi segROI = (Roi)segpoly;
ip.setRoi(segROI);
imp.updateAndDraw();

After the 'update and draw' I expect to see my polygon ROI in the image
window (familiar yellow and white boundary) but it's not there. Any ideas?

T
Reply | Threaded
Open this post in threaded view
|

Re: ROI object from co-ordinate arrays

dscho
Hi Tony,

On Tue, 19 Sep 2006, Tony Shepherd wrote:

> PolygonRoi segpoly = new PolygonRoi(Xcoords, Ycoords, Ncoords, 2);

Just a convention thing: you should use Roi.POLYGON instead of 2, for
readability.

> Roi segROI = (Roi)segpoly;
> ip.setRoi(segROI);

You probably want to set it using imp.setRoi(segROI), i.e. on the
ImagePlus, not the ImageProcessor.

Hth,
Dscho