# Arithmetic1¶

`MLModule`
 genre `Unary` author `MeVis Medical Solutions AG` package `MeVisLab/Standard` dll `MLBasicModules` definition mlBasicModules.def see also `Arithmetic2`, `SoCalculator` keywords `absolute`, `negate`, `invert`, `power`, `add`, `multiply`, `subtract`, `divide`, `or`, `and`, `xor`, `image`

# Purpose¶

This module performs arithmetic operations on an image.

The output is the processed image according to the selected function and constant.

This module usually works with scalar voxel values. Only the `Function` modes Add, Multiply and Subtract work on any registered voxel type.

# Usage¶

Select the arithmetic operation you want to apply to the input image. If the arithmetic operation has two operands enter a `constant`.

# Tips¶

The example network demonstrates how an image can be inverted by the Arithmetic1 operator.

# Input Fields¶

## input0¶

`name: ``input0``, type: ``Image`

Input Image

# Output Fields¶

## output0¶

`name: ``output0``, type: ``Image`

Output Image

# Parameter Fields¶

## Visible Fields¶

### Function¶

`name: ``function``, type: ``Enum``, default: ``Add``, deprecated name: ``Function`

Defines an operation which is applied to the input image.

Values:

Title Name Deprecated Name Description
Absolute Absolute   The absolute valued input image is passed to the output.
Invert (Max-Img) Invert Invert (MAX-IMG) The inverted input image is passed to the output (max+min-img).
Power (Img^Const) Power Power (IMG^C) The input image to the power of `Constant` is passed to the output.
Add (Const+Img) Add Add (IMG+C) The input image increased by `Constant` is passed to the output.
Multiply (Const*Img) Multiply Multiply (IMG*C) The input image multiplied by `Constant` is passed to the output.
Subtract (Const-Img) Subtract Subtract (C-IMG) `Constant` decreased by the input image is passed to the output.
Divide (Const/Img) Divide Divide (C/IMG) `Constant` divided by the input image is passed to the output.
Bitwise Or (Const OR Img) Or OR

The input image OR `Constant` is passed to the output. The OR operation is performed bitwise.

Note: The operation is only performed on the first 32 bit of the value.

Bitwise And (Const AND Img) And AND

The input image AND `Constant` is passed to the output. The AND operation is performed bitwise.

Note: The operation is only performed on the first 32 bit of the value.

Bitwise Xor (Const XOR Img) Xor XOR

The input image XOR `Constant` is passed to the output. The XOR operation is performed bitwise.

Note: The operation is only performed on the first 32 bit of the value.

Log Log Log (log(IMG)

The natural logarithm of the input image is passed to the output.

Note: If the input value is smaller than 0, the output value is set to 0.

Exp Exp Exp (exp(IMG) The exponential function of the input image is passed to the output.
Overwrite (Set to Const) Overwrite   Overwrites all voxels with the `Constant` value. Supports all data types.
Subtract (Img-Const) SubtractImgConst   Subtracts the constant from each voxel (component).
Divide (Img/Const) DivideImgConst

Divides each voxel (component) by the constant.

Note: If the constant is 0, the voxel (component)s are set to 0.

### Constant¶

`name: ``constant``, type: ``Double``, default: ``1``, deprecated name: ``C`

Sets a constant value for the arithmetic operations with two operands.