Login  Register

Re: setSlice and composite pb

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

Thank you,

Also is it normal that if I run a macro from a plugin ( with runMacroFile)
it is much much slower than if I run he macro directely with a short key ?

Thanks,

JP


ImageJ Interest Group <[hidden email]> wrote on 04/02/2009 02:03:15
PM:

> 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