Signal, Image and Video Processing

, Volume 9, Issue 1, pp 19–27 | Cite as

A fast algorithm for computation of discrete Euclidean distance transform in three or more dimensions on vector processing architectures

  • Yuriy MishchenkoEmail author
Original Paper


In this note, we introduce a function for calculating Euclidean distance transform in large binary images of dimension three or higher in Matlab. This function uses transparent and fast line-scan algorithm that can be efficiently implemented on vector processing architectures such as Matlab and significantly outperforms the Matlab’s standard distance transform function “bwdist” both in terms of the computation time and the possible data sizes. The described function also can be used to calculate the distance transform of the data with anisotropic voxel aspect ratios. These advantages make this function especially useful for high-performance scientific and engineering applications that require distance transform calculations for large multidimensional and/or anisotropic datasets in Matlab. The described function is publicly available from the Matlab Central website under the name “bwdistsc”, “Euclidean Distance Transform for Variable Data Aspect Ratio”.


Distance transform Line-scan distance transform algorithm Linear-time distance transform algorithm Distance transform Matlab Anisotropic aspect ratio 


  1. 1.
    Paglieroni, D.: Distance transforms : properties and machine vision applications, graphical models and image processing. CVGIP Graph. Model Image Process. 54, 56–74 (1992)CrossRefGoogle Scholar
  2. 2.
    Baggett, D., Nakaya, M., McAuliffe, M., et al.: Whole cell segmentation in solid tissue sections. Cytometry Part A 67, 137–143 (2005)CrossRefGoogle Scholar
  3. 3.
    Rosenfeld, A., Pfaltz, J.: Sequential operations in digital picture processing. J ACM 13, 471–494 (1966)CrossRefzbMATHGoogle Scholar
  4. 4.
    Rousson, M., Paragios, N., Deriche, R.: Implicit active shape models for 3D segmentation in MR imaging. MICCAI 3216, 209–216 (2004)Google Scholar
  5. 5.
    Town, C., Sinclair, D.: Content based image retrieval using semantic visual categories. Technical report (2001)Google Scholar
  6. 6.
    Gavrila, D.M.: Pedestrian detection from a moving vehicle. In: Vernon, D. (ed.) Computer Vission—ECCV 2000, pp. 37–49. Springer, Berlin (2000)CrossRefGoogle Scholar
  7. 7.
    Breu, H., Gil, J., Kirkpatrick, D., Werman, M.: Linear time Euclidean distance transform algorithms. IEEE Trans. Pattern Anal. 17, 529–533 (1995)CrossRefGoogle Scholar
  8. 8.
    Maurer, C., Qi, R., Raghavan, V.: A linear time algorithm for computing exact Euclidean distance transforms of binary images in arbitrary dimensions. IEEE Trans. Pattern Anal. 25, 265–270 (2003)CrossRefGoogle Scholar
  9. 9.
    Tustison, N.J., Siqueira, M., Gee, J.C.: N-D linear time exact signed euclidean distance transform. Insight J. (2006)
  10. 10.
    Guan, W., Ma, S.: A list-processing approach to compute Voronoi diagrams and the Euclidean distance transform. IEEE Trans. Pattern Anal. 20, 757–761 (1998)CrossRefGoogle Scholar
  11. 11.
    Meijster, A., Roerdink, J.B.T.M., Hesselink, W.H.: A general algorithm for computing distance transforms in linear time. Comput. Imaging Vis. 18, 331–340 (2000)CrossRefGoogle Scholar
  12. 12.
    Fabbri, R., da Fontoura Costa, L., Torelli, J.C., Bruno, O.M.: 2d Euclidean distance transform algorithms: a comparative survey. ACM Comput. Surv. 40 (2008)Google Scholar
  13. 13.
    Cuisenaire, O.: Distance transforms: fast algorithms and applications to medical imaging. Ph.D. Dissertation, Louvain-la-Neuve, Belgium (1999)Google Scholar
  14. 14.
    Verwer, B.J., Verbeek, P.W., Dekker, S.T.: An efficient uniform cost algorithm applied to distance transforms. IEEE Trans. Pattern Anal. 11, 425–429 (1989)CrossRefGoogle Scholar
  15. 15.
    Ragnemalm, I.: Neighborhoods for distance transformations using ordered propagation. CVGIP Image Underst. 56, 399–409 (1992)CrossRefzbMATHGoogle Scholar
  16. 16.
    Eggers, H.: Two fast Euclidean distance transformations in \(z^2\) based on sufficient propagation. Comput. Vis. Image Underst. 69, 106–116 (1998)CrossRefGoogle Scholar
  17. 17.
    Cuisenaire, O., Macq, B.M.: Fast Euclidean distance transformation by propagation using multiple neighborhoods. Comput. Vis. Umage Underst. 76, 163–172 (1999)CrossRefGoogle Scholar
  18. 18.
    Falcao, A.X., Stolfi, J., de Alencar, S.: The image foresting transform intelligence theory, algorithms, and applications. IEEE Trans. Pattern Anal. 26, 19–29 (2004)CrossRefGoogle Scholar
  19. 19.
    Porikli, F., Kocak, T.: Fast distance transform computation using dual scan line propagation. In: SPIE Conference Real-Time Image Processing, vol. 6496, February (2007)Google Scholar
  20. 20.
    Danielsson, P.-E.: Euclidean distance mapping. Comput. Vis. Graph. 14, 227–248 (1980)Google Scholar
  21. 21.
    Borgefors, G.: Distance transformations in arbitrary dimensions. Comput. Vis. Graph. 27, 321–345 (1984)CrossRefGoogle Scholar
  22. 22.
    Svensson, S., Borgefors, G.: Distance transforms in 3d using four different weights. Pattern Recogn. Lett. 23, 1407–1418 (2002)CrossRefzbMATHGoogle Scholar
  23. 23.
    Strand, R., Borgefors, G.: Distance transforms for three-dimensional grids with non-cubic voxels. Comput. Vis. Image Underst. 100, 294–311 (2005)CrossRefGoogle Scholar
  24. 24.
    Sethian, J.A.: A fast marching level set method for monotonically advancing fronts. Proc. Natl. Acad. Sci. 93, 1591–1595 (1996)CrossRefMathSciNetzbMATHGoogle Scholar
  25. 25.
    Watson, D.F.: Computing the n-dimensional Delaunay tessellation with application to Voronoi polytopes. Comput. J. 24, 167–172 (1981)CrossRefMathSciNetGoogle Scholar
  26. 26.
    Aurenhammer, F.: Voronoi diagrams—a survey of a fundamental geometric data structure. ACM Comput. Surv. 22, 345–405 (1991)Google Scholar
  27. 27.
    Fortune, S.: A sweepline algorithm for Voronoi diagrams. Algorithmica 2, 153–174Google Scholar
  28. 28.
    Ogniewicz, R.L., Kubler, O.: Voronoi tessellation of points with integer coordinates time efficient implementation and online edge-list generation. Pattern Recogn. 28, 1839–1844 (1995)CrossRefGoogle Scholar
  29. 29.
    Gavrilova, M.L., Alsuwaiyel, M.H.: Two algorithms for computing the Euclidean distance transform, IJIG, pp. 635–645 (2001)Google Scholar
  30. 30.
    Paglieroni, D.W.: A unified distance transform algorithm and architecture. Mach. Vis. Appl 5, 47–55 (1992)CrossRefGoogle Scholar
  31. 31.
    Kolountzakis, M.N., Kutulakos, K.N.: Fast computation of the euclidean distance maps for binary images. Inform. Process. Lett. 43, 181–184 (1992)CrossRefMathSciNetzbMATHGoogle Scholar
  32. 32.
    Chen, L., Chuang, H.Y.H.: A fast algorithm for Euclidean distance maps of a 2-d binary image. Inform. Process. Lett. 51, 25–29 (1994)CrossRefMathSciNetzbMATHGoogle Scholar
  33. 33.
    Saito, T., Ichiro, Toriwaki J.: New algorithms for Euclidean distance transformation of an n-dimensional digitized picture with applications. Pattern Recogn. 27, 1551–1565 (1994)CrossRefGoogle Scholar
  34. 34.
    Hirata, T.: A unified linear-time algorithm for computing distance maps. Inform. Process. Lett. 58, 129–133 (1996)CrossRefMathSciNetzbMATHGoogle Scholar
  35. 35.
    Felzenszwalb, P.F., Huttenlocher, D.P.: Distance transforms of sampled functions. Cornell Computing and Information Science. Technical report, September (2004) Google Scholar
  36. 36.
    Mishchenko, Y., Hu, T., Spacek, J., et al.: Ultrastructural analysis of hippocampal neuropil from the connectomics perspective. Neuron 67, 1009–1020 (2010)CrossRefGoogle Scholar
  37. 37.
    Schena, G., Favretto, S.: Pore space network characterization with sub-voxel definition. Transp. Porous Med 70, 181–190 (2007)CrossRefMathSciNetGoogle Scholar
  38. 38.
    Dima, T., Domingo, J., Dura, E.: A local level set method for liver segmentation in functional MR imaging. In: Proceedings of Nuclear Science Symposium and Medical Imaging Conference (NSS/MIC), pp. 3158–3161 (2011)Google Scholar
  39. 39.
    Kroon, D.-J.: Accurate Fast Marching, Toolbox, Matlab Central website, 23 June 2009Google Scholar
  40. 40.
    Kennedy, R.: Generalized distance transform, Toolbox, Matlab Central website, 26 May 2011Google Scholar

Copyright information

© Springer-Verlag London 2012

Authors and Affiliations

  1. 1.School of EngineeringToros UniversityMersinTurkey

Personalised recommendations