ImageCompare

MLModule
genre Test
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll MLMiscModules
definition MLMiscModules.def
see also Arithmetic2
keywords images, check, equality, comparison, CompareImages

Purpose

The module ImageCompare compares two ML input images.

The comparison can be limited to a certain set of features, e.g. to avoid that different data types or page extents are considered as a real difference.

If the second input image is not connected, the second image is assumed to have identical properties as the first input image with voxel values given by Constant Voxel Value ; this is useful to compare an entire image against a specific value.

Windows

Default Panel

../../../Modules/ML/MLMiscModules/mhelp/Images/Screenshots/ImageCompare._default.png

Input Fields

The module has two inputs whose properties and/or contents are to be compared.

Both input voxel types can be of any fully operational scalar or non scalar voxel type.

If input voxel types differ they are implicitly cast to the data type of the first input connector. This is especially important if you compare an integer image at the first input with a floating point image at the second one. Then the comparison is performed with integers. If necessary switch both inputs or convert the first input to the desired one with a Scale or an ImagePropertyConvert module.

input0

name: input0, type: Image

This input is the first image which is compared against the second one. Therefore it always has to be available for comparisons.

input1

name: input1, type: Image

This is the second image used for comparison. See also Compare against constant if second input is not connected and Constant Voxel Value which allow that the second input may be open for comparison.

Parameter Fields

Visible Fields

Compare

name: compare, type: Trigger

If pressed, the comparison of both images is started. If input images with different voxel types are compared then the voxels of the second input image are cast to the type of the first input image before comparing them.

Status

name: status, type: String, persistent: no

Shows test results or information about failure.

Test Passed

name: testPassed, type: Bool, persistent: no

Shows the result of the image comparison. If true, no differences where found.

Detected Voxel Errors

name: numVoxelDataErrors, type: Integer, persistent: no

Holds the number of detected voxel differences when VoxelData is enabled. Note that unless CompareAllVoxels is also enabled, the number of errors will never be greater than 1 because the comparison stops on the first one.

Epsilon

name: epsilon, type: Double, default: 1e-06

Sets the maximum difference between values in voxel size and the world matrix before they are considered different.

Voxel Value Epsilon

name: voxValEpsilon, type: Double, default: 0

This epsilon value is used for comparisons of voxel values between input image 0 and 1. Normally it is expected that both values are identical, however, in some cases certain differences might be allowed. For this purpose this epsilon value can be set to determine the maximum allowed difference between two input voxel values.

Notes:

-The given epsilon value is always used as absolute value and cast to the voxel type of the first input image before voxel comparisons.

-To compare two voxels the positive difference is determined by subtracting the smaller from the larger value. This difference is then compared with the cast epsilon value.

-On registered voxel types the comparison and cast operations of the registered types are used to determine the value difference and the comparison of it with the epsilon value. Have a closer look at these operations to understand in detail what happens on the epsilon check.

Precision of Seconds

name: tPrecisionEpsilon, type: Integer, default: 3, minimum: 0, maximum: 15

Sets the number of digits after decimal point to be compared on DateTime comparisons.

DataType

name: checkDataType, type: Bool, default: TRUE

If checked, the data type of voxels of both images are being compared.

ImgExt

name: checkImgExt, type: Bool, default: TRUE

If checked, the image extents of both images are being compared.

PageExt

name: checkPageExt, type: Bool, default: TRUE

If checked, the page extents of both images are being compared.

MinVoxVal

name: checkMinVoxVal, type: Bool, default: TRUE

If checked, the minimum voxel values of both images are being compared.

MaxVoxVal

name: checkMaxVoxVal, type: Bool, default: TRUE

If checked, the maximum voxel values of both images are being compared.

UpToDate

name: checkUpToDate, type: Bool, default: TRUE

If checked, the up-to-date flags of both images are being compared.

VoxelSize

name: checkVoxelSize, type: Bool, default: TRUE

If checked, the voxel sizes of both images are being compared.

WorldMatrix

name: checkWorldMatrix, type: Bool, default: TRUE

If checked, the world matrices of both images are being compared.

IsWorldMatrixValid

name: checkIsWorldMatrixValid, type: Bool, default: TRUE

If checked, the validity flags of world matrices of both images are being compared.

CDimInfos

name: checkCDimInfos, type: Bool, default: TRUE

If checked, the cDimInfos of both images are being compared.

TDimInfos

name: checkTDimInfos, type: Bool, default: TRUE

If checked, the tDimInfos of both images are being compared.

UDimInfos

name: checkUDimInfos, type: Bool, default: TRUE

If checked, the uDimInfos of both images are being compared.

ImgPropExts

name: checkImgPropExts, type: Bool, default: TRUE

If checked, the number and string dumps of ImagePropertyExtensions are being compared. To limit the amount of shown dump information, only a substring is reported which contains the first difference. Note that ImagePropertyExtensions often contain data which is not human readable.

VoxelData

name: checkVoxelData, type: Bool, default: TRUE

If checked, the values of image voxels are being compared.

Post error if difference is found

name: postErrorOnDiff, type: Bool, default: TRUE

If checked, an error message is send to the ML error manager if any differences are found on comparisons.

Message Add On 1

name: additionalPostMessage1, type: String

The value of this field is appended to posted messages; it can be useful to set this field to current loop values, file names or similar values to have this information printed in messages resulting from automatic comparisons.

Message Add On 2

name: additionalPostMessage2, type: String

The value of this field is appended to posted messages after Message Add On 1; it can be useful to set this field to current loop values, file names or similar values to have this information printed in messages resulting from automatic comparisons.

CompareAllVoxels

name: compareAllVoxels, type: Bool, default: FALSE

If checked, all voxels are being compared even if a difference has already been found.

If unchecked, the comparison stops at the first difference.

Constant Voxel Value

name: inp1Val, type: Double, default: 0

Sets a value used for emulated image input 1 voxel values.

Only used if Compare against constant if second input is not connected is checked and input 1 is unconnected.

Compare against constant if second input is not connected

name: compareIf2ndInputIsOpen, type: Bool, default: FALSE

If checked, the module compares only the voxel values of the first input image against the value set in Constant Voxel Value. You might want to change Handle open inputs as error to OpenInputsAreNoError or FirstOpenInputIsError if you use this option.

Handle open inputs as error

name: handleOpenInputsAsErr, type: Enum, default: ExactlyOneOpenInputIsError

This field controls whether open inputs are handled as errors.

Values:

Title Name Deprecated Name Description
Open Inputs Are No Error OpenInputsAreNoError BothOpenInputsAreNoError It is not considered as an error when a comparison is requested and any of the two inputs are open or invalid. On open inputs the comparison is simply not performed, or - in the case of the second input - see also Compare against constant if second input is not connected and Constant Voxel Value which allow that the second input may be open for comparison to emulate a single valued image.
Any Open Input Is Error AnyOpenInputIsError   It is considered as an error when a comparison is requested and any of the two inputs are open or invalid.
First Open Input Is Error FirstOpenInputIsError   It is considered as an error when a comparison is requested and the first input is open or invalid.
Second Open Input Is Error SecondOpenInputIsError   It is considered as an error when a comparison is requested and the second input is open or invalid.
Exactly One Open Input Is Error ExactlyOneOpenInputIsError   It is not considered an error if both inputs are open, but if only one input is open (and the other one not), an error is posted.

Update Mode

name: updateMode, type: Enum, default: AutoClear

Defines the update mode of this module.

Values:

Title Name Description
Auto Update AutoUpdate Updates on any parameter or input image change.
Auto Clear AutoClear Resets all output fields on any parameter or input change.