Create HyperStack within a plugin

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

Create HyperStack within a plugin

José María Mateos
Hi everybody,

I'm trying to create a HyperStack from within a Java method. I have no
problems creating a regular ImageStack in the following way:

-----
// Create 3x3x3 3D stack and fill it with garbage
ImagePlus aux = IJ.createImage("", "8-bit", 3, 3, 3);
ImageStack is = aux.getStack();
               
for (int k = 1; k <= 3; k++) {
        ImageProcessor iproc = is.getProcessor(k);
        for (int j = 0; j < 3; j++) {
                for (int i = 0; i < 3; i++) {
                        iproc.putPixel(i, j, i + j + k);
                }
        }
}

return aux;
-----

Now, I have problems when creating a HyperStack. I am trying to do
something like

// Create a HyperStack with 2 frames
ImagePlus aux2 = aux.createHyperStack("", 1, 3, 2, 8);

And then use the setT(frame_number) method to iterate through the frames
and set the slices accordingly like in the previous example, but in the
end I get another regular stack. Yes, I've tried the
setOpenAsHyperStack(true) method, with no success.

If someone could help me or point me to some resource where I could read
an example that does something similar I'd greatly appreciate it.

Best,

José María Mateos.

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