Login  Register

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

Posted by Wayne Rasband-2 on Mar 22, 2018; 4:26pm
URL: http://imagej.273.s1.nabble.com/Using-SubHyperstackMaker-makeSubhyperstack-to-extract-a-single-frame-tp5020295p5020306.html

> 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