Skip to content

Commit d8bf73d

Browse files
committed
update manual: Euclidean distance transform
1 parent d5a698e commit d8bf73d

2 files changed

Lines changed: 224 additions & 34 deletions

File tree

‎doc/MorphoLibJ-manual/MorphoLibJ-manual.lyx‎

Lines changed: 156 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14186,6 +14186,53 @@ Binary image,
1418614186
\end_inset
1418714187

1418814188

14189+
\end_layout
14190+
14191+
\begin_layout Standard
14192+
Different algorithms exist for computing distance transforms,
14193+
mostly depending on the choice of the metric for the distance.
14194+
MorpholLibJ provides implementations for both Euclidean and chamfer masks distance transforms.
14195+
\end_layout
14196+
14197+
\begin_layout Subsection
14198+
Euclidean distance transform
14199+
\end_layout
14200+
14201+
\begin_layout Standard
14202+
The most natural choice for computing distance map is to consider the
14203+
\series bold
14204+
Euclidean distance
14205+
\series default
14206+
to the background.
14207+
Several algorithms have been proposed,
14208+
with various performance
14209+
\begin_inset CommandInset citation
14210+
LatexCommand citep
14211+
key "Borgefors1984,Cuisenaire1999,Maurer_2003_PAMI,Fabbri_2008_ACMCS,Wang_2013_PattRec"
14212+
literal "false"
14213+
14214+
\end_inset
14215+
14216+
.
14217+
The MorphoLibJ library implements Euclidean distance transforms based on the algorithm from
14218+
\begin_inset CommandInset citation
14219+
LatexCommand citet
14220+
key "Saito_Toriwaki_1994_PattRec"
14221+
literal "false"
14222+
14223+
\end_inset
14224+
14225+
.
14226+
This algorithm has the advantage of being rather simple to implement,
14227+
and to generalize easily to arbitrary dimension.
14228+
14229+
\end_layout
14230+
14231+
\begin_layout Standard
14232+
\begin_inset Newpage newpage
14233+
\end_inset
14234+
14235+
1418914236
\end_layout
1419014237

1419114238
\begin_layout Subsection
@@ -14203,13 +14250,7 @@ name "subsec:Chamfer-Distances"
1420314250
\end_layout
1420414251

1420514252
\begin_layout Standard
14206-
Several methods exist for computing distance maps.
14207-
The MorphoLibJ library implements distance transforms based on
14208-
\series bold
14209-
chamfer masks
14210-
\series default
14211-
,
14212-
that are simpler to compute than exact Euclidean distance
14253+
Chamfer distance transform is an alternative to Euclidean distance transform that is often simpler to compute
1421314254
\begin_inset CommandInset citation
1421414255
LatexCommand citep
1421514256
key "Rosenfeld_1968_PattRec,Borgefors1984,Borgefors1986"
@@ -14288,8 +14329,9 @@ Computation of distance maps using chamfer masks.
1428814329
\begin_layout Standard
1428914330
In practice,
1429014331
using integer weights may result in faster computations.
14291-
This also allows to store the resulting distance map within 16-bits grayscale images,
14292-
resulting in more efficient memory usage than floating point computation.
14332+
This allows to store the resulting distance map within 16-bits grayscale images,
14333+
resulting in more efficient memory usage than 32-bits floating point computation,
14334+
and may be computationnally more efficient.
1429314335
\end_layout
1429414336

1429514337
\begin_layout Standard
@@ -14661,13 +14703,6 @@ saturation
1466114703
of the distance map.
1466214704
\end_layout
1466314705

14664-
\begin_layout Standard
14665-
\begin_inset Newpage clearpage
14666-
\end_inset
14667-
14668-
14669-
\end_layout
14670-
1467114706
\begin_layout Subsubsection
1467214707
Chamfer distance computation
1467314708
\end_layout
@@ -15192,7 +15227,7 @@ Enhancement of 3D distance maps when using larger chamfer masks.
1519215227
Masks are based on (a) four,
1519315228
(b) five,
1519415229
or (c) six weights.
15195-
Using All images represent the threshold of the distance 100 from image center.
15230+
All images represent the threshold for the distance 100 from image center.
1519615231
\end_layout
1519715232

1519815233
\end_inset
@@ -15249,18 +15284,18 @@ Starting from version 1.5,
1524915284

1525015285
\begin_layout Standard
1525115286
As for the 2D case,
15252-
the choice of the chamfer distance is compromise between the accuracy (larger neighborhood and weights are usually more accurate) and the largest distance that can be represented.
15287+
the choice of the chamfer distance is a compromise between the accuracy (larger neighborhood and weights are usually more accurate) and the largest distance that can be represented.
1525315288
\end_layout
1525415289

15255-
\begin_layout Subsubsection
15290+
\begin_layout Subsection
1525615291
Case of label images
1525715292
\end_layout
1525815293

1525915294
\begin_layout Standard
15260-
The distance transform algorithm may also be applied to label images.
15295+
The distance transform algorithms may also be applied to label images.
1526115296
However,
1526215297
as regions corresponding to each label may be continuous,
15263-
the algorithm need to be adapted.
15298+
the algorithms need to be adapted.
1526415299

1526515300
\end_layout
1526615301

@@ -15318,8 +15353,7 @@ An example of a label image containing contiguous regions,
1531815353
For label image,
1531915354
distances are computed between each foreground (greater than zero) pixel and the nearest pixel with a different value :
1532015355
either 0 (the background) or another label.
15321-
Distances are propagated as for binary images,
15322-
using a pair of forward and backward passes.
15356+
Distances are propagated as for binary images.
1532315357
An example of result is provided on Figure
1532415358
\begin_inset space ~
1532515359
\end_inset
@@ -15335,14 +15369,103 @@ nolink "false"
1533515369
.
1533615370
\end_layout
1533715371

15338-
\begin_layout Subsubsection
15372+
\begin_layout Standard
15373+
\begin_inset Newpage newpage
15374+
\end_inset
15375+
15376+
15377+
\end_layout
15378+
15379+
\begin_layout Subsection
1533915380
Plugin usage
1534015381
\end_layout
1534115382

1534215383
\begin_layout Standard
1534315384
The MorphoLibJ library provides two plugins for computing chamfer distance maps for 2D or 3D binary images:
1534415385
\end_layout
1534515386

15387+
\begin_layout Minisec
15388+
Euclidean Distance Map
15389+
\begin_inset Index plu
15390+
range none
15391+
pageformat default
15392+
status collapsed
15393+
15394+
\begin_layout Plain Layout
15395+
15396+
\family roman
15397+
\series medium
15398+
\shape up
15399+
\size normal
15400+
\emph off
15401+
\nospellcheck off
15402+
\bar no
15403+
\strikeout off
15404+
\xout off
15405+
\uuline off
15406+
\uwave off
15407+
\noun off
15408+
\color none
15409+
Euclidean Distance Map
15410+
\end_layout
15411+
15412+
\end_inset
15413+
15414+
15415+
\end_layout
15416+
15417+
\begin_layout Standard
15418+
\begin_inset CommandInset label
15419+
LatexCommand label
15420+
name "op:Euclidean-Distance-Map"
15421+
15422+
\end_inset
15423+
15424+
Computes the Euclidean distance map from a binary or label image,
15425+
between each foreground pixel to the nearest pixel with a different value (either background or another label).
15426+
\end_layout
15427+
15428+
\begin_layout Minisec
15429+
Euclidean Distance Map 3D
15430+
\begin_inset Index plu
15431+
range none
15432+
pageformat default
15433+
status collapsed
15434+
15435+
\begin_layout Plain Layout
15436+
15437+
\family roman
15438+
\series medium
15439+
\shape up
15440+
\size normal
15441+
\emph off
15442+
\nospellcheck off
15443+
\bar no
15444+
\strikeout off
15445+
\xout off
15446+
\uuline off
15447+
\uwave off
15448+
\noun off
15449+
\color none
15450+
Euclidean Distance Map 3D
15451+
\end_layout
15452+
15453+
\end_inset
15454+
15455+
15456+
\end_layout
15457+
15458+
\begin_layout Standard
15459+
\begin_inset CommandInset label
15460+
LatexCommand label
15461+
name "op:Euclidean-Distance-Map-3D"
15462+
15463+
\end_inset
15464+
15465+
Computes the Euclidean distance map from a 3D binary or label image,
15466+
between each foreground pixel to the nearest pixel with a different value (either background or another label).
15467+
\end_layout
15468+
1534615469
\begin_layout Minisec
1534715470
Chamfer Distance Map
1534815471
\begin_inset Index plu
@@ -15380,7 +15503,7 @@ name "op:Chamfer-Distance-Map"
1538015503

1538115504
\end_inset
1538215505

15383-
computes a chamfer distance map from a binary or label image,
15506+
Computes a chamfer distance map from a binary or label image,
1538415507
between each foreground pixel to the nearest pixel with a different value (either background or another label).
1538515508
\end_layout
1538615509

@@ -15417,17 +15540,16 @@ Chamfer Distance Map 3D
1541715540
\begin_layout Standard
1541815541
\begin_inset CommandInset label
1541915542
LatexCommand label
15420-
name "op:Chamfer-Distance-Map-3d"
15543+
name "op:Chamfer-Distance-Map-3D"
1542115544

1542215545
\end_inset
1542315546

15424-
computes a chamfer distance map from a 3D binary image between each foreground voxel to the nearest voxel with a different value (either background or another label).
15547+
Computes a chamfer distance map from a 3D binary image between each foreground voxel to the nearest voxel with a different value (either background or another label).
1542515548
Input image is assumed to have cubic voxels.
1542615549
\end_layout
1542715550

1542815551
\begin_layout Standard
15429-
For each plugin,
15430-
a dialog opens and allows to select the following parameters:
15552+
The following options may be adjusted:
1543115553
\end_layout
1543215554

1543315555
\begin_layout Labeling
@@ -15463,7 +15585,7 @@ Preview (2D only) enable the preview of the result
1546315585

1546415586
\end_layout
1546515587

15466-
\begin_layout Subsection
15588+
\begin_layout Section
1546715589
Geodesic distance transform
1546815590
\end_layout
1546915591

@@ -15675,7 +15797,7 @@ Computation of the geodesic distance map on a 3D binary image.
1567515797

1567615798
\end_layout
1567715799

15678-
\begin_layout Subsubsection
15800+
\begin_layout Subsection
1567915801
Plugins
1568015802
\end_layout
1568115803

@@ -15835,7 +15957,7 @@ nolink "false"
1583515957
Binary image is assumed to have cubic voxels.
1583615958
\end_layout
1583715959

15838-
\begin_layout Subsubsection
15960+
\begin_layout Subsection
1583915961
Results interpretation
1584015962
\end_layout
1584115963

@@ -16000,7 +16122,7 @@ When computation are performed with integers,
1600016122

1600116123
\end_layout
1600216124

16003-
\begin_layout Subsubsection
16125+
\begin_layout Subsection
1600416126
Algorithms
1600516127
\end_layout
1600616128

@@ -25061,7 +25183,7 @@ n.a.
2506125183
\begin_layout Plain Layout
2506225184
\begin_inset CommandInset ref
2506325185
LatexCommand pageref
25064-
reference "op:Chamfer-Distance-Map-3d"
25186+
reference "op:Chamfer-Distance-Map-3D"
2506525187
nolink "false"
2506625188

2506725189
\end_inset

‎doc/MorphoLibJ-manual/bibliography.bib‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,4 +808,72 @@ @Misc{Kovesi_2015
808808
url = {https://arxiv.org/abs/1509.03700},
809809
}
810810

811+
@Article{Saito_Toriwaki_1994_PattRec,
812+
author = {Toyofumi Saito and Jun-Ichiro Toriwaki},
813+
journal = {Pattern Recognition},
814+
title = {New algorithms for euclidean distance transformation of an n-dimensional digitized picture with applications},
815+
year = {1994},
816+
issn = {0031-3203},
817+
number = {11},
818+
pages = {1551-1565},
819+
volume = {27},
820+
abstract = {In this paper, we propose a new method to obtain the Euclidean distance transformation and the Voronoi diagram based on the exact Euclidean metric for an n-dimensional picture. We present four algorithms to perform the transformation which are constructed by the serial composition of n-dimensional filters. When performed by a general purpose computer, they are faster than the method by H. Yamada for a two-dimensional picture. Those algorithms require only one n-dimensional array for storing input/output pictures and a single one-dimensional array for a work area, if an input picture needs not be preserved.},
821+
creationdate = {2025-11-20T17:18:58},
822+
doi = {https://doi.org/10.1016/0031-3203(94)90133-3},
823+
file = {:Saito_Toriwaki_1994_PattRec.pdf:PDF},
824+
groups = {distance transform, Distance transform},
825+
keywords = {Image processing,Distance transformation,Euclidean distance,Voronoi diagram},
826+
timestamp = {2021.10.15},
827+
url = {https://www.sciencedirect.com/science/article/pii/0031320394901333},
828+
}
829+
830+
@Article{Fabbri_2008_ACMCS,
831+
author = {Fabbri, Ricardo and Bruno, Odemir M. and Costa, Luciano da F. and Torelli, Julio C.},
832+
journal = {ACM Computing Surveys},
833+
title = {{2D} euclidean distance transform algorithms: a comparative survey},
834+
year = {2008},
835+
pages = {1--44},
836+
volume = {40},
837+
creationdate = {2025-11-20T17:19:18},
838+
doi = {10.1145/1322432.1322434},
839+
file = {:Fabbri_2008_ACMCS.pdf:PDF},
840+
groups = {Distance transform},
841+
owner = {legland},
842+
timestamp = {2008.09.24},
843+
}
844+
845+
@Article{Wang_2013_PattRec,
846+
author = {Jun Wang and Ying Tan},
847+
journal = {Pattern Recognition},
848+
title = {Efficient {Euclidean} distance transform algorithm of binary images in arbitrary dimensions},
849+
year = {2013},
850+
issn = {0031-3203},
851+
number = {1},
852+
pages = {230 - 242},
853+
volume = {46},
854+
creationdate = {2025-11-20T17:22:11},
855+
doi = {10.1016/j.patcog.2012.07.030},
856+
file = {:Wang_2013_PattRec.pdf:PDF},
857+
groups = {distance transform, Distance transform},
858+
keywords = {Euclidean distance transform},
859+
owner = {David Legland},
860+
timestamp = {2012.09.12},
861+
url = {http://www.sciencedirect.com/science/article/pii/S0031320312003482},
862+
}
863+
864+
@Article{Maurer_2003_PAMI,
865+
author = {Maurer, C. R. and Rensheng, Qi and Raghavan, V.},
866+
journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
867+
title = {A linear time algorithm for computing exact {Euclidean} distance transforms of binary images in arbitrary dimensions},
868+
year = {2003},
869+
number = {2},
870+
pages = {265--270},
871+
volume = {25},
872+
creationdate = {2025-11-20T17:25:07},
873+
doi = {10.1109/TPAMI.2003.1177156},
874+
file = {:Maurer_2003_PAMI.pdf:PDF},
875+
groups = {Distance transform},
876+
keywords = {Euclidean distance;Skeleton;Image processing;Computer vision;Interpolation;Pattern matching;Surface morphology;Image registration;Anisotropic magnetoresistance;Nearest neighbor searches},
877+
}
878+
811879
@Comment{jabref-meta: databaseType:bibtex;}

0 commit comments

Comments
 (0)