Module: Arithmetic ()

Description:

The Arithmetic module performs calculations on up to three input data objects according to a user-defined arithmetic expression. The result is stored in a new data object called Result. The calculations are triggered by the Apply button. The arithmetic expression is evaluated either on the grid of the first data object (in case of regular, tetrahedral, or hexahedral grids or surfaces) or on a regular 3D uniform grid for which the number of points can be set by the Resolution port. If the data connected to the Arithmetic module is updated, whereas the ports values have not changed, the grid is not recomputed, only a new probing is done.

The module is able to process input fields with up to 6 different channels. Scalar input fields are referenced by the variables A, B, and C. The values of multi-component input fields are referenced for example by Ax, Ay, Az (if input A is a vector field) or Br, Bg, Bb, Ba (if input B is an RGBA color field).

In any case the expressions are evaluated per point, i.e., the result for a point (X,Y,Z) depends on input values at the same point only. If the resulting object is based on a regular grid, grid indices I, J, or K may also appear in the arithmetic expression. This means that for each grid point its associated I, J, or K index value will be substituted in the arithmetic expression on evaluation. This is useful in connection with comparison operators which produce a result of either zero or one. Computations may be confined to a specific sub-grid this way.

An expression consists of variables and mathematical and logical operators. The syntax is basically the same as for C expressions. The following variables are defined:

This is a list of available mathematical and logical operators:

There are also some built-in functions:

For better understanding some examples of how to use the Arithmetic module follow:

Expression: A
The result is a copy of input object A. If A is defined on a tetrahedral or hexahedral grid and the result type is set to regular together with an appropriate resolution, the expression leads to a conversion from an unstructured grid to a structured regular grid. The same trick can also be used to resample a regular field with stacked coordinates onto a uniform grid.

Expression: A-B
The result is the difference between input objects A and B. This expression is sometimes useful in order to compare to different data sets.

Expression: 255*(A>127)
Simple thresholding: For every value of A the result is set to 255 if the value is greater than 127. Otherwise the result is 0.

Expression: A*(B>0)
Simple masking operation: If B is zero, the result is also set to zero. Otherwise, the result is set to A. For example, if A is a 3D image and B is a corresponding label image, the exterior parts of the object (where B is zero) are masked out by this expression.

Connections:

Input A [required]
The input is an Unstructured Model Field containing an arbitrary data set.

Input B [optional]
Second input, can be any 3D data field.

Input C [optional]
Thrid input, can be any 3D data field.

Ports:

Min Box

Port to set the minimum x-, y-, z-coordinates of a bounding box around the output data object. If one or more input data objects are connected, the bounding box of the first input data object is also taken as the output bounding box.

Max Box

Port to set maximum x-, y-, z-coordinates of the bounding box around the output data object.

Output Data Type

Output Data Type

This port determines the number of channels of the result. By default, the result has the same number of channels as input A. Alternatively, you can specify that the result should have 2 channels (complex scalar field), 3 channels (vector field), 4 channels (RGBA color field), 6 channels (either a complex vector or a symmetric tensor field of second order) or 9 channels (a generic tensor field).

Expression

This port specifies the mathematical expression used to compute the result. If the result has more than one channel, more expression ports will be shown.

Output Grid Type

Output Grid Type

With this radio box the grid type of the result can be set either to the same as input A , to a regular grid with uniform coordinates, or a regular grid with rectilinear coordinates. Resampling onto a regular or a rectilinear grid is useful in order to use display modules that take only regular inputs, such as the Volume Rendering volume rendering module. Resampling onto a rectilinear offers more refinement than the uniform grid.

Resolution

If port Result Type is set to regular , the resolution of the regular field to be generated is set to the values given here. If port Result Type is set to rectilinear, the resolution is also set to the values given here. However, if the height resolution is equal to 0, it means that the unstructured model is uniform in Z axis and that the process of generating a rectilinear grid on this is not wanted.

Max Size

If port Result Type is set to rectilinear, the max size of rectilinear cells is set to the factor given here multiplied by one half of the cell size. Note that with a factor of one for the max size, the rectilinear cell will be at least one half of the initial cell. With a factor of 2, the rectilinear cell will be at least one quarter of the initial cell.

Ideal Resolution

If port Result Type is set to rectilinear, the ideal resolution can be chosen for displaying the result. That means that the resolution given in Resolution port will not be used for simplifying the result grid and the Resolution values will be updated with the ideal resolution. Otherwise, the ideal grid will be simplified with an histogram equalization process. By default, the rectilinear grid is simplified with the resolution given.