0% found this document useful (0 votes)
449 views4 pages

The Euclidean Distance Transform in Arbitrary Dimensions

This document discusses algorithms for performing Euclidean distance transforms in dimensions higher than 2. It proposes separable algorithms that can be implemented in parallel. A 3-dimensional 4-scan algorithm is presented. The concept of an "unfolded cube graph" is introduced to visualize which directions of propagation are supported by different mask shapes in higher dimensions. This graph can be used to design distance transform algorithms that fully cover the direction space.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
449 views4 pages

The Euclidean Distance Transform in Arbitrary Dimensions

This document discusses algorithms for performing Euclidean distance transforms in dimensions higher than 2. It proposes separable algorithms that can be implemented in parallel. A 3-dimensional 4-scan algorithm is presented. The concept of an "unfolded cube graph" is introduced to visualize which directions of propagation are supported by different mask shapes in higher dimensions. This graph can be used to design distance transform algorithms that fully cover the direction space.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

290

The Euclidean Distance Transform in arbitrary dimensions


I Ragnemalm

Linkaping University, Sweden

Abst;ract algorithms in 3 and higher dimensions by Mohr and


Bajcsy [4] and Borgefors [I].
The sequential, raster scanning algorithm for perfor-
ming Euclidean Distance Transformation of binary images
proposed by Danielsson is not separable. This makes them
useful only on single processor systems. In this paper, we
suggest variants for 2. 3 and arbitrary dimensions that are
separable, which makes them suitable for many types of
parallel architectures as well. The results include a 4-scan
algorithm for 3-dimensional images.
v
Mask l a
-
Mask l b

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

Figure I . The original 2-dimensional EDT.


use of vectors instead of scalar values for the propagation
of distance values. Pseudo-Euclidean algorithms [2. 51 can
In Figure 1. each mask pair la. l b resp. 2%2b result in
get close to Euclidean metric, but they always have errors
propagations in half of all possible directions. Each pixel
proportional to distance.
holds a two-component vector. These vectors, pointing to
The generalization of distance maps, and Euclidean the center pixel (0.0). are the offset vectors used in the
distance maps in particular, to 3 or arbitrary dimensions algorithm, These vectors will be omitted in the following
has received relatively little attention. Algorithms for 3D figures.
with some generalization has been described by Mohr and
One separable Euclidean distance transform for 2-
Bajcsy [4] and Borgefors [l].
dimensional images is the three-scan EDT suggested in 171
In this paper, a number of new algorithms for EDT in 3 and illusbrated in Figure 2.
and higher dimensions are presented. We will not describe .*,,I ................,
the processing of EDT in detail, but rather define algo-
rithms with the neighbourhoods (masks) used. Detailed
descriptions of the Euclidean distance transform are found
in [3, 101. We limit the discussion to raster scanning,
+
sequential algorithms, as proposed by Rosenfeld [8].
U
Separable Euclidean distance transforms
We define a separable EDT algorithm as an algorithm
where the scans can be applied independently, in any
order. A non-separable EDT algorithm uses scans that are
dependent of each other, combining several masks in one
scan. The terms separable and non-separable are equivalent Figure 2.3-scan EDT.
to single-scanning resp. double-scanning in [7]. Separable algorithms are useful for iniplernentation on
In the original 8SSED algorithm, as proposed by parallel architectures, but they are also quite useful on
single processor systems. In this paper, we will present
Danielsson [3] and illustrated in Figure 1, each line is
separable algorithms for 3 and arbitrary dimensions. We
scanned back and forth, thereby makiig two scam of each
will put the following constraints on our algorithms.
line for each scan through the image. Hence, this
algorithm is not separable. The same holds for the

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.

Instead, we will use a different method which we call


Unfolded Cube Graphs. In this case, the direction space is
mapped on a cube, which we can display unfolded in 2D.
This kind of graph is more suitable than graphs using
spheres, not only because it is easier to map on a 2D
plane, but also because of the close relation between the
Cartesian grid and the direction segments to be supported.

Figure 3 illustrates how the Unfolded Cube Graph


works. The needle in the figure defmes a direction from the Figure 5 . The Unfolded Cube Graph corresponding to the
center of the cube. This direction is mapped on a point in mask in Figure 4 .
the Unfolded Cube Graph.
The fewer scans we need, the faster the algorithm will
run. By inspecting the Unfolded Cube Graphs, we have
found a solution using only four scans. illustrated in Figure
6. The four scans are symmetrical. The Unfolded Cube
Graph for one scan is shown in Figure 7.

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.

While it is possible to make mask sets of other shapes,


it is not possible to make a 3 D algorithm of this kind with Arbitrary dimensions
fewer than 4 scans. We will give a brief outline of a proof
The optimal solutions for 2D and 3 D (3-scan and 4-
of this statement.
scan, respectively) have proven difficult to generalize to
Consider an arbitrarily small circle in the center of higher dlnensions. However, we have found sub-optimal
each of the six sides of the cube in the Unfolded Cube algorithms for which this is possible.
Graph. All circles (as well as the rest of the direction cube)
While pixels in 3 D are generally called voxels. and
must be covered by at least one of the scam used. See
Borgefors [ l ] suggests the name rexel for a pixel in 4-
Figure 8.
dimensional space, there appears to exist no name in the
n literature for pixels in arbitrary dimensions. We suggest
the name hoxel (high order pixel).

We will describe one algorithm which is easy to


generalize due to symmetry, and which can be modified for
various neighbourhood sizes. We call it the Corner EDT.
Though this is far from the optimal solution. it is
reasonably fast. Its simplest 3 D version consists of eight
masks. each with the shape shown in Figure 11.

Figure 8. The centers of each side of the cube

In Figure 8. we can see that one single scan like the


1 3 7 .
one in Figure 4 will cover 1 +-+-- 1 - cucles out of the
2 8- 8 Figure 11. One of eight masks needed for 6-neighbour
six circles. Hence, it is impossible to fill the entire Corner EDT.
Unfolded Cube Graph with only three scam.
This is the minimal, 6-voxel neighbourhood version
We claim that larger neighbourhoods than 3.3.3 are of the Comer EDT. It is easy to modify it to 18- or 26-
not of practical interest. To motivate this claim, we voxel neighbourhoods. In all these cases, the Unfolded
examine the 5.5.5 case. The largest neighbourhood is Cube Graph will be identical. It is shown in Figure 12.

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.

Figure 12. Unfolded Cube Graphfor Figure 11.

The masks for each scan consists of the center voxel


Figure 9. The largest useful mask within a 5.55 and each voxel on step backwards along each scanning
neighbourhood. direction. These masks can be realized in any dimension.

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.

You might also like