Re: Can't Recover ImagePlus after Stack Rotate
Posted by kacollins on
URL: http://imagej.273.s1.nabble.com/Can-t-Recover-ImagePlus-after-Stack-Rotate-tp3687248p3687250.html
Hi Johannes,
The code you provided worked in a standalone plugin in 1.43u as well. Unfortunately, implementing the differences in my plugin still did not work in 1.43u (but works fine in 1.42q). It may have something to do with the fact that my plugin extends StackWindow, but I'm not sure why it would work in 1.42q.
In any event, I have found a workaround that is not very elegant, but solves the null imp problem by grabbing the imp from the window after the setStack command. The code that works within my plugin for both 1.42q, and 1.43u (and I assume 1.44e, but haven't tested it yet) is:
--------------------------------------------
StackProcessor sp = new StackProcessor(imp.getStack(), ip);
ImageStack s2 = null;
s2 = sp.rotateLeft();
imp.setStack(null, s2);
imp = IJ.getImage();
--------------------------------------------
imp is now valid after the setStack and works as expected for the remaining part of the plugin (after creating a new instance of my extended StackWindow).
Thanks for the suggested code, it actually triggered the thought of re-grabbing the imp from the window using IJ.getImage().
Karen