Use an array in Math->Macro... ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use an array in Math->Macro... ?

Daniel White
Hi all
see
http://forum.imagej.net/t/can-i-use-an-array-in-math-macro-in-an-ij-macro/4376

Can I use an array in the code function of Math->Macro...
from in an imageJ Macro?

It doesn't seem to work?


cheers
Dan

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

Re: Use an array in Math->Macro... ?

Michael Schmid
Hi Dan,

the ImageJ macro language is very simple (but, thus, very fast,
considering that it is interpreted and not compiled). So there is
essentially one variable type, which can hold numbers, strings or arrays.

If you have an arithmetic expression where a variable contains an array,
in ImageJ macros the array simply evaluates to zero. [Strings evaluate
to the value of the number, e.g. a="2"; b=sqrt(a); results in b=1.4142,
the square root of 2]

For assigning values depending on the position in a stack in
Process>Math>Macro, you can use the 'z' variable (which runs from 0 to
nSlices-1). When asked "Process all images?" run the command on the
whole stack, not the current slice (or, when calling from a macro, add
"stack" to the arguments).


Michael
________________________________________________________________
On 08/03/2017 16:14, Daniel White wrote:

> Hi all
> see
> http://forum.imagej.net/t/can-i-use-an-array-in-math-macro-in-an-ij-macro/4376
>
> Can I use an array in the code function of Math->Macro...
> from in an imageJ Macro?
>
> It doesn't seem to work?
>
>
> cheers
> Dan
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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