DIPlib Documentation - ©1995-2013 Quantitative Imaging Group, Delft University of Technology.

# EuclideanDistanceTransform

Euclidean distance transform

## SYNOPSIS

`#include "dip_distance.h"`

dip_Error dip_EuclideanDistanceTransform ( in, out, distance, border, method )

## DATA TYPES

binary

## FUNCTION

This function computes the Euclidean distance transform of an input binary image using the vector-based method as opposed to the chamfer method. This method computes distances from the objects (binary 1's) to the nearest background (binary 0's) of `in` and stored the result in `out`. The `out` image is a `sfloat` type image.

The `distance` parameter can be used to specify anisotropic sampling densities. If it is set to zero, the sampling density is assumed to be 1.0 along all axes.

The `border` parameter specifies whether the edge of the image should be treated as objects (`border` = `DIP_TRUE`) or as background (`border` = `DIP_FALSE`).

Individual vector components of the Euclidean distance transform can be obtained with the `VectorDistanceTransform`.

## ARGUMENTS

Data type | Name | Description
`dip_Image` | `in` | Input image
`dip_Image` | `out` | Output image
`dip_FloatArray` | `distance` | Sampling distances
`dip_Boolean` | `border` | Image border type
`dipf_DistanceTransform` | `method` | Transform method

`dipf_DistanceTransform` defines the following distance transform types:

Name | Description
`DIP_EDT_FAST` | fastest, but most errors
`DIP_EDT_TIES` | slower, but fewer errors
`DIP_EDT_TRUE` | slow, uses lots of memory, but is "error free"
`DIP_EDT_BRUTE_FORCE` | gives a result from which errors are calculated for the other methods. This method is extremly slow and should only be used for testing purposes.

## LITERATURE

Danielsson, P.E. (1980). "Euclidean distance mapping." Computer Graphics and Image Processing 14: 227-248.

Mullikin, J.C. (1992). "The vector distance transform in two and three dimensions." CVGIP: Graphical Models and Image Processing 54(6): 526-535.

Ragnemalm, I. (1990). Generation of Euclidean Distance Maps, Thesis No. 206. Licentiate thesis. Linkoing University, Sweden.

Ye, Q.Z. (1988). "The signed Euclidean distance transform and its applications." in Proceedings, 9th International Conference on Pattern Recognition, Rome, 495-499.

## KNOWN BUGS

The `EDT_TRUE` transform type is prone to produce an internal buffer overflow when applied to larger (almost) spherical objects. It this cases use `EDT_TIES` or `EDT_BRUTE_FORCE` instead.

The option `border` = `DIP_FALSE` is not supported for `EDT_BRUTE_FORCE`.

This function supports 2 and 3-dimensional images.

## AUTHOR

James C. Mullikin, adapted to DIPlib by Geert M.P. van Kempen

## SEE ALSO

`VectorDistanceTransform`, `GreyWeightedDistanceTransform`