You are on page 1of 40

Distance Transform and its

Applications
Subhadip Basu, Ph.D.
Dept. of Computer Science and Engineering
Jadavpur University
Contents
Introduction to Digital Image
Distance Transform(DT)
Applications of DT
Fuzzy Distance Transform(FDT)
Fuzzy Connectivity
Applications of FDT
Reverse Fuzzy Distance Transform(RFDT)
Applications of RFDT


2
Introduction to a Digital Image
A n-dimensional grid, or simply a grid, is represented by
n
| is the set of integers.
A grid point, often referred to as a point, is an element of
n
.
When = 2, each point in the 2-dimentional grid is referred to as a pixel.
When = 3, each point in the 3-dimentional grid is referred to as a voxel and is
represented by a triplet of integer coordinates.
Standard 26-adjacency is used here, i.e., two voxels =
1
,
2,

3
, = (
1
,
2,

3
)
3

are adjacent if and only if max
13

1, where returns the absolute value.


Two adjacent voxels are often referred to as neighbors of each other; the set of 26-
neighboors of a voxel excluding itself is denoted by

().

3
Introduction to a Digital Image
An object is a fuzzy subset (,

())
3
of
3
, where

:
3

0,1 is the membership function. The support () of an object is the


set of all voxels with non-zero membership, i.e.,
= |
3
and

() 0 ;

=
3
is the background.
A 3-dimensional binary image is represented by
3
| is in {0,1}.
A binary object is a fuzzy subset (,

())
3
of
3
, where

:
3
{0,1} is the hard limiting membership function. The background
points are defined accordingly
2-D Binary Image
4
Distance Transform(DT)

The DT maps each image pixel into its smallest distance
to regions of interest [Rosenfeld and Pfaltz 1966].
Given a distance metric, the DT of an image
2
is an
assignment to each point x in ()of the distance between
x and the closest background point (

) in
2
.
Thus formally,
DT(x) = min{ d(x , y)|x () & y

}, where d is
the given distance metric.
Euclidean Distance Transform in 2d
5
Distance Transform(DT)

A generalized distance metric is represented by
d
p
(x , y) = (
i
|x
i
y
i
|
p
)
1/p
, where x and y are k- tuples, x
i
and y
i
are the i-th
coordinates of x and y.
The d
1
and d
2
metrics are known as the Manhattan or city-block distance and
Euclidean distance respectively.
Popular Chessboard Distance is computed by
d
Chessboard
(x , y) = max{|x
i
y
i
|}, where 1 i k .
City-block and Chessboard Distance metric incurs less complexity in DT computation
but the DT computed are inexact.



6
Distance Transform(DT)


Euclidean Distance Transform in 2d
DT values represented in Grayscale
7
Distance Transform(DT)


Euclidean Distance Transform in 2d
0
8
1 2 4
9 10 16
5
Squared DT values
8
Distance Transform(DT)




Euclidean Distance
9
Distance Transform(DT)




Chessboard Distance
10
Application:
Skeletonization
DT based skeletons are -
rotation invariant
robust than thinning algorithm
based skeletons

Algorithm:
Step1: Compute DT
Step2: Find Initial Skeleton by selecting
voxels x such that DT(x) DT( N
x
) ,
where N
x
is xs neighbouring voxel
Step3: Extend Initial Skeleton based on
DT values to get continuous skeleton.



Skeletonization of a 3d synthetic phantom 11
Application: Finding Shortest-Path
Start Voxel(s)
End
Voxel
(e)
Shortest-Path in 3d synthetic phantom
Shortest-Path computation between two
image pixel / voxel


d(p , s)+d(p , e) < d(q , s)+d(q , e),
where voxel p is on the shortest path
but q is not
12
Application: Finding Shortest-Path
Start Voxel(s)
End
Voxel
(e)
Shortest-Path computation between two
image pixel / voxel


d(p , s)+d(p , e) < d(q , s)+d(q , e),
where voxel p is on the shortest path
but q is not
Shortest-Path in 3d synthetic phantom
13
Fuzzy Image & Fuzzy DT(FDT)
Unlike a Binary Image where each voxel in a Fuzzy Image has a certain membership
value (x)[0,1] of being included in ().

Let denote a set of voxels; a path in from to is a sequence
=
1
,
2
, ,

= of voxels in such that every two successive voxels on the path


are adjacent.
A link is a path , consisting of exactly two adjacent voxels. The length of a path
=
1
,
2
, ,

in a fuzzy object , denoted by

(), is defined as the sum of


lengths of all links along the path, i.e.,

=
1
2
1
=1

+1


+1
,
where denotes the Euclidean distance between two voxels , .

14
Fuzzy Distance Transform
The fuzzy distance between two voxels ,
3
in an object , denoted by

(, ), is the length of one of the shortest paths from to , i.e.,


, = min
(,)

,
where (, ) is the set of all paths from to . The fuzzy distance transform
or FDT of an object is an image ,

|
3
, where

:
3

+
|
+

is the set of positive real numbers including zero, is the fuzzy distance from
the background. i.e.,

= min

(, ) .
15
Fuzzy Connectivity
Fuzzy morpho-connectivity strength of a path =
1
,
2
, ,

in a fuzzy
object , denoted by

(), is defined as the minimum FDT value along the


path:

= min
1

) .
Fuzzy morpho-connectivity between two voxels ,
3
, denoted by

(, ),
is the strength of one of the strongest morphological paths between p and q,
i.e.,

, = max
(,)

.
16
Illustration of FDT and FC
A
Low FDT value
High FDT value
Strongest path between A and B.
FDT value of the weakest point is
higher than the other path
Not the strongest path
between the A and B
S
A

S
B

17
Application to object separation
18
Application to object separation
19
Application to
CTA Image Segmentation
Phase 1: After thresholding intensity
i.e. a voxel x is not removed only if
Th
1
Intensity(x) Th
2 ,


Segmentation of overlapping arteries
and soft tissues in 3d MRI image of brain
ACA
Bassilary
ICA
ICA
20
Phase 2: After noise pruning
based on FDT.
Segmentation of overlapping arteries
and soft tissues in 3d MRI image of brain
ACA
Bassilary
ICA
ICA
Application to
CTA Image Segmentation
21
Phase 3: After noise pruning
using Gaussian Filter .
Segmentation of overlapping arteries
and soft tissues in 3d MRI image of brain
ACA
Bassilary
ICA
ICA
Application to
CTA Image Segmentation
22
Phase 4: After noise pruning
based on Connectivity of voxels.

Segmentation of overlapping arteries
and soft tissues in 3d MRI image of brain
ACA
Bassilary
ICA
ICA
Application to
CTA Image Segmentation
23
Subsequent Result
Detailed discussion in the next lecture
Segmentation of overlapping arteries
and soft tissues in 3d MRI image of brain
ACA
Bassilary
ICA
ICA
Application to
CTA Image Segmentation
24
Reverse Distance Transform(RDT)
Unlike DT (or FDT), RDT(or its fuzzy counterpart RFDT) of a point is the minimum
distance from the core or Skeletal point (S),
i.e. RDT(x) = min{ d(x , y)|x () & y S }, where d is a distance metric.

Binary 2d image
Object Point
Background Point
25
Reverse Distance Transform(RDT)
Unlike DT (or FDT), RDT(or its fuzzy counterpart RFDT) of a point is the minimum
distance from the core or Skeletal point (S),
i.e. RDT(x) = min{ d(x , y)|x () & y S }, where d is a distance metric.

RDT values represented in Grayscale
RDT of the 2d image 26
Reverse Distance Transform(RDT)
Unlike DT (or FDT), RDT(or its fuzzy counterpart RFDT) of a point is the minimum
distance from the core or Skeletal point (S),
i.e. RDT(x) = min{ d(x , y)|x () & y S }, where d is a distance metric.

RDT of the 2d image
2
1
3
5

9
10
0
Squared RDT values +1
6
27
Reverse Distance Transform(RDT)
A synthetic 3d phantom
28
Reverse Distance Transform(RDT)
RDT of the 3d phantom
29
Rectangle Block Corresponding FDT map
Application of FDT/RFDT in Object
Localization
Key Observation: High FDT value towards the center of the object
30
Image
Binary Image
FDT image
Text localization using FDT
31
Image
FDT image
Binary Image
Text localization using FDT
32
Allele detection from segmented confocal
microscopic images of cell nuclei
Initially
Image has too many noise
Element borders are not crisp
Disparity in no of allele

Ideally
It should have 4 type of voxel-
Black background, Red and Green allele and Blue nucleus
No overlapping between elements
It should have 2 red allele and 2 green allele

Initial image (z-stack animation)
33
Intensity based labelling
Voxels with
1. higher red intensity => R (red allele)
2. higher green intensity => G (green allele)
3. higher blue intensity => B (blue nucleus)
4. low intensity => BL (black background)
5. everything else is unwanted noise
I. higher red and blue intensity => RB
II. higher red and green intensity => RG
III. higher green and blue intensity => GB
IV. higher red, green and blue intensity => RGB

Post labelling 3D snap
34
Density based noise filtration
Apply on noise voxels only
Derive possible labels of a noise voxel
E.g.- RB {R || B}
Calculate density of various labelled
voxel among neighbours
Map noise point to most probable
possible label


Post filtration 3D snap
35
Allele detection
Use single-linkage hierarchical clustering
to detect the allele clusters
Single-linkage: min {d(a, b) : aA, bB}
Keep largest four (2+ 2) clusters only
Measure various allele properties
Eg- center position, size, distance to
background etc.
Mark center voxel as different label


3D snap of alleles with marked center
36
Distance calculation using DT
Apply Distance Transformation (DT) to
every voxel inside nucleus
Distance Transformation (DT):
distance to nearest background (BL) voxel
For border voxels, distance to nearest
background is 0
For other voxels, search in connected 26
neighbour to get the nearest background voxel

Various allele properties of a image
# Allele type CX CY CZ Size Distance to
Background
1 Red 24 94 13 204 5.477226
2 Red 110 47 14 226 9.055385
3 Green 115 46 4 160 4
4 Green 31 56 6 172 3
37
Conclusion
FDT and RFDT plays a key role in digital image analysis
Elegant solutions to many challenging problems:
Multi-scale opening of conjoined objects in shared intensity space
Applications to cerebrovascular segmentation in Cerebral CTA
Applications to Artery/Vein segmentation in Pulmonary CT
And many more

38
Acknowledgments
o Prof. Punam K Saha, Dept. of ECE, Univ. of Iowa, USA
o Dr. Dariusz Plewzcynski, ICM, University of Warsaw, Poland
o Dr. Jakub Wlodarc, Nencki Institute of Experimental Biology, Poland
o Prof. Eric Hoffman, Dept. of Radiology, Univ. of Iowa
o Prof. M. L. Raghavan, Dept. of BME, Univ. of Iowa
o Dr. Robert E. Harbaugh, Penn State Hershey Medical Center
Students
Azharuddin Mollah, Shauvik Paul, Ayan Paul, Pranati Rakshit and many others.
My visit to the Structural Imaging Laboratory, Univ. of Iowa, USA, was funded by the BOYSCAST
fellowship (SR/BY/E-15/09), Dept. of Science and Technology, Govt. of INDIA.
This study is supported in part by the FASTTRACK grant (SR/FTP/ETA-04/2012) by DST, Govt. of India.





39
Thank you

You might also like