Strange imp.close() behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange imp.close() behavior

Jon Harman
Hi,

In a plugin of mine I create a temporary image as follows:
            IJ.run("Scale...", "x=" + IJ.d2s(scale) +" y=" + IJ.d2s(scale) +
                    " interpolate create title=Flatten_tmp");
            imp1 = WindowManager.getCurrentImage();

...
            imp1.close();

In Eclipse the imp1.close(); line works fine.  But when I run ImageJ
outside of Eclipse the temp window doesn't close and
it seems that my routine is exiting (at the close line) without giving
any error messages.


Can anyone help with the mystery?

Jon
Reply | Threaded
Open this post in threaded view
|

Re: Strange imp.close() behavior

Wayne Rasband
> Hi,
>
> In a plugin of mine I create a temporary image as follows:
>            IJ.run("Scale...", "x=" + IJ.d2s(scale) +" y=" +
> IJ.d2s(scale) +
>                    " interpolate create title=Flatten_tmp");
>            imp1 = WindowManager.getCurrentImage();
>
> ...
>            imp1.close();
>
> In Eclipse the imp1.close(); line works fine.  But when I run ImageJ
> outside of Eclipse the temp window doesn't close and it seems
> that my routine is exiting (at the close line) without giving any
> error messages.
>
>
> Can anyone help with the mystery?

It works fine for me. Note that the close() method was added to the
ImagePlus class in ImageJ 1.35m. With earlier versions, you have to use
imp1.hide() or IJ.run("Close").

-wayne