Euclidean Distance

Node Icon

Description:
Computes the Euclidean distance transform of one or more binary masks. The output image assigns to each voxel the shortest straight-line distance to the nearest boundary (edge) voxel of the mask. Optionally, you can produce a signed distance map so that distances inside the mask carry one sign (positive or negative) and distances outside carry the opposite sign.

Inputs

Mask Input

One or more binary masks whose distance transform will be computed.

Type: Mask
Cardinality: List, Required, Single

Outputs

Output

An image (per input mask) where each voxel’s value is its Euclidean distance to the nearest mask edge.

Type: Image
Cardinality: List

Settings

Distance Unit Selection

Choose the measurement unit for the distance values.

Options: mm, Voxels

Signed Distance Map Boolean

Enable to output a signed distance map. Inside-mask distances will carry one sign (see “Inside is”), outside-mask distances the opposite.

Inside Is Selection

When producing a signed map, specify whether “inside” distances are positive or negative.

Options: Positive, Negative

Example

Suppose you have a binary mask of a circular object:

<InputMask>
  0 0 0 0 0
  0 1 1 1 0
  0 1 1 1 0
  0 1 1 1 0
  0 0 0 0 0
</InputMask>
  • With unsigned output, the center voxel value = 1.0 (in voxels).
  • With signed output and “Inside Is Positive,” the center voxel = +1.0; a voxel just outside the mask = –1.0.

See also

  1. SimpleITK SignedMaurerDistanceMapImageFilter
    https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1SignedMaurerDistanceMapImageFilter.html

Keywords: distance transform, Euclidean distance, signed distance map, binary mask, morphology