Re: API call for hyperstack to stack?

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/API-call-for-hyperstack-to-stack-tp5023716p5023718.html

Hi Michael,

Thank you for your reply.

On 16/07/2020 14:59, Michael Schmid wrote:
> Hi Aryeh,
>
> the ImageJ command finder (ctrl-L) tells you that the call to the
> class is
>   ij.plugin.HyperStackConverter("hstostack")
> [you may have to enlarge the width of the 'Class' column to see it fully]
>
I do not understand how this would be used.

Is it something like:
hc = HyperStackConverter("hstostack")

But then, what do I do with hc.

> In the HyperStackConverter source code you will see that with
> arg="hstostack", it calls the convertHSToStack(imp) method (line 289).
> This method is not public, however.
>
So hc.convertHSToStack(imp) would not be possible.

> Anyhow, the IJ.run method accepts an optional argument specifying the
> input ImagePlus, so I see nothing bad in using
>   IJ.run(imp, Hyperstack to Stack")
>
It works fine. I have had these issues with IJ.run calls:

1. If they create images, I have to grab those images after the call,
since the image is not returned by the call.

2. There  are sometimes timing issues, where one must loop to wait for
an output window to be opened. I have not seen that for a while but a
few years ago it happened a lot.

3. Sometimes, an IJ.run(imp, "some command")  call will fail if I do not
first do  imp.show() , because apparently the function needs to have the
image in a window, and not just the ImagePlus.

Besides that, when I succeed in replacing the IJ.run call will a direct
call to the class.method, I feel that  I understand the API a little better.
So I try to do things with fewer IJ.run calls

Best regards
--aryeh


>
> Michael
> ________________________________________________________________
> On 16.07.20 12:15, Aryeh Weiss 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  am 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.
>>
>> What am I missing?
>>
>> Thanks in advance
>> --aryeh
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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