Hi Wayne,
That worked perfectly. Thank you very much!
Kind regards,
Jaap Kokorian
On Fri, Apr 20, 2012 at 3:45 PM, Rasband, Wayne (NIH/NIMH) [E]
<
[hidden email]> wrote:
> On Apr 19, 2012, at 5:20 AM, Jaap Kokorian wrote:
>
>> Hello all,
>>
>> I have a small issue with the RoiManager plugin.
>> I open and use the RoiManager from a plugin I'm writing. When I close
>> it by calling "rm.close()", I get a popup window asking whether I
>> would like "move the 239 displayed ROIs to an overlay" (OK,Cancel).
>>
>> Is there anyway to prevent this popup from showing, and implicitly
>> cancel it automatically?
>
> You can avoid this dialog by calling rm.runCommand("Show None") before calling rm.close(). Here is a JavaScript example:
>
> imp = IJ.createImage("Untitled", "8-bit Black", 512, 512, 1);
> imp.show();
> rm = RoiManager.getInstance();
> if (rm==null) rm = new RoiManager();
> rm.runCommand("reset");
> imp = IJ.createImage("Untitled", "8-bit Black", 512, 512, 1);
> rm.addRoi(new OvalRoi(108, 39, 77, 85));
> rm.addRoi(new OvalRoi(75, 279, 77, 85));
> rm.runCommand("Show All");
> IJ.wait(5000);
> rm.runCommand("Show None");
> rm.close();
>
> -wayne