The Euclidean Distance Transform in Arbitrary Dimensions
The Euclidean Distance Transform in Arbitrary Dimensions
Intmdudon
The Euclidean Distance Transform, (EDT) invented by
Danielsson [3]. allows the generation of distance maps
with no significant errors. Later versions of the algorithm
generate completely error-free Euclidean distance maps
[9.6]. The superior precision of the EDT over other
distance transformation algorithms is possible due to the
c-
Mask 2a
-
Mask 2b
Authorized licensed use limited to: Isfahan University of Technology. Downloaded on May 25, 2009 at 07:49 from IEEE Xplore. Restrictions apply.
291
- We use only immediate neighbours, that is, for the From direction space to algorithms
voxel in position (x1.xZ.x3...) we may use neighbours at
positions (x,+dl. xz+d2. x3+d3...) where di E ( -1.0.+1 1. With the Unfolded Cube graph as a tool, we will now
search for 3D operators useful for a 3D version of EDT. As
- We use separable algorithms. since they can be previously stated. we are only interested in algorithms
implemented in parallel. using neighbourhoods which are subsets within the 3.3.3
neighbourhood. It is of no use to include voxels forward in
- We try to minimize the number of scans. the scanning directions since they do not contribute to the
directions supported. Hence, the largest reasonable mask
The dimdon space within 3.3.3 is the one shown in Figure 4.
In a separable Euclidean distance transform, each scan It is not difficult to fmd that the Unfolded Cube Graph
will support propagation over some part of the direction for such a mask, displaying the parts of the direction space
space, and the union of these parts should cover the entire where propagation is supported by the mask, is the one
direction space completely. This necessary requirement is shown in Figure 5 . This Unfolded Cube Graph, as well as
discussed in 17). the following ones, can be found directly from the mask,
but have also been verified with computer experiments.
In 2-dimensional images, the direction space is
simple: a 1-dimensional unit circle. It is very simple to
analyze algorithms to see what parts of the direction space
are supported by each scan, and then confirm that the
entire direction space is covered. Such a coverage check is
easily done e.g. in Figure 2 above.
The direction space for 3-dimensional images is a 2- Figure 4 . The fargest mark within a 3.3.3 neighbourhood
dimensional space, a unit sphere. In order to analyze and rcseful for separable EDT algorithmr.
n
visualize this space, a seaightfonvard approach could be to
map the directions on this sphere. However, a segmented
sphere is hard to represent on a 2D plane.
Figure 3 . The Unfolded Cube Graph Figure 6. The four m a s h in the 4-scan algorithm, the
algorithm with the smallest possible number of scans.
Authorized licensed use limited to: Isfahan University of Technology. Downloaded on May 25, 2009 at 07:49 from IEEE Xplore. Restrictions apply.
292
Figure 7 . The correvonding Unfolded Cube Graphfor one Figure 10. The Unfolded Cube Graph corresponding to the
of the masks in Figure 6. (Bottom lefi.) mask in Figure 9.
n
shown in Figure 9. The mask demands significantly more
processing time compared to the mask in Figure 4, but the
gain in direction space is marginal. See Figure 10. In par-
ticular, the proof above still holds for this mask, so it is
still impossible to make an algorithm with less than 4
scans.
Authorized licensed use limited to: Isfahan University of Technology. Downloaded on May 25, 2009 at 07:49 from IEEE Xplore. Restrictions apply.
293
In 2D. we need four masks (and four scans), in 3D we need 3”-neighbour EDT 2“ 2.3”-2”
eight masks, in 4D 16 masks etc. The number of 2n-neighbour Corner EDT (S) 2” 2”(n+l)
neighbours in each mask grows obviously from 2 to 3 to 4 3”mighbour Corner EDT (S) 2“ 4”
etc. In n dimensions. we need 2” masks, each with center
hoxel and n neighbours. It is evident from the table that the non-separable
algorithms have a considerable advantage over Comer EDT
For each n-dimensional space, a number of different on single processor architectures. The algorithms using
algorithms are possible, all with the high precision that the smallest number of scans possible (3-scan and 4-scan
the EDT gives, but still with a few small errors. The more in the table), however, have much better performance and
neighbours we use, the fewer errors will we get. The are good choices for single processor and parallel systems
extreme cases are n neighbours as mentioned above, which alike.
is the fastest. but with the lowest precision (a higher
number of hoxek with a small error), and 3”-1 neighbours.
which gives the highest precision. Since the precision of Conclusions
the fmt, simplest case is good enough for any reasonable
We have presented separable algorithms for computing
application, we no not describe the other cases in detail.
EDT in 3 or higher dimensions, as well as some principles
We end this section with a more compact definition of behind the algorithm design. For this task, we use a new
the U-neighbour Comer EDT. tool, the Unfolded Cube Graph, to visualize the 2-
dimensional direction space for 3-dimensional images.
r FDT. n n m This graph proved to be very suitable for the kind of
analysis needed.
We have a set of scan directions: Among the results are a 4-scan algorithm for 3-
(di, ic{l..n))c {-I, +I) dimensional images and an algorithm for arbitrary
For each set of di possible (2” different ones), we have dimensions,
one scan, where for each center hoxel (x, ... x n ) , the
following neighbours are used:
n References
U (XI, XZ,..., xi-I I xi + di, I xi+l ...,xn) [l] G. Borgefors. “Distance Transformations in Arbi-
i-1 vary Dimensions”. Computer Graphics and Image
Processing 27, 1984. pp. 321-345.
Performance [2] G. Borgefors, “Distance Transformations in Digital
Images”. Computer Vision, Graphics and Image
TO evaluate the performance of different algorithms, we Processing 34. 1986. pp 344-371.
should examine key operations m e the number of memory [31 P.E. ~ ~ i “Euclidean
~ l Distance
~ ~Mapping”,
~ ~ ,
accesses and the number of arithmetic operations. Computer Graphics and Image Processing 14, 1980.
pp. 227-248.
An even simple measure is the number of masks, which
is he of times the center pixel be As 141 R. Mob. R. Bajcsy. “Packing volumes by spheres”.
long as the mask sizes are reasonably small, this is an IEEE Trans. on Pattern Analysis and Machine
Infelligence, Vol PAMI-5, no 1 , 1983, pp 111-116.
acceptable simplification.
[5] U. Montanari. “A Method for Obtaining Skeletons
Another simple measure is the total number of mem- Using a Quasi-Euclidean Distance”. Journal of the
bers in all masks. For small masks, this is not so accurate ACM, vol 15 No 4 , 1968. pp 600-624.
since the processing of the center pixel takes more time [6] I. Ragnemalm, “Contour processing distance trans-
than the processing of the neighbours. forms”, in: Cantoni et. al., eds. Progress in Image
Analysis and Processing, World Scientific, Singa-
Below, a small collection of Euclidean distance trans- pore, 1990, pp 204-212.
formation algorithms is listed, with the number of scam I. Ragnemalm, ‘The Euclidean Distance Transform
[7]
(number of masks) and the total number of members in all and its implementation on SIMD architectures”.
masks used. The calculation of the number of mask Proceedings, 6th Scandinavian Conf. on Image
members is left out due to space limitations. Algorithms Analysis, 1989, pp 379-384.
marked with (S) are separable. A. Rosenfeld, J.L.Pfaltz, “Sequential Operations in
[8]
Digital Picture Processing”, Journal of the ACM, Vol
Aborthm-S!a@sLPixel accesses 13, No 4, 1966, pp 471-494.
2 dimensions: H. Yamada, “Complete Euclidean Distance Trans-
[9]
BSSED 4 14 formation By Parallel Operation”, Proceedings, 7;th
3-scan EDT (S) 3 14 International Conference on Pattern Recognition,
3 dimensions: 1984. pp 69-71.
6-neighbour EDT 8 22
26-neighbour EDT 8 46 [ 101 Q.Z. Ye, ‘The Signed Euclidean Distance Transform
6-neighbour Corner EDT (S) 8 32 and Its Applications”, Proceedings, 9:th Inter-
26-neighbour Corner EDT (S) 8 64 national Conference on Pattern Recognition. 1988,
4-scan (26-neighbour) EDT (S) 4 52 pp 495-499.
Arbitrary (n) dimensions:
2n-neighbour EDT 2” 3.2” - 2
Authorized licensed use limited to: Isfahan University of Technology. Downloaded on May 25, 2009 at 07:49 from IEEE Xplore. Restrictions apply.