50
Level Sets Methods in Imaging Science Dr. Corina S. Drapaca [email protected] Pennsylvania State University University Park, PA 16802, USA Level Sets Methods in Imaging Science – p.1/36

Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Level Sets Methods in Imaging Science

Dr. Corina S. Drapaca

[email protected]

Pennsylvania State University

University Park, PA 16802, USA

Level Sets Methods in Imaging Science – p.1/36

Page 2: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Textbooks

• S.Osher, R.Fedkiw, Level Set Methods and Dynamic ImplicitSurfaces, Applied Mathematical Sciences vol. 153, 2003.

• J.A.Sethian, Level Set Methods and Fast Marching Methods:evolving interfaces in computational geometry, fluid mechanics,computer vision, and materials science, Cambridge UniversityPress, 2nd edition, 1999.

• Handbook of Mathematical Models in Computer Vision, edited byN.Paragios, Y.Chen, O.Faugeras, Springer, 2006.

• Geometric Level Set Methods in Imaging, Vision, and Graphics,edited by S.Osher, N.Paragios, Springer, 2003.

Level Sets Methods in Imaging Science – p.2/36

Page 3: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionLevel Set Methods

• Originally introduced by S.Osher, J.A.Sethian, Journal ofComputational Physics 79, pg.12-49, 1988.

• Extensively used in• computer vision• CAD (computer-aided design)• optimal design and control• computational geometry• computational fluid mechanics• computational physics (two-phase flows, shocks, solid-fluid

coupling, epitaxial growth, etc.)• image processing (restoration, segmentation, registration,

deblurring/denoising, reconstruction of surfaces fromunorganized data points, etc.)

• ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book)

• useful in analyzing and computing the motion of an interfacebounding a (multiply connected) open region under a givenvelocity field.

Level Sets Methods in Imaging Science – p.3/36

Page 4: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionImplicit FunctionsIn R

n:• (Sub) domains are n-dimensional.• Interface: the border between two subdomains (or between the

inside and outside of a domain).• Interfaces have dimension n− 1 and codimension 1.• Interface representations:

• explicit: list of all the interface points using a parametrization ofthe interface.

• implicit: the isocontour of a (implicit) functionφ(~x) = C, ∀~x = (x1, ..., xn) ∈ R

n, C=const.For simplicity, C = 0.

• We will consider only the case of simple closed interfaces.

A simple (left) and a non-simple (right) closed interface.

Level Sets Methods in Imaging Science – p.4/36

Page 5: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionImplicit Functions

• Examples:

Implicit function φ(x) = x2 − 1 in R defining the inside region Ω− = (−1, 1) and the outside regionΩ+ = (−∞, −1) ∪ (1, +∞) as well as the boundary (interface) ∂Ω = −1, 1 (left).

Implicit function φ(x, y) = x2 + y2 − 1 in R2 defining the inside region (unit open disk)

Ω− = (x, y) ∈ R2|x2 + y2 < 1, the outside region Ω+ = (x, y) ∈ R

2|x2 + y2 > 1 and the interface

(unit circle) ∂Ω = (x, y) ∈ R2|x2 + y2 = 1 (right).

Level Sets Methods in Imaging Science – p.5/36

Page 6: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionImplicit Functions

• The explicit representations of the two interfaces in our examplesare:• in R: a list of points −1, 1 (dimension 0)• in R

2: one possible paramaterization of the unit circle is:

x = cos s, y = sin s, 0 ≤ s ≤ 2π

• We assume that the interfaces’ parametrizations are such that theinterior regions are on the left side as the parameters increase.

• The connectivity (ordering) of the points of an interface containsimportant information about the topology (shape) of the interface.

• In addition, a moving interface can change its topology and henceits connectivity.

• Active contour: name used in the image processing literature for amoving (dynamic) interface.

Level Sets Methods in Imaging Science – p.6/36

Page 7: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionLimitations of the explicit representation of an interface:

• it is hard to parametrize arbitrary curves in R2 and hyper-surfaces

in Rn, n ≥ 3.

• the connectivity of hyper-surfaces in Rn, n ≥ 3 is very difficult to

represent; hence explicit interfaces cannot handle easily interfaceswith holes and topological changes.

Advantages of implicit interfaces:

• Going from R2 to R

n, n ≥ 3 is straightforward:• For example, the zero isocontour of the implicit functionφ(x, y, z) = x2 + y2 + z2 − 1 is the implicit representation of theunit sphere, the interface between the inside open unit ballΩ− = (x, y, z) ∈ R

3|φ(x, y, z) < 0 and its exterior open regionΩ+.

• Topological changes and discontinuous interfaces are handlednaturally, there are no problems with the connectivity of implicitinterfaces.

• Implicit functions make Boolean operations, geometry and calculusoperations easy to apply and use.

Level Sets Methods in Imaging Science – p.7/36

Page 8: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionBoolean operations: If φ1 and φ2 are two implicit functions, then theimplicit representation of:

• the union of the interior regions of φ1 and φ2 is φ = min(φ1, φ2).• the intersectionof the interior regions of φ1 and φ2 isφ = max(φ1, φ2).

• the complement of the interior region of φ1 is φ = −φ1.

Level Sets Methods in Imaging Science – p.8/36

Page 9: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionBoolean operations: If φ1 and φ2 are two implicit functions, then theimplicit representation of:

• the union of the interior regions of φ1 and φ2 is φ = min(φ1, φ2).• the intersectionof the interior regions of φ1 and φ2 isφ = max(φ1, φ2).

• the complement of the interior region of φ1 is φ = −φ1.

Geometry: If φ is a smooth enough implicit function then:• gradient of the interface:

∇φ(~x) =

(

∂φ

∂x1,∂φ

∂x2, ..,

∂φ

∂xn

)

, ~x = (x1, x2, .., xn) ∈ Rn

• unit outward normal to the interface: ~N =∇φ

|∇φ|

• mean curvature of the interface: κ = ∇ · ~N = ∇ ·

(

∇φ

|∇φ|

)

Level Sets Methods in Imaging Science – p.8/36

Page 10: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionBoolean operations: If φ1 and φ2 are two implicit functions, then theimplicit representation of:

• the union of the interior regions of φ1 and φ2 is φ = min(φ1, φ2).• the intersectionof the interior regions of φ1 and φ2 isφ = max(φ1, φ2).

• the complement of the interior region of φ1 is φ = −φ1.

Geometry:

Convex regions have κ > 0, and concave regions have κ < 0.

Level Sets Methods in Imaging Science – p.8/36

Page 11: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionCalculus operations:

• Characteristic functions χ− and χ+ of the interior region Ω− and,respectively, exterior region Ω+ are:

χ−(~x) =

1, if φ(~x) ≤ 0 (i.e. ~x ∈ Ω−)

0, if φ(~x) > 0

and

χ+(~x) =

0, if φ(~x) ≤ 0

1, if φ(~x) > 0 (i.e. ~x ∈ Ω+)

• Since χ± are functions of a multidimensional variable ~x, it is easierto replace these characteristic functions with the one-dimensionalHeaviside function

H(φ) =

0, if φ ≤ 0

1, if φ > 0

Level Sets Methods in Imaging Science – p.9/36

Page 12: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionCalculus operations:

• Volume (area, length) integrals of a function f are:∫

Rn

f(~x)χ−(~x)d~x =

Rn

f(~x)(1 −H(φ(~x)))d~x,

and∫

Rn

f(~x)χ+(~x)d~x =

Rn

f(~x)H(φ(~x))d~x,

representing the integrals of f over Ω− and, respectively, Ω+.• Dirac delta distribution: the directional derivative of the Heaviside

function H in the normal direction of the normal ~N :

δ(~x) = ∇H(φ(~x)) · ~N = H ′(φ)∇φ(~x) ·∇φ(~x)

|∇φ(~x)|

= H ′(φ)|∇φ(~x)|

= δ(φ)|∇φ(~x)|

since ∇φ(~x) · ∇φ(~x) = |∇φ(~x)|2 and δ(φ) = H′(φ) (the one-dimensional Dirac delta distribution).

Level Sets Methods in Imaging Science – p.10/36

Page 13: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Calculus operations:• Surface (line or point) integral of a function f over the boundary

(interface) ∂Ω between the inside Ω− and outside Ω+ regions is:∫

∂Ω

fds =

Rn

f(~x)δ(~x)d~x =

Rn

f(~x)δ(φ)|∇φ(~x)|d~x.

• By embedding the volume and surface integrals in higherdimensions, the above formulas avoid the need for identifyinginside, outside, or boundary regions, making the numericalintegration easier.

• The numerical approximations of the above integrals require thatthe Heaviside function H and the Dirac distribution δ be smooth.

Level Sets Methods in Imaging Science – p.11/36

Page 14: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionCalculus operations:

• Possible regularizations of H and δ:• C2 regularization of H

H2,ǫ(φ) =

0, if φ ≤ −ǫ1

2

[

1 +φ

ǫ+

1

ǫsin

(

π φ

ǫ

)]

, if |φ| ≤ ǫ

1, if φ > ǫ

δ2,ǫ(φ) =dH2,ǫ(φ)

dφ=

0, if |φ| > ǫ

1

2

[

1

ǫ+

1

ǫcos

(

π φ

ǫ

)]

, if |φ| ≤ ǫ

• C∞ regularization of H

H∞,ǫ(φ) =1

2

(

1 +2

πarctan

(

φ

ǫ

))

, δ∞,ǫ(φ) =dH∞,ǫ(φ)

dφ=

1

π

ǫ

ǫ2 + φ2

• As ǫ→ 0, H2,ǫ, H∞,ǫ → H and δ2,ǫ, δ∞,ǫ → δ.

Level Sets Methods in Imaging Science – p.12/36

Page 15: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionLevel Set Functions

• What is a good choice of an implicit function φ?• Signed distance functions: a subset of the implicit functions φ that

are positive on the exterior region, negative in the interior region,and zero on the interface.

• Examples of signed Euclidean distance functions:• for the interface −1, 1 in R: φ(x) = |x| − 1 has|∇φ| = 1, ∀x 6= 0.

• for the unit circle (x, y) ∈ R2|x2 + y2 = 1 in R

2:φ(x, y) =

x2 + y2 − 1 has |∇φ| = 1, ∀~x 6= ~0.• for the unit sphere (x, y, z) ∈ R

3|x2 + y2 + z2 = 1 in R3:

φ(x, y, z) =√

x2 + y2 + z2 − 1 has |∇φ| = 1, ∀~x 6= ~0.

• All signed Euclidean distance functions φ satisfy |∇φ| = 1 almosteverywhere, so

~N = ∇φ, κ = ∆φ.

• However, avoid using the above expressions for ~N and κ since|∇φ| 6= 1 when using numerical approximations.

Level Sets Methods in Imaging Science – p.13/36

Page 16: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionMotivational Example of the Level Set Method in 2D:Sea Level = interface; Oceans = interior region; Mountains = exterior region;

φ(x, y, τ) = 0 moving interface; φ(x, y, 0) = signed Euclidean distance

x

x

y

y

z

y

x

x

y

z

a. Initial Circle b. Initial Surface

c. Circle at time d. Surface at time

Level Sets Methods in Imaging Science – p.14/36

Page 17: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Motivational Example of the Level Set Method in 2D:• The surface on the right is called the level set function (geometric

active contour or signed distance function).

• It accepts as input any point in the plane and hands back itsheight as output.

• The red cross-section through the surface is called the zero levelset.

• It is the collection of all points that are at height zero.

• Basic idea: instead of moving the red interface in 2D, we move thesurface (level set function) in 3D.

• Mathematically, the level set method tracks tbe motion of aninterface as the zero level set of the signed Euclidean distancefunction.

Level Sets Methods in Imaging Science – p.14/36

Page 18: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionEvolution Equation for the Level Set Function φ:

• The level set value of a particle moving on the interface with path~x(τ) is always zero:

φ(~x(τ), τ) = 0

• Differentiate the above with respect to τ

∂φ

∂τ+ ∇φ(~x(τ), τ) ·

d~x(τ)

dτ= 0

with φ(~x(0), 0) given.• If the particle velocity is known

d~x(τ)

dτ= ~V(1)

then:

∂φ

∂τ+ ~V · ∇φ(~x(τ), τ) = 0(2)

Level Sets Methods in Imaging Science – p.15/36

Page 19: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionEvolution Equation for the Level Set Function φ:

• When ~V = F ~N = F ∇φ|∇φ| , then

∂φ

∂τ+ F |∇φ| = 0(3)

• The level set function φ is used not only to represent the interfacebut also to evolve the interface.

• The level set equation (evolution equation): equation (2) or theequivalent equation (3).

• Use equation (2) when the interface is moved by an externallygenerated velocity field ~V not dependent on the level set function φ

• only the physics of the problem of interest evloves the interface.

Level Sets Methods in Imaging Science – p.16/36

Page 20: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Evolution Equation for the Level Set Function φ:• Use equation (3) when the interface is moved by a self-generated

velocity field ~V that depends directly on the level set function φ

• both - the geometry and the physics of the problem of interest -contribute to the evolution of the interface

• The level set equation (2) or (3) is the global Eulerianrepresentation of the interface evolution

• the interface is captured by the level set function φ

• as opposed to being tracked by interface elements as done bythe local Lagrangian formulation (1).

Level Sets Methods in Imaging Science – p.17/36

Page 21: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionExample: Motion by mean curvature

• The level set equation describing mean curvature flow is:

∂φ

∂τ= bκ|∇φ|,(4)

with b a positive scalar.• When b > 0 circles in 2D shrink to a single point and disappear.• When b < 0 the problem is ill-posed: instabilities develop as the

circles in 2D grow instead of shrink.

Shrinking sphere (right) and breaking dumbbell (left) (J.M. Fried, 1995)Level Sets Methods in Imaging Science – p.18/36

Page 22: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Example: Motion in the normal direction• The level set equation is:

∂φ

∂τ+ a|∇φ| = 0

where a is a real valued scalar.• If φ is initially a signed distance function, it stays a signed distance

at all timesThis is not true in general for arbitrary velocity fields!

• An interface propagating at constant speed can form corners as itevolves.

• At corner points the interface (level set function) is notdifferentiable and a weak solution must be constructed.

• The correct weak solution, the entropy solution, comes fromSethian’s entropy condition:

Once a corner has developed, the solution is no longer reversible;some information about the solution is forever lost.

No point-wise correspondence! Level Sets Methods in Imaging Science – p.19/36

Page 23: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction• Application to hydrocephalus:(Drapaca et al., 2005)

Horizontal section of a normal (left) and hydrocephalic (right) brain.

Note the large ventricles and severely compressed brain tissue in the hydrocephalus condition.

Level Sets Methods in Imaging Science – p.19/36

Page 24: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction• Application to hydrocephalus:(Drapaca et al., 2005)

Horizontal section of a hydrocephalic brain before (left) and 3 months after (right) shunt implantation

Level Sets Methods in Imaging Science – p.19/36

Page 25: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction• Application to hydrocephalus:(Drapaca et al., 2005)

Horizontal section of a hydrocephalic brain before (left) and 3 months after (right) shunt implantation

The pre-shunted ventricular CSF-tissue boundary (left), evolution in time of the ventricular wall for a = −1 (centre)

and one of the evolved curve (right)

Level Sets Methods in Imaging Science – p.19/36

Page 26: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction• Application to hydrocephalus:(Drapaca et al., 2005)

Horizontal section of a hydrocephalic brain before (left) and 3 months after (right) shunt implantation

A 3D ventricular surface shrinking with a = −1 (original 3D surface (blue), evolved 3D surface (purple))

Level Sets Methods in Imaging Science – p.19/36

Page 27: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionExample: Propagation of a cosine curve

• An interface propagating at a speed F = 1 − ǫκ, ǫ > 0 stayssmooth during the evolution process.

• As ǫ→ 0, this solution approaches the entropy solutionobtained for the constant speed case.

• The constant speed acts as an advection term, while thecurvature dependent term has a diffusive, regularizing effect onthe interface.

Viscosity solution for F = 1 − 0.25κ (left) and the entropy solution for F = 1 (right)

Level Sets Methods in Imaging Science – p.20/36

Page 28: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionAdvantages of the level set method:

• No parameterization.• Automatic handling of topology changes.• Easy computation of geometric properties.• Mathematical proofs and numerical stability.• Easy to implement numerical schems.

Challenges of the level set method:• Computationally expensive

• Narrow band algorithm (Adalsteinsson & Sethian, 1995)• PDE-based fast local level set method (Peng & Merriman & Osher et al., 1999)• GPU implementation (Lefohn et al., 2004)

• Fixed uniform resolution• Octree-based level sets (Losasso & Fedkiw & Osher, 2006)

Level Sets Methods in Imaging Science – p.21/36

Page 29: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionChallenges of the level set method:

• Need a periodic reinitialization• Extension velocities (Adalsteinsson & Sethian, 1999)• Signed distance conservation model (Gomes & Faugeras, 2004)

• Need a mesh extraction step• Marching cubes algorithm (Lorensen & Cline, 1987)

• Numerical diffusion• Particle level set method (Enright, Fedkiw et al., 2002; Osher & Fedkiw book, ch.9)

• Limited to codimension 1• Local level set method for any codimension (Min, 2004; Osher & Fedkiw

book, ch.10)

• Limited to closed surfaces• model open surfaces using two level set functions (Liao, 2003; Li et al.,

2006)

Level Sets Methods in Imaging Science – p.22/36

Page 30: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionChallenges of the level set method:

• Cannot track a region of interest on the surface

• Producing a suitable model for the speed function F (normalcomponent of the velocity).• F may depend on the geometry and the physics of the problem.

• The information of the tangential component of the velocity is notused• Cannot handle interfacial data• No point-wise correspondence

• No control on topology

• Pons et al., 2004, 2006 report progress on level sets withtangential velocities.

• Work on level set methods with topological constraints was doneby Han et al., 2003; Alexandrov, Santosa, 2004; Pons et al., 2006.

Level Sets Methods in Imaging Science – p.23/36

Page 31: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Reinitialization equations:• As the interface evolves according to, for example, (3), φ will drift

away from its initialized value as signed distance and sometimes itmay lead to unbounded values of |∇φ|.

• If φ is not a signed distance function at a time t, then its zeroisocontour will not be the evolved interface at t.

• Reinitializing φ occasionally to be a signed distance function willalso ensure that φ stays smooth enough such that its spatialderivatives are computable.

• The numerical scheme will stay stable (Merriman, Bence & Osher, 1994)

• Recall that φ is a signed distance function if |∇φ| = 1.

Level Sets Methods in Imaging Science – p.24/36

Page 32: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionI. Reinitialization using the extension velocities model

• Peng et al., 1999 (following Rouy & Tourin, 1992) embedded theconstraint |∇φ| = 1 into a dynamic scheme and solve theequations

∂φ

∂τ+ |∇φ| = 1 in Ω+

∂φ

∂τ− |∇φ| = −1 in Ω−(5)

until the steday state (∂φ∂τ = 0) is reached.

• Reinitialization equation: combination of the two equations in (5) ofthe form:

∂φ

∂τ+ S(φ) (|∇φ| − 1) = 0, S(φ) =

φ√

φ2 + |∇φ|2(∆x)2.(6)

• S(φ) has smoothing effects on the numerical solution φ; ∆x is thestep in the x direction of the numerical grid.

Level Sets Methods in Imaging Science – p.25/36

Page 33: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

II. Reinitialization using the fast marching method• The signed distance is the solution of the Eikonal equation:

|∇φ| = 1(7)

• Use the fast marching method to solve (7).

• Fast marching method (FMM): designed for problems in which thefront is always moving forward or backward (the speed does notchange its sign).

• the front crosses each forward (backward) grid point only once.

• it is a very fast method (tree algorithms).

Level Sets Methods in Imaging Science – p.26/36

Page 34: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionII. Reinitialization using the fast marching method

• FMM uses:• upwind difference operators to approximate the gradient, and• the Dijkstra idea of a one-pass algorithm for computing the

shortest path on a network.

• Dijkstra’s method for a network in which there is cost assigned toentering each node:• Put the starting point in a set called Accepted.• Call the grid points which are one link away from the Start

Neighbors.• Compute the cost of reaching each of these Neighbors.• The smallest of these Neighbors must have the correct cost.

• Remove it, and call it Accepted.• Add any new Neighbors to this point that are not already

Accepted.• Find the cost of reaching all Neighbors.

• Repeat the previous step until all points are Accepted.

Level Sets Methods in Imaging Science – p.26/36

Page 35: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

II. Reinitialization using the fast marching method

Find the shortest path from Start to Finish in the given network (left), and shortest path shown in red (right).

Level Sets Methods in Imaging Science – p.26/36

Page 36: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionII. Reinitialization using the fast marching method

• To solve (7), FMM can be run separately for grid points outside andinside the interface.

• Basic idea: builds the signed distance function φ using only upwindvalues starting with the smallest value of φ (first arrivals).

Algorithm for the fast marching method

• Tag the points on the interface as Known.• Tag the points that are one grid point away from the interface as

Trial.• Tag all the other points as Far.• Begin loop: If A is a Trial point with the smallest φ value, add it to

Known and remove it from Trial.• Tag as Trial all the neighbours of A that are not Known. If the

neighbour is in Far remove it from Far and add it to the set Trial.• Recompute the values of φ at all the Trial neighbours of A

according to equation (7).• Return to the top of the loop.

Level Sets Methods in Imaging Science – p.26/36

Page 37: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Algorithm for the fast marching method

Update procedure for the fast marching method

Level Sets Methods in Imaging Science – p.26/36

Page 38: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionIII. The signed distance conservation model

• Gomes & Faugeras, 2004 changed the level set equation (3) insuch a way that at each time instant φ is the signed distancefunction.

• The idea is to introduce a new function B such that B and φsatisfy:

B(~x) = F (~x), for φ(~x) = 0;∂φ

∂τ= −B; |∇φ| = 1

• Differentiating the above last two equations:

(

∂φ

∂τ

)

= ∇B,∇φ

|∇φ|·∂∇φ

∂τ= 0

• Since∂∇φ

∂τ= ∇

(

∂φ

∂τ

)

, we get: ∇φ · ∇B = 0,

i.e. B is constant along the characteristics of φ.

Level Sets Methods in Imaging Science – p.27/36

Page 39: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionIII. The signed distance conservation model

• Arnold, 1983 proved that the characteristics of distance functionsare straight lines of (nonunique) equationf(λ) = ~x− λ∇φ(~x), ∀~x ∈ R

n.

• The point ~y = ~x− φ(~x)∇φ(~x) is the closest point to ~x on the zerolevel set of φ (φ(~y) = 0) also located on the characteristic of φthrough ~x.

• Since B is constant on the characteristics of φ and B = F onφ = 0, it follows that B(~x) = B(~y) = F (~x− φ(~x)∇φ(~x)).

• The new level set equation that conserves the signed distancefunction during the evolution process is:

∂φ

∂τ+ F (~x− φ(~x)∇φ(~x)) = 0.(8)

• By using equation (8) instead of the classic level set equation (3),no reinitialization is needed.

Level Sets Methods in Imaging Science – p.28/36

Page 40: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionLevel sets with a point correspondence (LSPC)

• Level set methods convey a purely geometric description• the point-wise correspondence is lost• cannot handle interfacial data• restricts the range of possible applications

• Tangential velocities have no effect on the shape (geometry) of thelevel set funciton φ,• but it affects point correspondences and the evolution of

interfacial data (contains information about the physics of theproblem)

Enright test: a circle is entrained by vortices and stretched out very thin before the flow time reverses returning the

circle to its original form.

Level Sets Methods in Imaging Science – p.29/36

Page 41: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionLevel sets with a point correspondence (LSPC)

• Basic idea: advect the point coordinates with the same speed asthe level set function

• Introduce a correspondence function ψ pointing to the initialinterface

• φ and ψ are the steady-state solutions of:

∂φ

∂τ+ ~v · ∇φ = 0

∂ψ

∂τ+ Jψ~v = 0

with φ(~x, 0) and ψ(~x, 0) given. Jψ is the Jacobian of ψ.• If f0 is a function of interfacial data (related to the physics of the

problem) then the evolution of f = f0 is given by:

∂f

∂τ+ ~v · ∇f = (∇f0)

(

∂ψ

∂τ+ Jψ~v

)

= 0.

Level Sets Methods in Imaging Science – p.30/36

Page 42: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Level sets with a point correspondence (LSPC): Examples(Pons et al., 2004, 2006)

A rotating and shrinking circle: initial (left) and final (centre) interface, point correspondence (right).

Level Sets Methods in Imaging Science – p.31/36

Page 43: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Level sets with a point correspondence (LSPC): Examples

2D evolutions with (bottom) and without (top) an area preserving tangential velocity.

Expanding (left column) and shrinking (right column) square.

Level Sets Methods in Imaging Science – p.32/36

Page 44: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Level sets with a point correspondence (LSPC): Examples

3D unfolding of a cortex with a tumor (left) with (right) and without (centre) an area preserving tangential velocity.

• Cortex unfolding to a simplified geometry allows for easiervisualization and analysis of functional and structural properties ofthe cortex.

Level Sets Methods in Imaging Science – p.32/36

Page 45: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionRemarks on the type of PDEs

• Hamilton-Jacobi equation: a hyperbolic PDE of the form

∂φ

∂τ+H(~x, τ,∇φ) = 0(9)

• The level set equation (2):

∂φ

∂τ+ ~V · ∇φ = 0

is of form (9) with H(~x, τ,∇φ) = ~V (~x, τ) · ∇φ.

• The level set equation (3):

∂φ

∂τ+ F |∇φ| = 0

is of form (9) with H(~x, τ,∇φ) = F |∇φ| when F depends only on~x, τ and/or ∇φ.

Level Sets Methods in Imaging Science – p.33/36

Page 46: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

Introduction

Remarks on the type of PDEs• Gomes & Faugeras equation (8):

∂φ

∂τ+ F (~x− φ∇φ) = 0

is not a Hamilton-Jacobi equation since F depends on φ.

• The equation of the motion by mean curvature (4):

∂φ

∂τ= b∇ ·

(

∇φ

|∇φ|

)

|∇φ|

contains second order spatial derivatives of φ and thus is not aHamilton-Jacobi equation.

• This is a parabolic equation.

Level Sets Methods in Imaging Science – p.34/36

Page 47: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionGeneral level set algorithm

• Initialize/reinitialize the level set function φ at τ = τn.

• Construct/approximate ~V · ∇φ or F |∇φ|.

• Evolve φ using equation (2) or (3) for τ = τn + ∆τ .

Example of Matlab code• function signeddistance = ellipse(x,y,x0,y0,xradius,yradius)

dist2=(x-x0).2./xradius2+(y-y0).2./yradius2;if (1-dist2 >= 0)signeddistance=(1-dist2).(1/2);else signeddistance=-(dist2-1).(1/2);end;

Level Sets Methods in Imaging Science – p.35/36

Page 48: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionExample of Matlab code

• function d = lsm-normaldir-2d(data, a, T, deltax, deltay, deltat)

Ny=size(data,1);Nx=size(data,2);

syminus=cat(1,data(1,:),data(1:Ny-1,:));syplus=cat(1,data(2:Ny,:),data(Ny,:));sxminus=cat(2,data(:,1),data(:,1:Nx-1));sxplus=cat(2,data(:,2:Nx),data(:,Nx));

Ixminus=(sxminus-data)./deltax;Ixplus=(sxplus-data)./deltax;Iyminus=(syminus-data)./deltay;Iyplus=(syplus-data)./deltay;

Ixpm=(sxplus-sxminus)./(2⋆ deltax);Iypm=(syplus-syminus)./(2⋆ deltay);mag=(Ixpm.2+Iypm.2).(1/2);

data=data-a.⋆ deltat.⋆ mag;d=data;

Level Sets Methods in Imaging Science – p.36/36

Page 49: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionExample of Matlab code

• M-file test-lsm-normaldir-2dm=zeros(64,64);for i=1:64for j=1:64m(i,j)=ellipse(i,j,32,32,30,30);end; end;

a=2; dx=1; dy=1; dt=1;T=10;

contour(m,[0,0],’b’); hold on;[Nx,Ny]=size(m);mevolved=zeros(Nx,Ny,T+1);

for i=1:Tmevolved(:,:,i+1)=lsm-normaldir-2d(mevolved(:,:,i),a,T,dx,dy,dt);contour(mevolved(:,:,i+1),[0,0],’g’); hold on;end;

contour(mevolved(:,:,T+1),[0,0],’r’);

Level Sets Methods in Imaging Science – p.36/36

Page 50: Level Sets Methods in Imaging Science · • ”Level set methods add dynamics to implicit surfaces.” (Osher & Fedkiw book) • useful in analyzing and computing the motion of an

IntroductionExample of Matlab code

10 20 30 40 50 60

10

20

30

40

50

60

Evolution of a initial ellipse (blue) with constant speed for 10 time steps. The last contour is red.

Level Sets Methods in Imaging Science – p.36/36