API way to do deinterleave?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

API way to do deinterleave?

Aryeh Weiss
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.

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

--
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
Reply | Threaded
Open this post in threaded view
|

Re: API way to do deinterleave?

Aryeh Weiss
Hi Wayne

Thank you for your reply.
I made a mistake below, copying the wrong line. I meant the following:

IJ.run("Deinterleave", "how="+str(fields))

which is the same as Image>Stacks>Tools>Deinterleave...

And in my case, the argument fields will equal 9, so 9 stacks will be
created from the original stack.
So I am looking for the Deinterleave method in the API, if it is available.

Best regards,
--aryeh


On 13/09/2018 3:32, Wayne Rasband wrote:

> Hi Aryeh,
>
> It’s not clear what you are trying to do. Are you trying to convert a stack with n channels into n stacks? It would help if you could provide a minimal working example. In the example, use
>
>    imp = IJ.createImage("stack", "16-bit label", width, height, channels, slices, frames);
>
> to create a test hyperstack.
>
> -wayne
>
>
>
>
>> 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.
>>
>> 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
>>
>> --
>> 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
>

--
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
Reply | Threaded
Open this post in threaded view
|

Re: API way to do deinterleave?

Herbie
Good day Aryeh,

AFAIK, "Stack_Interleaver"-plugin is not part of ImageJ but comes with Fiji.

My version of this plugin shows the following header information:
//@author J. Anthony Parker, MD PhD
//@version 20September2001

The plugin can be downloaded from:
<http://www.med.harvard.edu/JPNM/ij/plugins/StackInterleaver.html>

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 13.09.18 um 04:16 schrieb Aryeh Weiss:

> Hi Wayne
>
> Thank you for your reply.
> I made a mistake below, copying the wrong line. I meant the following:
>
> IJ.run("Deinterleave", "how="+str(fields))
>
> which is the same as Image>Stacks>Tools>Deinterleave...
>
> And in my case, the argument fields will equal 9, so 9 stacks will be
> created from the original stack.
> So I am looking for the Deinterleave method in the API, if it is available.
>
> Best regards,
> --aryeh
>
>
> On 13/09/2018 3:32, Wayne Rasband wrote:
>> Hi Aryeh,
>>
>> It’s not clear what you are trying to do. Are you trying to convert a
>> stack with n channels into n stacks? It would help if you could
>> provide a minimal working example. In the example, use
>>
>>    imp = IJ.createImage("stack", "16-bit label", width, height,
>> channels, slices, frames);
>>
>> to create a test hyperstack.
>>
>> -wayne
>>
>>
>>
>>
>>> 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.
>>>
>>> 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
>>>
>>> --
>>> 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
>>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: API way to do deinterleave?

Jan Eglinger
In reply to this post by Aryeh Weiss
This might help:
http://javadoc.scijava.org/Fiji/index.html?DeInterleave_.html

Jan


On 9/13/2018 4:16 AM, Aryeh Weiss wrote:

> Hi Wayne
>
> Thank you for your reply.
> I made a mistake below, copying the wrong line. I meant the following:
>
> IJ.run("Deinterleave", "how="+str(fields))
>
> which is the same as Image>Stacks>Tools>Deinterleave...
>
> And in my case, the argument fields will equal 9, so 9 stacks will be
> created from the original stack.
> So I am looking for the Deinterleave method in the API, if it is available.
>
> Best regards,
> --aryeh
>
>
> On 13/09/2018 3:32, Wayne Rasband wrote:
>> Hi Aryeh,
>>
>> It’s not clear what you are trying to do. Are you trying to convert a
>> stack with n channels into n stacks? It would help if you could
>> provide a minimal working example. In the example, use
>>
>>    imp = IJ.createImage("stack", "16-bit label", width, height,
>> channels, slices, frames);
>>
>> to create a test hyperstack.
>>
>> -wayne
>>
>>
>>
>>
>>> 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.
>>>
>>> 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
>>>
>>> --
>>> 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
>>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: API way to do deinterleave?

Wayne Rasband-2
In reply to this post by Aryeh Weiss
> 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
Reply | Threaded
Open this post in threaded view
|

Re: API way to do deinterleave?

Aryeh Weiss
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