Journal of Mathematical Imaging and Vision

, Volume 39, Issue 3, pp 193–209 | Cite as

Linear Time Algorithms for Exact Distance Transform

  • Krzysztof Chris Ciesielski
  • Xinjian Chen
  • Jayaram K. Udupa
  • George J. Grevera


In 2003, Maurer et al. (IEEE Trans. Pattern Anal. Mach. Intell. 25:265–270, 2003) published a paper describing an algorithm that computes the exact distance transform in linear time (with respect to image size) for the rectangular binary images in the k-dimensional space ℝ k and distance measured with respect to L p -metric for 1≤p≤∞, which includes Euclidean distance L 2. In this paper we discuss this algorithm from theoretical and practical points of view. On the practical side, we concentrate on its Euclidean distance version, discuss the possible ways of implementing it as signed distance transform, and experimentally compare implemented algorithms. We also describe the parallelization of these algorithms and discuss the computational time savings associated with them. All these implementations will be made available as a part of the CAVASS software system developed and maintained in our group (Grevera et al. in J. Digit. Imaging 20:101–118, 2007). On the theoretical side, we prove that our version of the signed distance transform algorithm, GBDT, returns the exact value of the distance from the geometrically defined object boundary. We provide a complete proof (which was not given of Maurer et al. (IEEE Trans. Pattern Anal. Mach. Intell. 25:265–270, 2003) that all these algorithms work correctly for L p -metric with 1<p<∞. We also point out that the precise form of the algorithm from Maurer et al. (IEEE Trans. Pattern Anal. Mach. Intell. 25:265–270, 2003) is not well defined for L 1 and L metrics. In addition, we show that the algorithm can be used to find, in linear time, the exact value of the diameter of an object, that is, the largest possible distance between any two of its elements.


Distance transform Euclidean distance Linear time Digital boundary Diameter Digital geometry 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bai, X., Latecki, L.J., Liu, W.: Skeleton pruning by contour partitioning with discrete curve evolution. IEEE Trans. Pattern Anal. Mach. Intell. 29(3), 449–462 (2007) CrossRefGoogle Scholar
  2. 2.
    Beristain, A., Grana, M.: Pruning algorithm for Voronoi skeletons. Electron. Lett. 46(1), 39–41 (2010) CrossRefGoogle Scholar
  3. 3.
    Cuisenaire, O.: Distance transformations: fast algorithms and applications to medical image processing. Dissertation (1999) Google Scholar
  4. 4.
    Grevera, G.J.: Distance transform. In: Suri, J.S., Farag, A. (eds.) Parametric and Geometric Deformable Models: An Application in Biomaterials and Medical Imagery. Springer, Berlin Google Scholar
  5. 5.
    Grevera, G.J., Udupa, J.K.: Shape-based interpolation of multidimensional grey-level images. IEEE Trans. Med. Imaging 15(6), 881–892 (1996) CrossRefGoogle Scholar
  6. 6.
    Grevera, G., Udupa, J., Odhner, D., Zhuge, Y., Souza, A., Iwanaga, T., Mishra, S.: CAVASS: a computer assisted visualization and analysis software system. J. Digit. Imaging 20(1), 101–118 (2007) CrossRefGoogle Scholar
  7. 7.
    Herman, G.T., Zheng, J., Bucholtz, C.A.: Shape-based interpolation. IEEE Comput. Graph. Appl. 12(3), 69–79 (1992) CrossRefGoogle Scholar
  8. 8.
    Maurer, C.R. Jr., Qi, R., Raghavan, V.: A linear time algorithm for computing exact Euclidean distance transforms of binary images in arbitrary dimensions. IEEE Trans. Pattern Anal. Mach. Intell. 25(2), 265–270 (2003) CrossRefGoogle Scholar
  9. 9.
    Pizer, S.M., Gerig, G., Joshi, S.C., Aylward, S.R.: Multiscale medial shape-based analysis of image objects. Proc. IEEE 91(10), 1670–1679 (2003) CrossRefGoogle Scholar
  10. 10.
    Raya, S.P., Udupa, J.K.: Shape-based interpolation of multidimensional objects. IEEE Trans. Med. Imaging 9(1), 32–42 (1990) CrossRefGoogle Scholar
  11. 11.
    Royden, H.L.: Real Analysis. MacMillan, New York (1988) MATHGoogle Scholar
  12. 12.
    Tustison, N.J., Siqueira, M., Gee, J.C.: N-D linear time exact signed Euclidean distance transform. Insight J., January–June (2006).
  13. 13.
    Udupa, J.K.: Multidimensional digital boundaries. Graph. Models Image Process. 56(4), 311–323 (1994) CrossRefGoogle Scholar
  14. 14.
    Udupa, J.K., Grevera, G.J.: Go digital, go fuzzy. Pattern Recognit. Lett. 23, 743–754 (2002) MATHCrossRefGoogle Scholar
  15. 15.
    Ge, Y., Fitzpatrick, J.M.: On the generation of skeletons from discrete Euclidean distance maps. IEEE Trans. PAMI 18(11), 1055–1066 (1996) Google Scholar
  16. 16.
    da Fontoura Costa, L.: Robust skeletonization through exact Euclidean distance transform and its application to neuromorphometry. Real-Time Imaging 6(6), 415–431 (2000) MATHCrossRefGoogle Scholar
  17. 17.
    Souza, A., Udupa, J.K.: Automatic landmark selection for active shape models. Proc. SPIE Med. Imaging 5747, 1377–1383 (2005) Google Scholar
  18. 18.
    Tsai, A., Well, W., Tempany, C., Grimson, E., Willsky, A.: Mutual information in coupled multi-shape model for medical image segmentation. Med. Image Anal. 8(4), 429–445 (2004) CrossRefGoogle Scholar
  19. 19.
    Marai, G.E., Laidlaw, D.H., Crisco, J.J.: Super-resolution registration using tissue-classified distance fields. IEEE Trans. Med. Imaging 25(2), 177–187 (2006) CrossRefGoogle Scholar
  20. 20.
    Nyul, L.G., Udupa, J.K., Saha, P.K.: Incorporating a measure of local scale in voxel-based 3-D image registration. IEEE Trans. Med. Imaging 22, 228–237 (2003) CrossRefGoogle Scholar
  21. 21.
    Theresse, P., Arbuck, S.G., Eisenhauer, E.A., et al.: New guidelines to evaluate the response to treatment in solid tumors, European Organization for Research and Treatment of Cancer, National Cancer Institute of the United States. J. Nat. Cancer Inst. 92, 205–216 (2000) CrossRefGoogle Scholar
  22. 22.
    Intel Pentium D 800 Processor 800 Sequence Datasheet (, 2006
  23. 23.
    Díaz De León S., J.L., Sossa-Azuela, J.H.: Mathematical morphology based on linear combined metric spaces on Z 2 (Part I): fast distance transforms. J. Math. Imaging Vis. 12(2), 137–154 (2000) CrossRefGoogle Scholar
  24. 24.
    Mehnert, A.J.H., Jackway, P.T.: On computing the exact Euclidean distance transform on rectangular and hexagonal grids. J. Math. Imaging Vis. 11(3), 223–230 (1999) MATHCrossRefMathSciNetGoogle Scholar
  25. 25.
    Xu, M., Pycock, D.: A scale-space medialness transform based on boundary concordance voting. J. Math. Imaging Vis. 11(3), 277–299 (1999) MATHCrossRefMathSciNetGoogle Scholar
  26. 26.
    Kimmel, R., Kiryati, N., Bruckstein, A.M.: Sub-pixel distance maps and weighted distance transforms. J. Math. Imaging Vis. 6(2–3), 223–233 (1996) CrossRefMathSciNetGoogle Scholar
  27. 27.
    Teixeira, R.C.: Medial axes and mean curvature motion II: Singularities. J. Math. Imaging Vis. 23(1), 87–105 (2005) CrossRefMathSciNetGoogle Scholar
  28. 28.
    Choi, S.W., Seidel, H.-P.: Linear one-sided stability of MAT for weakly injective domain. J. Math. Imaging Vis. 17(3), 237–247 (2002) MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2010

Authors and Affiliations

  • Krzysztof Chris Ciesielski
    • 1
    • 2
  • Xinjian Chen
    • 2
  • Jayaram K. Udupa
    • 2
  • George J. Grevera
    • 2
    • 3
  1. 1.Department of MathematicsWest Virginia UniversityMorgantownUSA
  2. 2.Dept. of Radiology, MIPGUniv. of PennsylvaniaPhiladelphiaUSA
  3. 3.Mathematics and Computer Science DepartmentSaint Joseph’s UniversityPhiladelphiaUSA

Personalised recommendations