Re: API way to do deinterleave?

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/API-way-to-do-deinterleave-tp5021169p5021190.html

First of  thanks to Wayne, Herbie and Jan who replied, each with good
suggestions. I apologize to my delay in replying, but I had a few very
hectic days (Wayne previously sent his solution to me offline),

The idea to create a multichannel hyperstack and then split the channels
is just brilliant.

This list is amazing.
Best regards
--aryeh


On 14/09/2018 19:01, Wayne Rasband wrote:

>> On Sep 12, 2018, at 8:26 AM, Aryeh Weiss <[hidden email]> wrote:
>>
>> I need to deinterleave a stack, and this is how I currently do it.
>>
>> IJ.run(imp ,"Properties...", "channels=1 slices=1 frames="+str(timePoints)+" unit=pixel pixel_width=1.0000 pixel_height=1.0000 voxel_depth=1.0000")
>>
>> and this works fine. However, when IJ.run() commands open up window, I need to get a handle on those windows, and this requires knowing the names or id's of the windows that were opened. This is ok, but awkward, especially when more than one image windows is generated. Also, it means that the images are displayed, which is not always needed or desirable.
>>
>> In this case, I deinterleave nine fields,so it is awkward. So I close all image windows before deinterleaving, and then grab the entire image list and create a list of ImagPlus objects.
>>
>> Is there a stack deinterleave method (similar to reduce() and some other stack methods), that can be called and will return a list of the deinterleaved images.
> The Deinterleave plugin in Fiji (Image>Stacks>Deinterleave) does not have an API for splitting a stack into sub-stacks but ImageJ's built in ChannelSplitter plugin (Image>Color>Split Channels) does. Here is a JavaScript example that splits a 36 slice stack into nine sub-stacks:
>
>    imp = IJ.createImage("Untitled", "8-bit noise", 256, 256, 36);
>    imp2 = HyperStackConverter.toHyperStack(imp,9,4,1,”default”,"Grayscale");
>    subStacks = ChannelSplitter.split(imp2);
>    for (i=0; i<subStacks.length; i++)
>       print(subStacks[i]);
>
> -wayne
>
>
>> I can duplicate, reduce(), remove an image and repeat, but I am hoping that I do not have to reinvent it.
>>
>> tnx 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