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

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/bug-in-rm-add-roi-or-in-Jython-running-rm-add-roi-tp5021021.html

I have a code snippet that creates a convex hull selection and tries to
add it to the roimanager.

     IJ.run(segmentedImp, "Convex Hull", "")
     convexHullRoi = segmentedImp.getRoi()
     print convexHullRoi
     rm.add(segmentedImp.getRoi())

the print statement verifies that convexHullRoi  is in fact an Roi:

Roi[Polygon, x=772, y=955, width=1617, height=3299]

yet, the rm.add(segmentedImp.getRoi()) statement throws an error

     rm.add(segmentedImp.getRoi())
TypeError: add(): 1st arg can't be coerced to java.awt.Component,
java.awt.PopupMenu

When I record the same sequence of operation as a javascript, I see the
same command

imp = IJ.getImage();
rm = RoiManager.getInstance();
if (rm==null) rm = new RoiManager();
rm.addRoi(imp.getRoi());

The above js script works properly..

Why do I get that typeError?

--aryeh

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