Re: API call for hyperstack to stack?

Posted by Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/API-call-for-hyperstack-to-stack-tp5023716p5023721.html

> On Jul 16, 2020, at 6:15 AM, Aryeh Weiss <[hidden email]> wrote:
>
> The HyperStackConverter doc says that it
> Implements the "Stack to HyperStack", "RGB to HyperStack" and "HyperStack to Stack" commands.
>
> However, while I see three toHyperStack() methods, I do not see any toStack method, and I want to do Hypertack to Stack.
> I can do it with IJ.run, but I  an trying to replace IJ.run calls in my code.
>
> In the source https://imagej.nih.gov/ij/source/ij/plugin/HyperStackConverter.java
> I see code to do hyperstack to stack (covertHSToStack), but I do not know how to use it.

The ImageJ 1.53d30 daily build adds a HyperStackConverter.toStack() method. Here is an example:

  imp = IJ.createImage("HyperStack", "8-bit color-mode label", 400, 300, 3, 4, 5);
  print("hyperstack: "+imp);
  HyperStackConverter.toStack(imp);
  print("stack: "+imp);
  imp.show();

Here is the output:

  hyperstack: img["HyperStack" (-7), 8-bit, 400x300x3x4x5]
  stack: img["HyperStack" (-7), 8-bit, 400x300x1x60x1]

-wayne

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