Ternary logical operators in ImageJ macros

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

Ternary logical operators in ImageJ macros

CARL Philippe (LBP)
Dear all,
are the Ternary logical operators implemented within the ImageJ macros language, like:
        x = x < 0 ? x - 5 : x + 5;
Of course such instructions can be covered with if and else instructions, but they can quite shorten a code.
I thank you very much in advance.
My best regards,
Philippe

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

Re: Ternary logical operators in ImageJ macros

Herbie
Good day Philippe!

"Ternary logical operators" ??

Not that I know of and please see "Operators" at:
<https://imagej.nih.gov/ij/developer/macro/macros.html>

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Am 20.09.16 um 16:47 schrieb CARL Philippe (PHA):
> Dear all, are the Ternary logical operators implemented within the
> ImageJ macros language, like: x = x < 0 ? x - 5 : x + 5; Of course
> such instructions can be covered with if and else instructions, but
> they can quite shorten a code. I thank you very much in advance. My
> best regards, Philippe
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Ternary logical operators in ImageJ macros

Michael Schmid
In reply to this post by CARL Philippe (LBP)
Hi Philippe,

you can find the list of operators in the ImageJ macro language at
   https://imagej.nih.gov/ij/developer/macro/macros.html#operators

The ImageJ macro interpreter is rather simple (which makes it fast); I
fear it would be quite some work to modify it for a ternary operator.

Of course, you could use Javascript, which has the ternary conditional
operator.

Michael
________________________________________________________________
On 2016-09-20 16:47, CARL Philippe (PHA) wrote:

> Dear all,
> are the Ternary logical operators implemented within the ImageJ macros language, like:
> x = x < 0 ? x - 5 : x + 5;
> Of course such instructions can be covered with if and else instructions, but they can quite shorten a code.
> I thank you very much in advance.
> My best regards,
> Philippe
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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