Re: add a set of point coordinates to ROI manager
Posted by
Marcel on
URL: http://imagej.273.s1.nabble.com/add-a-set-of-point-coordinates-to-ROI-manager-tp5009232p5009246.html
Here is a small code snippet:
**************************************
ImagePlus imp = IJ.getImage();
/*Create a Polygon ROI!*/
int[] xp = { 5, 50, 100, 150, 200, 250, 300 };
int[] yp = { 100, 200, 200, 200, 200, 100 };
PolygonRoi polRoi = new PolygonRoi(xp, yp, 6, Roi.POLYGON);
imp.setRoi(polRoi);
/*Add the ROI to the ROI Manager!*/
RoiManager manager = RoiManager.getInstance();
if (manager == null)
{
manager = new RoiManager();
}
manager.addRoi(polRoi);
*************************************
For different ROI types see:
http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html