Login  Register

Re: (Java) How to save an ImageStack

Posted by Wayne Rasband-2 on Apr 03, 2019; 11:08pm
URL: http://imagej.273.s1.nabble.com/Java-How-to-save-an-ImageStack-tp5021973p5021974.html

> On Apr 3, 2019, at 6:23 PM, Robert Lockwood <[hidden email]> wrote:
>
> I've created and populated an ImageStack in my Java app, how do I save the
> stack?
>
> outRGBStack = ImageStack.create(NCOLS, NROWS, NSLICES, 24);

Here is JavaScript example that creates a stack, saves it in the temp folder, re-opens it, and displays it:

  NCOLS = NROWS = NSLICES = 256;
  PATH = IJ.getDir("temp")+"RGB_Stack.tif";
  rgbStack = ImageStack.create(NCOLS, NROWS, NSLICES, 24);
  img = new ImagePlus("RGB Stack",rgbStack);
  IJ.saveAs(img, "tif", PATH);
  img = IJ.open(PATH);
  img.show();

-wayne

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