Using SubHyperstackMaker.makeSubhyperstack to extract a single frame.

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

Using SubHyperstackMaker.makeSubhyperstack to extract a single frame.

Fred Damen
Greetings,

I am trying to use SubHyperstackMaker.makeSubhyperstack to process the
hyperstack through the frame dimension.  When the number of frames to be
extracted is more than a single frame (frames = "1-2" or "1,2") everything
seems to work fine.  When a single frame (frames = "1") is requested the
resultant hyperstack (A1) is all zeros, see Java code below.

A second problem that is perplexing and I can not reproduce in a snippet of
code is that when attempting to extract a single frame from the aforementioned
frame with all zeros, the original contents of the frame is returned, thus the
reason for the A2 ImagePlus in the code below.  As this is magically working
in my original code, I am only interested in why.

Just in case your wondering why I would want to do this:
The original dataset has many frames of volumes in which some frames/volumes
are tagged and some are not.  I need to separate the frames/volumes into the
two groups and calculate the mean of each group voxel-wise across their
volumes.  If anyone knows an easier way, I'm all ears.

Thanks in advance,

Fred

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import ij.plugin.SubHyperstackMaker.*;

public class tmp_Plugin implements PlugIn {

        public void run(String arg) {

String frames = "1";

ImagePlus A = IJ.createHyperStack("A", 128, 128, 1, 1, 2, 32);
IJ.run(A,"Set...","value=1 stack");
A.show();
ImagePlus A1 = SubHyperstackMaker.makeSubhyperstack(A,"1","1-1",frames);
A1.setTitle("A1");
A1.show();
ImagePlus A2 = SubHyperstackMaker.makeSubhyperstack(A1,"1","1-1",frames);
A2.setTitle("A2");
A2.show();

        }

}

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

Re: Using SubHyperstackMaker.makeSubhyperstack to extract a single frame.

Fred Damen
Greetings,

Did this email make it through?  Is this a bug?  I've tested this using 1.51w
on a MacOs High Sierra, and on an older version on Linux.

Thanks in advance,

Fred


On Thu, March 15, 2018 6:47 pm, [hidden email] wrote:

> Greetings,
>
> I am trying to use SubHyperstackMaker.makeSubhyperstack to process the
> hyperstack through the frame dimension.  When the number of frames to be
> extracted is more than a single frame (frames = "1-2" or "1,2") everything
> seems to work fine.  When a single frame (frames = "1") is requested the
> resultant hyperstack (A1) is all zeros, see Java code below.
>
> A second problem that is perplexing and I can not reproduce in a snippet of
> code is that when attempting to extract a single frame from the aforementioned
> frame with all zeros, the original contents of the frame is returned, thus the
> reason for the A2 ImagePlus in the code below.  As this is magically working
> in my original code, I am only interested in why.
>
> Just in case your wondering why I would want to do this:
> The original dataset has many frames of volumes in which some frames/volumes
> are tagged and some are not.  I need to separate the frames/volumes into the
> two groups and calculate the mean of each group voxel-wise across their
> volumes.  If anyone knows an easier way, I'm all ears.
>
> Thanks in advance,
>
> Fred
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import ij.plugin.SubHyperstackMaker.*;
>
> public class tmp_Plugin implements PlugIn {
>
> public void run(String arg) {
>
> String frames = "1";
>
> ImagePlus A = IJ.createHyperStack("A", 128, 128, 1, 1, 2, 32);
> IJ.run(A,"Set...","value=1 stack");
> A.show();
> ImagePlus A1 = SubHyperstackMaker.makeSubhyperstack(A,"1","1-1",frames);
> A1.setTitle("A1");
> A1.show();
> ImagePlus A2 = SubHyperstackMaker.makeSubhyperstack(A1,"1","1-1",frames);
> A2.setTitle("A2");
> A2.show();
>
> }
>
> }
>

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

Re: Using SubHyperstackMaker.makeSubhyperstack to extract a single frame.

Wayne Rasband-2
In reply to this post by Fred Damen
> On Mar 15, 2018, at 7:47 PM, Fred Damen <[hidden email]> wrote:
>
> Greetings,
>
> I am trying to use SubHyperstackMaker.makeSubhyperstack to process the
> hyperstack through the frame dimension.  When the number of frames to be
> extracted is more than a single frame (frames = "1-2" or "1,2") everything
> seems to work fine.  When a single frame (frames = "1") is requested the
> resultant hyperstack (A1) is all zeros, see Java code below.

This bug is fixed in the latest ImageJ daily build (1.52a11).

-wayne

> A second problem that is perplexing and I can not reproduce in a snippet of
> code is that when attempting to extract a single frame from the aforementioned
> frame with all zeros, the original contents of the frame is returned, thus the
> reason for the A2 ImagePlus in the code below.  As this is magically working
> in my original code, I am only interested in why.
>
> Just in case your wondering why I would want to do this:
> The original dataset has many frames of volumes in which some frames/volumes
> are tagged and some are not.  I need to separate the frames/volumes into the
> two groups and calculate the mean of each group voxel-wise across their
> volumes.  If anyone knows an easier way, I'm all ears.
>
> Thanks in advance,
>
> Fred
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import ij.plugin.SubHyperstackMaker.*;
>
> public class tmp_Plugin implements PlugIn {
>
> public void run(String arg) {
>
> String frames = "1";
>
> ImagePlus A = IJ.createHyperStack("A", 128, 128, 1, 1, 2, 32);
> IJ.run(A,"Set...","value=1 stack");
> A.show();
> ImagePlus A1 = SubHyperstackMaker.makeSubhyperstack(A,"1","1-1",frames);
> A1.setTitle("A1");
> A1.show();
> ImagePlus A2 = SubHyperstackMaker.makeSubhyperstack(A1,"1","1-1",frames);
> A2.setTitle("A2");
> A2.show();
>
> }
>
> }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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