Login  Register

Re: if (nSlices==1)

Posted by Julian Cooper on Feb 11, 2010; 10:33am
URL: http://imagej.273.s1.nabble.com/if-nSlices-1-tp3689449p3689450.html

Hi Rhod,

The macro:

if (nSlices==1) {
        print("Single Slice");
}
else {
        print("Stack");
}

works appropriately for me so your code should be branching correctly.

I suspect there is a problem with the code in your "Save" block. Does
nothing at all appear to happen if it is a single image, or do you get an
error message, or even do you get the code for a stack executing when it is
a single image?

Best wishes,

Julian


> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Wilson R S (AT)
> Sent: 11 February 2010 08:56
> To: [hidden email]
> Subject: if (nSlices==1)
>
>
> I am using an if statement in the form of:
>
>
>
> If (nSlices==1){
>
>                 Save}
>
> Else{
>
>                 Other}
>
>  
>
> Meaning, if this is a single image (not a stack) save, else (it is
> stack) do other. When it is presented with a stack it is fine, however
> it seems incapable of realising that a single image is not a
> stack i.e.
> nSlices==1.
>
> Is this a fault or have I missed something in the coding?
>
> I am using ImageJ 1.43p12.
>
>  
>
> Rhod
>