Login  Register

Re: setSlice and composite pb

Posted by jmutterer on Apr 02, 2009; 9:03pm
URL: http://imagej.273.s1.nabble.com/setSlice-and-composite-pb-tp3693106p3693108.html

You should use the ImagePlus setPosition method for Hyperstacks.
Here is what the macro setSlice function does:

void setSlice() {
   int n = (int)getArg();
   ImagePlus imp = getImage();
   int nSlices = imp.getStackSize();
   if (n==1 && nSlices==1)
     return;
   else if (n<1 || n>nSlices)
     interp.error("Argument must be >=1 and <="+nSlices);
   else {
     if (imp.isHyperStack())
       imp.setPosition(n);
     else
       imp.setSlice(n);
     }
   resetImage();
}

Jerome.

On Thu, Apr 2, 2009 at 10:40 PM, Jean Pierre CLAMME <
[hidden email]> wrote:

>
> Hi,
>
> In a  macro I had a line that would access a given slice in hyperstack
> presented as composite stack (4 channels and 8 z) using setSlice. I wanted
> to do the same in a plug-in and it failed. As long as the channel
> dimension is present, ij.SetSlice do nothing. (no errors , it just doesn't
> move from slice 1) If I reduce the dimension to z only then it work.
>
> Please advise
>
> Thanks
>
> JP