Calculate distance map

Creates a 32-bit greyscale image from an input binary image, where the value of each foreground pixel in the input image is equal to its Euclidean distance to the nearest background pixel.

Description

Creates a 32-bit greyscale image from an input binary image, where the value of each foreground pixel in the input image is equal to its Euclidean distance to the nearest background pixel. This image will be 8-bit with binary logic determined by the "Binary logic" parameter. The output image will have pixel values of 0 coincident with background pixels in the input image and values greater than zero coincident with foreground pixels. Uses the plugin "MorphoLibJ".

Parameters

Parameter Description
Input image Image from workspace to calculate distance map for. This image will be 8-bit with binary logic determined by the "Binary logic" parameter.
Output image The output distance map will be saved to the workspace with this name. This image will be 32-bit format.
Weight modes The pre-defined set of weights that are used to compute the 3D distance transform using chamfer approximations of the euclidean metric (descriptions taken from https://ijpb.github.io/MorphoLibJ/javadoc/):
  • "Borgefors (3,4,5) (Emax = 0.1181)" Use weight values of 3 for orthogonal neighbors, 4 for diagonal neighbors and 5 for cube-diagonals (best approximation for 3-by-3-by-3 masks).
  • "Chessboard (1,1,1)" Use weight values of 1 for all neighbours.
  • "City-Block (1,2,3) (Emax = 0.2679)" Use weight values of 1 for orthogonal neighbors, 2 for diagonal neighbors and 3 for cube-diagonals.
  • "Svensson (3,4,5,7) (Emax = 0.0809)" Use weight values of 3 for orthogonal neighbors, 4 for diagonal neighbors, 5 for cube-diagonals and 7 for (2,1,1) shifts. Good approximation using only four weights, and keeping low value of orthogonal weight.
Match Z to XY When selected, an image is interpolated in Z (so that all pixels are isotropic) prior to calculation of the distance map. This prevents warping of the distance map along the Z-axis if XY and Z sampling aren't equal.
Spatial units mode Controls whether spatial values are assumed to be specified in calibrated units (as defined by the "Input control" parameter "Spatial unit") or pixel units.
Binary logic Controls whether objects are considered to be white (255 intensity) on a black (0 intensity) background, or black on a white background.