31
Theoretical Foundations of Tracking Monotonically Advancing Fronts Using Fast Marching Level Set Method By Aly A. Farag and M. Sabry Hassouna Technical Report Computer Vision and Image Processing Laboratory Department of Electrical and Computer Engineering University of Louisville Louisville, Kentucky February 2005

Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

Theoretical Foundations of Tracking Monotonically Advancing FrontsUsing Fast Marching Level Set Method

By

Aly A. Farag and M. Sabry Hassouna

Technical Report

Computer Vision and Image Processing LaboratoryDepartment of Electrical and Computer Engineering

University of LouisvilleLouisville, Kentucky

February 2005

Page 2: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

TABLE OF CONTENTS

TABLE OF CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiLIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiiLIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ivCHAPTER

A. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1B. Problem Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 1C. Formulation of Level Set Method . . . . . . . . . . . . . . . . . . . . 1D. Formulation of Level Set Fast Marching Method . . . . . . . . . . . . 3E. Intrinsic Properties of The Front . . . . . . . . . . . . . . . . . . . . . 5F. Advantages of Level Set and Fast Marching Methods . . . . . . . . . . 5G. Hamilton-Jacobi Equations . . . . . . . . . . . . . . . . . . . . . . . . 6H. Implementation of Level Set Fast Marching Method (FMM) . . . . . . 8I. The Update Procedure for the Fast Marching Method . . . . . . . . . . 13J. Efficient Maintenance of Narrow Band . . . . . . . . . . . . . . . . . 14

K. Efficient Data Structure For Fast Marching Methods . . . . . . . . . . 14L. The High Accuracy Fast Marching Method (HAFMM) . . . . . . . . . 15M. Accuracy of HAFMM over FMM . . . . . . . . . . . . . . . . . . . . 18N. Distance Field Computation . . . . . . . . . . . . . . . . . . . . . . . 19

1. Distance From Boundary (DFB) . . . . . . . . . . . . . . . . . . 202. Distance From Source Point (DFS) . . . . . . . . . . . . . . . . 20

O. Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

ii

Page 3: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

LIST OF TABLES

TABLE . PAGE1. Problem formulation for tracking a propagating front under different speed

conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52. Error in computing the arrival time T of the first experiment using both the

FMM and HAFMM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183. Error in computing the arrival time T of the second experiment using both

the FMM and HAFMM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

iii

Page 4: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

LIST OF FIGURES

FIGURE . PAGE1. Transformation of front motion into initial value problem. . . . . . . . . . . 22. Transformation of front motion into boundary value problem. . . . . . . . . 43. The level set surface φ in dark gray (a) two separate initial fronts (light gray)

(b) later in time, the topology changes yielding a single front as the zero levelset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

4. (a) A propagating front with a constant speed F = 1.0 forms shocks (b) Noshocks with vanishing viscosity solution F = limε→0(1 − ε∇2u). . . . . . . 7

5. Computing the arrival time Ti,j,k given the neighbors using FMM. . . . . . . 86. (a) Find the nearest neighbors of the origin (b) Compute the arrival time of

the neighbors (c) Find the point of minimum arrival time A (d) Freeze Aand compute the arrival time of its neighbors (e) Find the point of minimumarrival time D (f) Freeze D and compute the arrival time of its neighbors. . . 12

7. Construction of narrow band in FMM. . . . . . . . . . . . . . . . . . . . . . 138. Our proposed data structure to achieve efficient implementing of the fast

marching methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159. Computing the arrival time Ti,j,k given the neighbors using HAFMM. . . . . 1610. (a) Iso-contours of a propagating front from a single point. (b) Iso-contours

of two propagating fronts from two points. . . . . . . . . . . . . . . . . . . 1911. Euclidean distance of 2D shapes (a,c,e) Iso-contours visualization (b,d,f)

Rainbow visualization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2112. Iso-surfaces of the Euclidean distance of 3D objects. . . . . . . . . . . . . . 2213. Iso-contours of the DFS field (a,c,e)F (x) = 1.0 (b,d,f) F (x) = eα·DFB(x) . . 2414. Iso-surfaces of the DFS field of 3D objects using F (x) = eα·DFB(x). . . . . . 25

iv

Page 5: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

A. Introduction

Level set methods have been developed by Osher and Sethian [1] as efficient compu-

tational numerical algorithms for solving a particular class of partial differential equations

(PDEs). The underlying PDE is a hyperbolic with first order time derivatives often called

a Hamilton-Jacobi (HJ). Level set methods have shown great success in recent years for

tracking and modeling the motion of dynamic surfaces in many fields including computer

graphics, medical imaging, computational fluid dynamics, image processing, and many

others. In level set methods, the boundary or interface Γ of the object is represented im-

plicitly through a level set function φ(x). The interface itself is the zero level set of the

level set function Γ = {x ∈ Rd|φ(x) = 0}. The interface can move backward, forward, or

restricted to one direction only.

In this technical report, we are interested in tracking interfaces whose motion is

either monotonically increasing or decreasing.

B. Problem Formulation

Consider a closed interface Γ (e.g., boundary) that separates one region from an-

other. Γ can be a curve in 2D or a surface in 3D. Assume that Γ moves in its normal

direction with a known speed F . The goal is to track the motion of the interface Γ as it

evolves over time in one direction.

C. Formulation of Level Set Method

Consider a front Γ that moves in its normal direction with a speed F that is neither

strictly positive nor negative. The front can move forward and backward, and hence can

pass over a point p(x, y) several times. Level set methods embed the initial position of

the front Γ as the zero level set of a higher-dimensional function φ. The propagation of

1

Page 6: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a)

FIGURE 1 – Transformation of front motion into initial value problem.

the front is then linked to the evolution of φ through a time dependent initial value partial

differential equation (PDE). At any time, the position of the front can be determined by

finding the zero level set of the level set function Φ as shown in Figure 1.

Now, let’s derive the equation of motion of the level set function φ. Consider a

particle on the front with a path x(t). The level set value of that particle must be always

zero Eq. (1).

φ(x(t), t) = 0 (1)

By the chain rule,

dφ(x(t), t)

dt=

∂φ(x(t), t)

∂t+

∂φ(x(t), t)

∂x· ∂x(t)

∂t= 0 (2)

φt(x(t), t) + ∇φ(x(t), t) · x́(t) = 0 (3)

2

Page 7: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

Since the front is moving in its normal direction, then F is given by Eq. (4).

F = x́(t) · �n (4)

Where �n is the normal vector to the front. Also, since the gradient of a level set function φ

is its normal vector �n, then

�n =∇φ(x(t), t)

|∇φ(x(t), t)| (5)

From Eq. (4) and (5),

F |∇φ(x(t), t)| = ∇φ(x(t), t) · x́(t) (6)

By substituting Eq. (6) into Eq. (3),

φt(x(t), t) + F |∇φ(x(t), t)| = 0 (7)

Γ0 = φ(x(t), t = 0)

Where, Γ0 is the initial position of the front. For better readability, Eq. (7) can be rewritten

as,

φt + F |∇φ| = 0 (8)

Γ0 = φ(x, t = 0)

This is the level set equation as given by Osher and Sethian [1].

D. Formulation of Level Set Fast Marching Method

Now consider the special case of a front Γ that moves only in one direction with a

speed F and hence, have a monotonically increasing or decreasing propagation according

to the sign of the speed F . In order to track the position of the front, we compute the arrival

time T (x, y) of Γ as it crosses each point p(x, y). Now, let’s derive the equation of motion

of this special front.

3

Page 8: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a)

FIGURE 2 – Transformation of front motion into boundary value problem.

Let’s first consider the one dimension case, where distance = speed ∗ time, which

can be expressed as

F =dx

dT(9)

Then,

1 = FdT

dx(10)

In multiple dimensions, the equation of motion is given by,

|∇T |F = 1.0 (11)

T (Γ0) = 0

Where, the arrival time of the initial position of the front is set to zero. It is obvious that

the front motion is characterized as the solution to a boundary value problem. If the speed

depends only on the position x, then the equation reduces to what is known as Eikonal

equation. For example, for a circular front propagating with unity speed F = 1.0, the

arrival time T (x, y) is shown in Figure 2.

In Table 1, we compare the problem formulation for tracking the position of a prop-

agating front Γ under different speed conditions.

4

Page 9: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

TABLE 1PROBLEM FORMULATION FOR TRACKING A PROPAGATING FRONT UNDER

DIFFERENT SPEED CONDITIONS.

Boundary Value Formulation Initial Value Formulation

|∇T |F = 1.0 φt + F |∇φ| = 0

Γ(t) = {(x, y)|T (x, y) = t} Γ(t) = {(x, y)|φ(x, y, t) = 0}Requires F > 0 Arbitrary F

E. Intrinsic Properties of The Front

The intrinsic properties of the front are easily determined in both formulation as

follows: since the gradient of a level set function is its normal vector, then at any point of

the front, the normal vector is given by,

�n =∇φ

|∇φ| or �n =∇T

|∇T | (12)

Also, the curvature of the front at any point is the divergence of the normal vector to the

front.

κ = ∇ · ∇φ

|∇φ| or κ = ∇ · ∇T

|∇T | (13)

F. Advantages of Level Set and Fast Marching Methods

1. Applicable in higher dimensions.

2. Automatically handle the topological changes of the propagating front such as break

and merge as shown in Figure 3.

3. They solve the associated PDE’s using the viscosity solution [2] (e.g., entropy con-

dition) to guarantee that the unique weak solution (physically correct) is to be found.

5

Page 10: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

FIGURE 3 – The level set surface φ in dark gray (a) two separate initial fronts (light gray)(b) later in time, the topology changes yielding a single front as the zero level set.

4. They use efficient numerical schemes to solve the associated PDE’s.

5. Intrinsic (local) geometric properties are easily determined such as normal vector �n

and curvature κ.

6. They use efficient implementation techniques.

G. Hamilton-Jacobi Equations

Both the initial and boundary value problems can be described by a general PDE

known as Hamilton Jacobi Equation (HJ).

αut + H(Du, x) = 0 (14)

Du represents the partials of u in each variable. For example, in 3D, it is ux, uy, and uz.

For Level set formulation, α = 1.0 and H = F |∇u|. On the other hand, for fast marching

formulation, α = 0.0 and H = F |∇u| − 1.0.

One of the main difficulties in solving Hamilton Jacobi equation is that the solution

u is not necessarily to be differentiable. Even if the initial front Γ0 is smooth. For example,

it has been shown [3] that for a front propagating at a constant speed, it form corners as

it evolves as shown in Figure 4(a). At those corners, the front (e.g., solution of PDE)

6

Page 11: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

FIGURE 4 – (a) A propagating front with a constant speed F = 1.0 forms shocks (b) Noshocks with vanishing viscosity solution F = limε→0(1 − ε∇2u).

is continuous but no longer differentiable. Therefore, a weak solution must be found to

continue propagation.

• Weak Solution: The solution of a given PDE is called weak solution if it is continu-

ous but its derivatives are not.

Unfortunately, weak solutions are not unique and additional condition is needed to

select the physically correct or vanishing viscosity solution. This additional condition is

referred to as the entropy condition. A viscous term is added to Eq. (15) as follows,

αut + H(Du, x) = ε∇2u (15)

The effect of the viscosity term ε∇2u is to smooth out sharp corners, and hence

ensuring a unique smooth solution. In fact, the viscosity term turns the equation from hy-

perbolic into a parabolic type, for which there always exists a unique smooth solution for

t > 0. The limit of this solution as ε → 0 is knows as the vanishing viscosity solution,

which yield no corners or shocks as shown in Figure 4(b).

In this technical report, I will focus on the implementation details of the level set fast

7

Page 12: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

FIGURE 5 – Computing the arrival time Ti,j,k given the neighbors using FMM.

marching method because I successfully made use of it through my Ph.D study to extract

curve skeletons of 3D objects.

H. Implementation of Level Set Fast Marching Method (FMM)

In this section, we present the implementation details of the fast marching level set

method (FMM). Recall that the Eikonal Equation is given by,

|∇T |F = 1.0 (16)

We need to solve this equation by computing the arrival time T at each point (i, j, k) given

its neighbors as shown in Figure 5.

The discretization of the gradient ∇T , which correctly chooses the physically cor-

rect vanishing viscosity weak solution is given by [1] as,⎛⎜⎜⎜⎜⎝

max(D−xijkT, 0)2 + min(D+x

ijkT, 0)2+

max(D−yijkT, 0)2 + min(D+y

ijkT, 0)2+

max(D−zijkT, 0)2 + min(D+z

ijkT, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(17)

As suggested by Sethian [3], in order to solve this equation, a more easier but less accurate

8

Page 13: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

upwind scheme Eq. (18) has been proposed by [4].⎛⎜⎜⎜⎜⎝

max(D−xijkT,−D+x

ijkT, 0)2+

max(D−yijkT,−D+y

ijkT, 0)2+

max(D−zijkT,−D+z

ijkT, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(18)

The backward finite difference is given by Eq. (19), while the forward finite difference is

given by Eq. (20).

D−xijk =

Ti,j,k − Ti−1,j,k

∆x(19)

D−yijk =

Ti,j,k − Ti,j−1,k

∆y

D−zijk =

Ti,j,k − Ti,j,k−1

∆z

∆x, ∆y, and ∆z are the grid spacing in the x, y, and z directions, respectively.

D+xijk =

Ti+1,j,k − Ti,j,k

∆x(20)

D+yijk =

Ti,j+1,k − Ti,j,k

∆y

D+zijk =

Ti,j,k+1 − Ti,j,k

∆z

By substituting Eq. (19) and (20) into Eq. (18), we get,⎛⎜⎜⎜⎜⎝

max(Ti,j,k−Ti−1,j,k

∆x,

Ti,j,k−Ti+1,j,k

∆x, 0)2+

max(Ti,j,k−Ti,j−1,k

∆y,

Ti,j,k−Ti,j+1,k

∆y, 0)2+

max(Ti,j,k−Ti,j,k−1

∆z,

Ti,j,k−Ti,j,k+1

∆z, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(21)

Which can be rewritten as,⎛⎜⎜⎜⎜⎝

max(Ti,j,k−min(Ti−1,j,k,Ti+1,j,k)

∆x, 0)2+

max(Ti,j,k−min(Ti,j−1,k,Ti,j+1,k)

∆y, 0)2+

max(Ti,j,k−min(Ti,j,k−1,Ti,j,k+1)

∆z, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(22)

9

Page 14: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

Let

T = Ti,j,k (23)

T1 = min(Ti−1,j,k, Ti+1,j,k)

T2 = min(Ti,j−1,k, Ti,j+1,k)

T3 = min(Ti,j,k−1, Ti,j,k+1)

Then,

max

(T − T1

∆x, 0

)2

+ max

(T − T2

∆y, 0

)2

+ max

(T − T3

∆z, 0

)2

=1

F 2ijk

(24)

Several methods has been proposed to solve this equation either iteratively such as

Rouy [4] or in a single pass independently by Tsitsiklis [5], Sethina [6], and Helmsen [7].

Tsitsiklis has developed a control theory approach to solve the Eikonal equation that

is also a viscosity solution. This leads to a causality relationship based on the optimality

criterion rather than on the upwind finite difference operators employed in Fast Marching

Methods. The complexity of Tsitsiklis’s algorithm is the same as FMM. However, FMM

is more general in higher dimensions. The idea behind FMM is to introduce an order

in the selection of the grid points, in a way similar to the Dijkstra algorithm [8]. This

order is based on a causality criteria, where the arrival time T at any point depends only

on the neighbors that have smaller values. Therefore, the FMM rely on propagating the

information in one direction from smaller values of T to larger ones.

The algorithm works as follows. The front constructs a thin zone or a narrow band

of candidate points. The zone is allowed to move forward by freezing its points whose

values can not be altered, while acquiring new candidate points, whose values may be

altered latter. Let’s illustrate the idea behind FMM using a simple example. Consider

the 2D example as shown in Figure 6(a), where the front will propagate from the origin.

The origin is tagged (frozen) and is represented by a black sphere. The light gray spheres

represent the points whose solution is not yet known (unknown). By solving Eq.(24) at the

10

Page 15: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

nearest neighbors of the origin as shown in Figure 6(b), we get a possible solution values

for those points (trial), represented by dark gray spheres. Such points are inserted into a

thin zone, known as a narrow band. Now, the front moves forward from one of the dark

gray spheres as follows: select the point of minimum T from the narrow band, which is A

then mark it as a frozen point as shown in Figure 6(c). Find the neighbors of A as shown in

Figure 6(d), then repeat as shown in the rest of the figures. Therefore, the key idea of FMM

is that the computed arrival time of a point must be greater than or equal to the arrival time

of any frozen point. In Figure 7, we illustrate the progress of the FMM and the formation

of the narrow band.

According to FMM, T in Eq. (24) must be greater than or equal to T1, T2, and T3.

Then, Eq. (24) can be rewritten as,

(T − T1

∆x

)2

+

(T − T2

∆y

)2

+

(T − T3

∆z

)2

=1

F 2ijk

(25)

Which can be simplified to a second order equation of the form,

aT 2 + bT + c = 0 (26)

where the coefficient are given by,

a =

(1

∆2x+

1

∆2y+

1

∆2z

)(27)

b = −2

(T1

∆2x+

T2

∆2y+

T3

∆2z

)

c =

(T 2

1

∆2x+

T 22

∆2y+

T 23

∆2z

)− 1

F 2ijk

If the equation has two solutions, we pick the largest one because it satisfies the FMM

rules. The values of T1, T2, and T3 must be frozen. If any of those values is not frozen, it is

replaced by zero in Eq. (25).

11

Page 16: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

(c) (d)

(e) (f)

FIGURE 6 – (a) Find the nearest neighbors of the origin (b) Compute the arrival time ofthe neighbors (c) Find the point of minimum arrival time A (d) Freeze A and compute thearrival time of its neighbors (e) Find the point of minimum arrival time D (f) Freeze D andcompute the arrival time of its neighbors.

12

Page 17: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

FIGURE 7 – Construction of narrow band in FMM.

I. The Update Procedure for the Fast Marching Method

The update procedure for the FMM can be summarized as follows:

1. Tag all the boundary points as frozen.

2. Find the nearest neighbors of the frozen points.

3. Solve the Eikonal equation using Eq. (24) at those neighbor points, tag them as trial,

and finally, push them into the narrow band.

4. LOOP: Pick the trial point A with the smallest arrival time from the narrow band.

5. Remove A from the narrow band and tag it as frozen.

6. Find the neighbors of A that are unknown.

7. Solve the Eikonal equation at the neighbors of A using Eq. (24), tag them as trial,

and finally, move them to the narrow band.

8. Go back to LOOP.

13

Page 18: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

J. Efficient Maintenance of Narrow Band

The FMM involves two Narrow band operations that can seriously affect the com-

putational efficiency of the method unless they are implemented correctly. Those opera-

tions are:

1. Searching the narrow band for the grid point p of minimum arrival time T .

2. Find the grid neighbors of p.

In [6], Sethian suggested to implement the narrow band using a min-heap data

structure, which is a binary tree with the property that the value at any given node is less

than or equal to the values at its children. Therefore, the root of the tree always contains

the smallest element of the narrow band. Also, whenever a new point is inserted into the

heap, the data structure takes care of resorting the tree to maintain the root as the smallest

element.

The value of T and the indices of a grid point are stored in the min-heap such that

we can locate the neighbors of a given narrow band point in O(1) time.

For a min-heap of size M elements, the worst case computational complexity is

given by O(logM). Therefore, the FMM has a computational cost of NO(logN) for N

grid points.

We have implemented the min-heap data structure using the Multimap data structure

that is part of the standard template library (STL).

K. Efficient Data Structure For Fast Marching Methods

In Figure 8, we show our proposed data structure to achieve efficient implementa-

tion of the fast marching methods. Each voxel of the object is represented by an object

oriented voxel class. The class contains several attributes of the voxel such as its coordi-

nates, arrival time, and others. All the voxels of the object are stored in a dynamic array.

14

Page 19: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a)

FIGURE 8 – Our proposed data structure to achieve efficient implementing of the fastmarching methods

Each entry of the min-heap has two values. The first value is the minimum arrival time T ,

while the second value is the id of the corresponding voxel in the dynamic array. The id

helps in accessing the associated voxel data, and hence fast localization of its neighbors.

Each voxel has a pointer pHeap that points to a heap location. If a voxel is contained in the

min-heap, then pHeap is set to the address of that heap location, otherwise, it is set to null.

This helps in fast localization of a given voxel in the heap, and hence a fast heap update.

L. The High Accuracy Fast Marching Method (HAFMM)

15

Page 20: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

FIGURE 9 – Computing the arrival time Ti,j,k given the neighbors using HAFMM.

The FMM approximates the gradient ∇T by first order finite difference. The high

accuracy fast marching method (HAFMM) uses second-order approximation of the gradi-

ent whenever points are available, but reverts to a first-order approximation in the other

cases.

The second order backward finite difference is given by,

D−xijk =

3Ti,j,k − 4Ti−1,j,k + Ti−2,j,k

2∆x(28)

D−yijk =

3Ti,j,k − 4Ti,j−1,k + Ti,j−2,k

2∆y

D−zijk =

3Ti,j,k − 4Ti,j,k−1 + Ti,j,k−2

2∆z

While, the second order forward finite difference is given by,

D+xijk = −3Ti,j,k − 4Ti+1,j,k + Ti+2,j,k

2∆x(29)

D+yijk = −3Ti,j,k − 4Ti,j+1,k + Ti,j+2,k

2∆y

D+zijk = −3Ti,j,k − 4Ti,j,k+1 + Ti,j,k+2

2∆z

Assume that we need to compute the arrival time at the point (i, j, k) given its

neighbors as shown in Figure 9 using HAFMM.

By substituting Eq. (28) and (29) into Eq. (18), we get,

16

Page 21: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

⎛⎜⎜⎜⎜⎝

max(3Ti,j,k−4Ti−1,j,k+Ti−2,j,k

2∆x,

3Ti,j,k−4Ti+1,j,k+Ti+2,j,k

2∆x, 0)2+

max(3Ti,j,k−4Ti,j−1,k+Ti,j−2,k

2∆y,

3Ti,j,k−4Ti,j+1,k+Ti,j+2,k

2∆y, 0)2+

max(3Ti,j,k−4Ti,j,k−1+Ti,j,k−2

2∆z,

3Ti,j,k−4Ti,j,k+1+Ti,j,k+2

2∆z, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(30)

Which can be rewritten as,

⎛⎜⎜⎜⎜⎝

max(Ti,j,k−min(4Ti−1,j,k−Ti−2,j,k,4Ti+1,j,k−Ti+2,j,k)

∆x, 0)2+

max(Ti,j,k−min(4Ti,j−1,k−Ti,j−2,k,4Ti,j+1,k−Ti,j+2,k)

∆y, 0)2+

max(Ti,j,k−min(4Ti,j,k−1−Ti,j,k−2,4Ti,j,k+1−Ti,j,k+2)

∆z, 0)2

⎞⎟⎟⎟⎟⎠ =

1

F 2ijk

(31)

Let

T = Ti,j,k (32)

T1 = min(4Ti−1,j,k − Ti−2,j,k, 4Ti+1,j,k − Ti+2,j,k)

T2 = min(4Ti,j−1,k − Ti,j−2,k, 4Ti,j+1,k − Ti,j+2,k)

T3 = min(4Ti,j,k−1 − Ti,j,k−2, 4Ti,j,k+1 − Ti,j,k+2)

Then,

max

(3T − T1

2∆x, 0

)2

+ max

(3T − T2

2∆y, 0

)2

+ max

(3T − T3

2∆z, 0

)2

=1

F 2ijk

(33)

Again, since HAFMM guarantees that T is greater than its frozen neighbors, then,(3T − T1

2∆x

)2

+

(3T − T2

2∆y

)2

+

(3T − T3

2∆z

)2

=1

F 2ijk

(34)

Which can be simplified to a second order equation of the form,

aT 2 + bT + c = 0 (35)

where the coefficient are given by,

a =+9

4

(1

∆2x+

1

∆2y+

1

∆2z

)(36)

b =−3

2

(T1

∆2x+

T2

∆2y+

T3

∆2z

)

c =+1

4

(T 2

1

∆2x+

T 22

∆2y+

T 23

∆2z

)− 1

F 2ijk

17

Page 22: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

TABLE 2ERROR IN COMPUTING THE ARRIVAL TIME T OF THE FIRST EXPERIMENT

USING BOTH THE FMM AND HAFMM.

Grid Error Using FMM Error Using HAFMM

213 0.01979 0.0072

513 0.0094 0.0024

1013 0.0046 0.00046

1513 0.002289 0.00007

The HAFMM method asserts two conditions to use the second-order approximation

of the gradient, otherwise, it reverts to the first-order approximation.

1. The points that are 2 points away from (i, j, k) in each direction are frozen. For

example, in the x-direction, T (i − 2, j, k) and T (i + 2, j, k) must be frozen.

2. The points that are are 2 points away from (i, j, k) in each direction must have less

travel time than those points at one point away from (i, j, k). For example, in the

x-direction, T (i − 2, j, k) ≤ T (i − 1, j, k) and T (i + 2, j, k) ≤ T (i + 1, j, k).

M. Accuracy of HAFMM over FMM

In this section, we compare the accuracy of the HAFMM against FMM by replicat-

ing the two experiments presented in [9]. In the first experiment, we propagate a front with

a unit speed from a single point located at the origin. The iso-contours of the exact solu-

tion, FMM, and HAFMM are drawn with solid, short dash-dot, and long dash, respectively

as shown in Figure 10(a). In Table 2, we compute the error between each method and the

exact Euclidean distance over different grid sizes.

In the second experiment, we propagate two fronts with a unit speed from two points

18

Page 23: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

FIGURE 10 – (a) Iso-contours of a propagating front from a single point. (b) Iso-contoursof two propagating fronts from two points.

located at (0.5, 0.25) and (0.5, 0.75) as shown in Figure 10(b). In Table 3, we compute the

error between each method and the exact Euclidean distance over different grid sizes.

It is obvious from the two experiments that the HAFMM is more accurate than the

FMM.

N. Distance Field Computation

One of the great applications of the FMM is the distance field computation. Dis-

tance fields are used extensively in computer graphics, medical imaging, computer vision,

and other fields. If the front evolves at a unit speed, the arrival time corresponds to the

Euclidean distance. The FMM can be used to compute two kinds of distance fields:

• Distance From Boundary (DFB).

• Distance From Source Point (DFS).

19

Page 24: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

TABLE 3ERROR IN COMPUTING THE ARRIVAL TIME T OF THE SECOND EXPERIMENT

USING BOTH THE FMM AND HAFMM.

Grid Error Using FMM Error Using HAFMM

213 0.0096 0.005

513 0.0051 0.00119

1013 0.0028 0.00028

1513 0.0014 0.00006

1. Distance From Boundary (DFB)

DFB field computes at each point its minimum distance to the object boundary. The

initial boundary of the object is initialized to zero travel time; T = 0. Then, the front

propagates from the boundary and moves inward towards the center of the object. The

computation of the Euclidean distance for 2D shapes and 3D objects using the HAFMM

are visualized in Figure 11 and Figure 12, respectively. In Figure 11, we show the iso-

contours, while in Figure 12, we show the iso-surfaces.

2. Distance From Source Point (DFS)

DFS field computes at each point its minimum distance from a known source point.

The source point is initialized to zero travel time; T = 0. Then, the front propagates from

the source point and moves outward towards the boundary of the object. We have chosen

our reference point as the point of maximum DFB. In Figure 13(a,c,e), we show the DFS

field that has been computed from a front that propagates with a speed F (x) = 1, which

leads to the Euclidean distance field. On the other hand, in Figure 13(b,d,f), we show

another DFS field, but with F (x) = eα·DFB(x), where α = 15. In Figure 14, we show the

20

Page 25: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

(c) (d)

(e) (f)

FIGURE 11 – Euclidean distance of 2D shapes (a,c,e) Iso-contours visualization (b,d,f)Rainbow visualization.

21

Page 26: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a)

(b)

(c)

FIGURE 12 – Iso-surfaces of the Euclidean distance of 3D objects.

22

Page 27: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

iso-surfaces of DFS field of 3D objects under the same speed model. Notice how sharp the

iso-contours or iso-surfaces at the medial points of the shapes or objects, respectively.

In my Ph.D thesis, I made use of an enhanced version of that speed model to extract

efficiently the centerlines of 2D shapes and the curve skeletons of 3D objects.

O. Conclusion

In this technical report, we have presented the theoretical foundations of tracking

monotonically advancing fronts using fast marching level set methods, which include the

fast marching method (FMM) and the high accuracy fast marching method (HAFMM). We

have also explained all the necessary details to implement them.

Interested readers in using level set methods for their applications are encouraged

to read the well written text books [3] and [10]. Both books discuss the basic concepts of

level set methods in different but complementary ways and then proceed to cover a variety

of applications. In our opinion, the first book is much easier to read than the other. Finally,

a very good open source MATLAB toolbox for Level Set Methods has been developed by

Mitchell [11].

23

Page 28: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a) (b)

(c) (d)

(e) (f)

FIGURE 13 – Iso-contours of the DFS field (a,c,e)F (x) = 1.0 (b,d,f) F (x) = eα·DFB(x)

24

Page 29: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

(a)

(b)

(c)

FIGURE 14 – Iso-surfaces of the DFS field of 3D objects using F (x) = eα·DFB(x).

25

Page 30: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

REFERENCES

[1] S. Osher and J. Sethian. Fronts propagating with curvature speed: algorithms based on

Hamilton-Jacobi formulations. Journal of Computational Physics, 79:12–49, 1988.

[2] M. G. Crandall and P. L. Lions. Viscosity solutions of hamilton-jacobi equations.

Trans. Amer. Math. Soc, 277:1–42, 1983.

[3] J. Sethian. Level Sets Methods and Fast Marching Methods. Cambridge University

Press, 2nd edition, 1999.

[4] Elisabeth Rouy and A. Tourin. A viscosity solutions approach to shape-from-shading.

SIAM J. Numer. Anal., 29(3):867–884, 1992.

[5] J. Tsitsiklis. Efficient algorithms for globally optimal trajectories. IEEE Trans. on

Automatic Control, 40(9):1528–1538, 1995.

[6] D. Adalsteinsson and J. Sethian. A fast level set method for propagating interfaces.

Journal of Computational Physics, 118:269–277, 1995.

[7] J. J. Helmsen, E. G. Puckett, P. Colella, and M. Dorr. Two new methods for simulating

photolithography development in 3D. In Proc. SPIE Vol. 2726, p. 253-261, Optical

Microlithography IX, Gene E. Fuller; Ed., pages 253–261, June 1996.

[8] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische

Mathematik, 1:269–271, 1959.

[9] J.A. Sethian. Fast marching methods. SIAM Review, 41(2):199–235, 1999.

26

Page 31: Theoretical Foundations of Tracking Monotonically Advancing … · 2019. 8. 19. · graphics, medical imaging, computational fluid dynamics, image processing, and many others. In

[10] S. Osher and R. Fedkiw. Level Set Methods and Dynamic Implicit Surfaces. Springer-

Verlag, 2002.

[11] Ian M. Mitchell. http://www.cs.ubc.ca/ mitchell/ToolboxLS/index.html. 2005.

27