Expression

Class: NodeImageExpression

Node Icon

Create a custom expression which applies to the elements of the input image. The user can specify an arbitrary number of input images, numbers and bits which are assigned a variable name, starting with \(a\). Atleast one image is mandatory. The variable names can then be used to create an expression to be calculated.

As an example, to create a node that takes an input image \(a\), ads it to a second input image \(b\), and multiplies the result with \(e\) raised to the power of an input number \(c\), you would write:

(a+b)*e^c

Conditional statements are also possible. To replace all voxels values in input image \(a\) above the input value \(b\) or less than \(\displaystyle 0\) with \(b\), the following expression woule be used:

if(a>b or a<0, b, a)

Special Variables:

e: The natural logarithmic base.
pi: The ratio of the circumference of a circle to its diameter.
vpx, vpy, vpz: The x, y, and z coordinate of the current voxel.
vix, viy, viz: The x, y, and z index of the current voxel.
vsx, vsy, vsz: The x, y, and z size of one voxel.
vcx, vcy, vcz: The x, y, and z voxel count of the image.
ipx, ipy, ipz: The x, y, and z position of the image.

Conditional statements and logical expressions:

if(expression, true, false): if statement with a conditional expression, and the returned value when this expression is true and false, respectively.
=, <>, <, >, ⇐, >=: Comparison operators.
and: Logical and.
or: Logical or.
xor: Logical exclusive or.
not: Logical not.

Some Functions:

abs(x), acos(x), asin(x), atan(x), atan2(x, y), ceiling(x), cos(x), cosh(x), floor(x), log(x), log(x, b), log10(x), max(x, y), min(x, y), rand(x), rande(x), randg(o, s), randn(m, sd), round(x), sign(x), sin(x), sinh(x), sqrt(x), tan(x), tanh(x), truncate(x)

Example workflows

Inputs

a

The default image input.

Type: Image4DFloat, Required, Single

Outputs

Result

The resulting image.

Type: Image4DFloat

Settings

Display

Show Expression Boolean

If checked, the expression will be displayed beneath the node name in the process window.

Node Name Text

The display name of the node in the process window.

Expression

Expression Text

The expression which should be calculated.

Inputs

Images Integer

The number of input images.

Numbers Integer

The number of input numbers.

Bits Integer

The number of input bits.

Result

Set Infinity To Number

What value should Infity be set to.

Set Undefined Numbers To Number

What value should Undifined numbers be set to.

Resulting Image Name Text

The name of the resulting image.

See also

Keywords: