Re: How to open raw hyperstack from plugin?
Posted by Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/How-to-open-raw-hyperstack-from-plugin-tp3688681p3688682.html
On Mar 31, 2010, at 7:03 AM, Josh wrote:
> I am updating a plugin for a custom format I've written to handle
> hyperstacks. My plugin gets called from HandleExtraFileTypes if the magic
> number matches my format. I haven't had success yet opening them as
> normal hyperstacks or virtual hyperstacks.
>
> I set FileInfo.nImages to slices * channels * frames, and call
> ImagePlus.setProperty() on "hyperstack", "slices", "channels", and "frames",
> but my files still keep on opening as regular stacks. Is there something
> else I'm missing?
Create an ImagePlus (imp) from the stack, call imp.setDimensions(), create a CompositeImage (if c>1), call imp.setOpenAsHyperStack(true) and call imp.show(). Here is what the code looks like:
ImagePlus imp = new ImagePlus("Hyperstack", stack);
imp.setDimensions(c, z, t);
imp = new CompositeImage(imp, CompositeImage.COMPOSITE);
imp.setOpenAsHyperStack(true);
imp.show();
-wayne