Login  Register

Issue about ImagePlus

Posted by CARL Philippe (LBP) on Jan 10, 2021; 7:12pm
URL: http://imagej.273.s1.nabble.com/Issue-about-ImagePlus-tp5024349.html

Dear all,
Happy new year for everybody (hoping that it will be better than the last one)!
Empirically I found an issue that I'm not really able to understand.
So the following code is working as expected (i.e. the imp1 gets closed as expected):
        public class My_Plugin1 implements PlugIn {
                ImagePlus imp1, imp2, imp3;
                public void run(String arg) {
                        imp1 = IJ.openImage("https://imagej.net/images/bat-cochlea-volume.zip");
                        imp1.show();
                        imp2 = HyperStackConverter.toHyperStack(imp1, 2, 3, 19, "default", "Grayscale");
                        imp3 = SubHyperstackMaker.makeSubhyperstack(imp2, "1", "1-3", "1-19");
                        imp3.show();
                        imp1.close();
                        imp2.close();
                }
        }
But with the following code:
        public class My_Plugin2 implements PlugIn {
                ImagePlus imp1, imp3;
                public void run(String arg) {
                        imp1 = IJ.openImage("https://imagej.net/images/bat-cochlea-volume.zip");
                        imp1.show();
                        imp1 = HyperStackConverter.toHyperStack(imp1, 2, 3, 19, "default", "Grayscale");
                        imp3 = SubHyperstackMaker.makeSubhyperstack(imp1, "1", "1-3", "1-19");
                        imp3.show();
                        imp1.close();
                }
        }
the imp1 window isn't closed.
Is this because the HyperStackConverter.toHyperStack method is creating a static ImagePlus and not a ImagePlus?
I thank you very much in advance for your lighting on this.
My best regards,
Philippe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html