Arithmetic2

MLModule

genre

Binary

author

MeVis Medical Solutions AG

package

MeVisLab/Standard

dll

MLBasicModules

definition

mlBasicModules.def

see also

Arithmetic1, Mask, SoCalculator

keywords

add, multiply, subtract, difference, divide, min, max, or, and, xor, mask, equal, eq, neq, operation, images

Purpose

The module Arithmetic2 performs arithmetic operations on two images.

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

This module only supports scalar types for most functions. The functions Add, Multiply, Subtract, Equal, NotEqual, EqualMask, NotEqualMask, and MaskConstantIn also support the types: Complex, Vector2, Vector3, Vector6, Matrix2, and Matrix3.

Usage

Select the arithmetic operation you want to apply to the two input images. Some operations (see below) require the specification of a further constant.

Tips

The example network demonstrates how two images can be added by the Arithmetic2 module.

Windows

Default Panel

../../../Modules/ML/MLBasicModules/mhelp/Images/Screenshots/Arithmetic2._default.png

Input Fields

input0

name: input0, type: Image

input1

name: input1, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Visible Fields

Function

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

Defines the operation that is applied to the two input images.

Values:

Title

Name

Deprecated Name

Description

​Add

​Add

​Add (IMG1+IMG2)

​The input image 1 increased by input image 2 is passed to the output.

​Multiply

​Multiply

​Multiply (IMG1*IMG2)

​The input image 1 multiplied by input image 2 is passed to the output.

​Subtract

​Subtract

​Subtract (IMG1-IMG2)

​The input image 1 decreased by input image 2 is passed to the output.

​Divide

​Divide

​Divide (IMG1/IMG2)

​The input image 1 divided by input image 2 is passed to the output.

​Max

​Max

​Max (IMG1, IMG2)

​The maximum value of input images 1 and 2 is passed to the output.

​Min

​Min

​Min (IMG1, IMG2)

​The minimum value of input images 1 and 2 is passed to the output.

​Abs Max

​AbsMax

​The value of input images 1 and 2, which is the maximum absolute value, is passed to the output.

​Abs Min

​AbsMin

​The value of input images 1 and 2, which is the minimum absolute value, is passed to the output.

​Or

​Or

​OR (IMG1 or IMG2)

​Apply a logical OR operation on the images. The OR operation is performed bit-wise.

This is an integer operation, so that floating points will be calculated as integer.

​And

​And

​AND (IMG1 and IMG2)

​Apply a logical AND operation on the images. The AND operation is performed bitwise.

This is an integer operation, so that floating points will be calculated as integer.

​Xor

​Xor

​XOR (IMG1 xor IMG2)

​Apply a logical XOR operation on the images. The XOR operation is performed bitwise.

This is an integer operation, so that floating points will be calculated as integer.

​Difference

​Difference

​Difference (|IMG1-IMG2|)

​The absolute difference between input image 1 and 2 is passed to the output.

​Equal

​Equal

​EQ (i1 == i2 ? C : 0)

​The output image will have the value Constant, if image 1 equals image 2. Otherwise, it will be zero.

​Not Equal

​NotEqual

​NEQ (i1 != i2 ? C : 0)

​The output image will have the value Constant, if image 1 not equals image 2. Otherwise, it will be zero.

​Equal Mask

​EqualMask

​EQ2 ((i1 && i2 && i1==i2) ? C : 0)

​The output image will have the value Constant, if image 1 equals image 2 and both images are not zero. Otherwise, it will be zero.

​Not Equal Mask

​NotEqualMask

​NEQ2 ((i1 && i2 && i1!=i2 ) ? C : 0)

​The output image will have the value Constant, if image 1 not equals image 2 and both images are not zero. Otherwise, it will be zero.

​Mask Constant In

​MaskConstantIn

​Mask,MaskIn (IMG2 ? C : IMG1)

​The output image data will be copied from image 1 where image 2 is zero. Where image 2 is non-zero, the value Constant will be written. This can be used to perform a “mask in” operation writing a different value than the one in the original mask and can be useful if both images have different data types.

Output Image Size

name: outputImageSize, type: Enum, default: InvalidateOutputIfSizesDiffer

Defines how the module should react if the image sizes of the input images differ.

Values:

Title

Name

Description

​Adapt Output Image Size

​AdaptOutputImageSize

​The module adapts the output image size to the input image sizes.

If the field autoReplicate is set to False (the default), the smallest input image size is used as the output image size; otherwise, the largest input image size is used.

​Invalidate Output If Sizes Differ

​InvalidateOutputIfSizesDiffer

​If the input image sizes differ, the output image is invalidated.

Constant

name: constant, type: Double, default: 0, deprecated name: C

Sets a constant value required for some arithmetic operations (see Function).

Hidden Fields

autoReplicate

name: autoReplicate, type: Bool, default: FALSE

Only on automatic panel

If checked, the output image size is taken from the union of the input images, and the input images are replicated periodically in order to fill the output image size.

Otherwise, the size of the output image is taken from the intersection of the input images.

This option is obsolete and shouldn’t be used, as it is only guaranteed to work correctly if the image size of the input images is an integral multiple of the page size of the output image. Use the Replicate module instead.