Login  Register

Re: bug in rm.add(roi) , or in Jython running rm.add(roi)?

Posted by Marcel. on Jul 31, 2018; 8:32am
URL: http://imagej.273.s1.nabble.com/bug-in-rm-add-roi-or-in-Jython-running-rm-add-roi-tp5021021p5021023.html

Dear Aryeh,

you added the wrong command for Jython, 'addRoi' versus 'add'. So Jython
works fine but you have to use the method 'addRoi' in Jython. I must admit
that I was confused in the beginning, too not seeing the differences in both
code snippets. But then I made this reproducible example:

from ij import IJ;
from ij.plugin.frame import RoiManager;
from ij.gui import PolygonRoi;
from ij.gui import Roi;

segmentedImp = IJ.openImage("http://wsr.imagej.net/images/blobs.gif");
xpoints = [85,184,157,207,119,177,43,89,11,77,19,81];
ypoints = [96,38,112,134,156,203,225,158,157,131,50,93];
segmentedImp.setRoi(PolygonRoi(xpoints,ypoints,Roi.POLYGON));
IJ.run(segmentedImp, "Convex Hull", "")
convexHullRoi = segmentedImp.getRoi()
print convexHullRoi
rm = RoiManager()
rm.addRoi(convexHullRoi)


See the differences in the ImageJ API. This explains your error:

https://imagej.nih.gov/ij/developer/api/ij/plugin/frame/RoiManager.html



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html