I'd like to re-open an ImagePlus file I already called using show().
That is, I already called
imp.show()
I closed the window containing the image, but now I'd like to re-open the ImagePlus file in another window (via code). Unfortunately, calling imp.show() again doesn't work. Any ideas on how I can re-open it in a new ImageJ window?
A search in the ImageJ mailing list gives you the answer (by Michael Schmid):
Closing an
ImageWindow
(ImageWindow.close
) callsimp.flush()
, which
deletes many class variables of the imp (essentially everything that
needs significant amounts of memory is set to null).
and suggests a possible solution:
If you don't have a stack, a solution would be keeping a reference to
the ImageProcessor in the imp and keep it instead of imp (also the
roi). If you have no stack, you could also try to clone the ImagePlus
to get a copy that can be displayed again - memory consumption for
cloning would be rather low ('shallow cloning').