EuclideanDistanceTransform

MLModule
genre Distance
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll MLDTF
definition MLDTF.def
see also DistanceTransform
keywords voronoi, norm, dtf

Purpose

The module EuclideanDistanceTransform calculates the Euclidean Distance image in 1D, 2D or 3D in millimeter. The module does not compute in higher dimensions of c, t, or u.

It is also possible to calculate a Voronoi Division.

See Details for explanations of Euclidean Distance and Voronoi Division.

Details

The Euclidean Distance is the distance between two points calculated with the Pythagorean formula.

The module EuclideanDistanceTransform calculates the distance of the considered voxel to the nearest voxel in the defined Foreground volume. Distances are measured in millimeter.

Voxels outside of the volume are considered as Background by default. If you want the outside to be considered as Foreground, you have to check the Outside Volume Is Foreground check box.

For all voxels with infinite distance, i.e., when the foreground interval is empty for the entire volume (3D dimension mode), a slice (2D) or row (1D), an impossibly high distance is written, whose actual value is provided in the Undefined Distance Value field.

The Voronoi Division is a special kind of decomposition of a space determined by distances to a specified discrete set of objects in the space, called Voronoi sites.

With the EuclideanDistanceTransform module, the Voronoi sites are defined by the Foreground volume. These site voxels keep their original value.

All other voxels get the value of their nearest site, decomposing the image to Voronoi regions.

The Voronoi Division works here like a nearest-neighbor interpolation with neighbors determined by the Foreground.

NOTE The module EuclideanDistanceTransform only computes in x, y, and z. c, t, and u of the output image are always set to 1. All other time points, color dimensions, or user dimensions are discarded.

Windows

Default Panel

../../../Modules/ML/MLDTF/mhelp/Images/Screenshots/EuclideanDistanceTransform._default.png

Input Fields

input0

name: input0, type: Image

Only standard data types are fully supported. All other data types can cause unexpected results.

Output Fields

output0

name: output0, type: Image

This output contains the Euclidean Distance image.

output1

name: output1, type: Image

This output contains the Voronoi Division image.

Parameter Fields

Field Index

Apply Time: Enum Output Mode: Enum Update Mode: Enum
Auto Update Time: Enum Outside Volume Is Foreground: Bool  
Clear: Trigger Outside Volume Label Value: Double  
Dimension: Enum Precision: Enum  
Distance Mode: Enum Results Up to Date: Bool  
dtfValid: Bool Scale: Float  
Max Value: Double Undefined Distance Value: Float  
Min Value: Double Update: Trigger  

Visible Fields

Output Mode

name: outputMode, type: Enum, default: DistanceOnly

Defines which output image will be calculated.

It is recommendable to select just the needed output to reduce memory consumption.

Distance Mode

name: distanceMode, type: Enum, default: ForegroundVoxelCenter

Defines which position on the foreground voxels is used for the distance calculation.

Values:

Title Name Description
Foreground Voxel Center ForegroundVoxelCenter The distance is calculated from the voxel center of foreground voxels.
Foreground Voxel Border ForegroundVoxelBorder The distance is calculated from the voxel border of foreground voxels. This reduces the distance by half a voxel compared to ForegroundVoxelCenter.

Precision

name: dtfPrecision, type: Enum, default: FloatPrecision

Defines the data type of the Euclidean Distance image.

Values:

Title Name Description
Integer Precision IntegerPrecision The distances will be given as rounded integers.
Float Precision FloatPrecision The distances will be given as floating points.

Scale

name: distanceScaling, type: Float, default: 1

Sets a scaling factor, the result of the Euclidean Distance is multiplied with.

Apply Time

name: applyTime, type: Enum, default: OnRequest

Defines the time when Scale and Precision will be applied on the Euclidean Distance. Changing the apply time will invalidate the current result.

Values:

Title Name Description
On Request OnRequest Allows value changes of Scale or Precision without recalculation but is slightly slower.
During Calculation DuringCalculation Parameters Scale and Precision are applied during DTF computation, which is faster, but they cannot be altered without recomputing the entire DTF.

Dimension

name: dimension, type: Enum, default: 3D

Defines the dimensions considered for calculation of Euclidean Distance and Voronoi Division.

Min Value

name: minValue, type: Double, default: 0

Sets the minimum value of the range defining a Foreground volume.

Max Value

name: maxValue, type: Double, default: 0

Sets the maximum value of the range defining a Foreground volume.

Outside Volume Is Foreground

name: outsideVolumeIsForeground, type: Bool, default: FALSE

Check this if the voxels outside the image volume should be considered as Foreground instead of Background.

Outside Volume Label Value

name: outsideVolumeLabelValue, type: Double, default: 0

This is the voxel value to assume for the region outside the image volume for the purpose of the Voronoi Division calculation (if selected). This is only used if Outside Volume Is Foreground is checked or if there are no Foreground voxels in the image. Min Value and Max Value are not applied to this value.

Update Mode

name: autoUpdateMode, type: Enum, default: Off

Defines the update mode.

Values:

Title Name Description
Off Off No automatical update.
Auto Clear AutoClear Deletes results automatically on parameter and input changes.
Auto Update AutoUpdate Recalculates results automatically on parameter and input changes.

Auto Update Time

name: autoUpdateTime, type: Enum, default: ImmediatelyOnInputChange

Defines the apply time of AutoUpdate.

This field is only used if AutoUpdate is selected as update mode.

Values:

Title Name Description
Immediately On Input Change ImmediatelyOnInputChange Recalculates results immediately on parameter and input changes.
On Output Request OnOutputRequest Recalculates results only if they are requested for further use.

Update

name: update, type: Trigger

If pressed, the module computes anew.

Clear

name: clear, type: Trigger

If pressed, the module deletes the results and release the memory.

Results Up to Date

name: resultsUpToDate, type: Bool, persistent: no

Indicates if the current results are valid and correspond to the current parameterization (i.e. no update is needed).

Undefined Distance Value

name: undefinedDistanceValue, type: Float, persistent: no

Puts out the value that is used to mark voxels with infinite distance, i.e. when the foreground interval is empty for the entire volume (3D dimension mode), a slice (2D) or row (1D). The value is computed as

Scale * ( round( norm_2(( imageExt-1 ) .* voxelSize ) ) +1)

i.e. the image diagonal (w.r.t to the selected dimension and using voxel centers) multiplied with the distance scaling factor, plus one. The value is also used for the max value of the distance image (no matter if undefined regions actually exist). The field is output only.

Hidden Fields

dtfValid

name: dtfValid, type: Bool, persistent: no

Indicates that the current transform results are valid, in which case an ‘on-request’ application of scale and precision is possible