Login  Register

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

Posted by Aryeh Weiss on Jul 31, 2018; 9:18am
URL: http://imagej.273.s1.nabble.com/bug-in-rm-add-roi-or-in-Jython-running-rm-add-roi-tp5021021p5021026.html

Thank you, Marcel.

Amazing how this was staring me in the face, and I missed it.

Best regards
--aryeh

On 31/07/2018 4:32, Marcel. wrote:

> 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
>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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