level set methods - university of missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf ·...

45
LevelSet Methods Level Set Methods

Upload: others

Post on 07-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Level‐Set MethodsLevel Set Methods

Page 2: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

• Level set methods– Formulation of Interface Propagation

• Boundary Value PDE• Initial Value PDE• Initial Value PDE

– Motion in an externally generated velocity field• ConvectionU i d diff i• Upwind differencing

• Hamilton‐Jacobi ENO/WENO, TVD Runge‐Kutta– Motion involves mean curvature

• Equations of motion• Numerical discretization• Convection‐diffusion equations

Page 3: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

– Hamilton‐Jacobi EquationHamilton Jacobi Equation• Connection with Conservation Laws• Numerical discretization

–Motion in the Normal Direction• The Basic Equation• Numerical discretization

• Adding a Curvature‐Dependent Term• Adding an External Velocity Field

Page 4: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

ReferencesReferences

• S. Osher and R. Fedkiw, Level Set Methods and Dynamic I li it S f S i 2003Implicit Surfaces, Springer, 2003.

• J.A. Sethian, Level Set Methods and Fast Marching Methods, Cambridge, 1996.

• Geometric Level Set Methods in Imaging, Vision, and Graphics, Stanley Osher, Nikos Paragios, Springer, 2003.

• Geometric Partial Differential Equations and ImageGeometric Partial Differential Equations and Image Analysis, Guillermo Sapiro, Cambridge University Press, 2001.J A S thi “L l S t M th d A A t f Vi l ”• J. A. Sethian, “Level Set Methods: An Act of Violence”, American Scientist, May‐June, 1997.

• N. Foster and R. Fedkiw, "Practical Animation of Liquids", SIGGRAPH 2001 pp 15 22 2001SIGGRAPH 2001, pp.15‐22, 2001. 

Page 5: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

• Level set methodsLevel set methods–Motion in an externally generated velocity field• ConvectionConvection

• Upwind differencing• Hamilton‐Jacobi ENO/WENO, TVD Runge‐Kutta/ , g

–Motion involves mean curvature• Equations of motion

• Numerical discretization

• Convection‐diffusion equations

Page 6: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

3. Motion in an Externally Generated Velocity Field3. Motion in an Externally Generated Velocity Field

1 Convection1. Convection

• Assume the velocity of each point on the implicit surface is given as )(V implicit surface is given as        , 

• i.e.          is known for every point    with

)(xV

)(xV 0)( xx

• Given this velocity field   )(xV

Page 7: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• Level set methods add dynamics to implicitLevel set methods add dynamics to implicit surfaces

• Stanley Osher and James Sethiani l d h fi h i llimplemented the first approach to numerically solving a time‐dependent equation for a 

i i li i fmoving implicit surface

Page 8: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• In the Eulerian approach the implicit functionIn the Eulerian approach the implicit function φ is used to both represent the interface and evolve the interfaceevolve the interface.

• Given an external velocity field the level set equation is given asequation is given as

0 V

0 Vt

Temporal partial derivative Advection term

Page 9: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• Using the forward difference approach for theUsing the forward difference approach for the partial derivative with respect to time 

1 nn 0 nnVt

Page 10: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• At this point it looks like the next step wouldAt this point it looks like the next step would be to take the gradient of φ by using central differencesdifferences.

• But first we should expand the equation and look at it one dimension at a timelook at it one dimension at a time

1 nn 0 n

znn

ynn

xn wvu

t

Page 11: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• If we look at the u component of the vector field we might see something like to the right

● ● ● ● ●

● ● ● ● ●

see something like to the right for direction.

• If ui j is pointing to the right we

● ● ● ● ●

● ● ● ● ●If ui,j is pointing to the right we need to look to the cell to the right of φi,j the same applies to l t th l ft

● ● ● ● ●

values to the left.xx

ii

1

xxii

1

Forward BackwardForwardDifference

BackwardDifference

Page 12: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• For a 1‐d case the level set equation would beFor a 1 d case the level set equation would be of the form

01

nnnn 0

nx

niu

t

Page 13: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in an Externally Generated Velocity i ldField

• The update equation would beThe update equation would be

nx

nnn tu 1

• where

x

01

ii ui

01ii

i

x

ux

0iux

Page 14: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

• Level set methodsLevel set methods–Motion in an externally generated velocity field• ConvectionConvection

• Upwind differencing• Hamilton‐Jacobi ENO/WENO, TVD Runge‐Kutta/ , g

–Motion involves mean curvature• Equations of motion

• Numerical discretization

• Convection‐diffusion equations

Page 15: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

4. Motion involves mean curvature4. Motion involves mean curvature

• Equations of motion• Equations of motion

• Numerical discretization

• Convection‐diffusion equations

Page 16: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James
Page 17: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James
Page 18: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

– Hamilton‐Jacobi EquationHamilton Jacobi Equation• Connection with Conservation Laws• Numerical discretization

–Motion in the Normal Direction• The Basic Equation• Numerical discretization

• Adding a Curvature‐Dependent Term• Adding an External Velocity Field

Page 19: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Hamilton‐Jacobi EquationHamilton Jacobi Equation

• Connection with Conservation Laws• Connection with Conservation Laws• Numerical discretization

Page 20: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

OverviewOverview

– Hamilton‐Jacobi EquationHamilton Jacobi Equation• Connection with Conservation Laws• Numerical discretization

–Motion in the Normal Direction• The Basic Equation• Numerical discretization

• Adding a Curvature‐Dependent Term• Adding an External Velocity Field

Page 21: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Motion in the Normal DirectionMotion in the Normal Direction

• The Basic EquationThe Basic Equation

• Numerical discretization

ddi C d• Adding a Curvature‐Dependent Term

• Adding an External Velocity Field

Page 22: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James
Page 23: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James
Page 24: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James
Page 25: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Foster and Fedkiw wanted to create a goodFoster and Fedkiw wanted to create a good animation tool that captured the essence of a good fluid simulator for animators

• Most engineering methods available were based around setting initial and boundary conditions and letting the fluid go with minimal ability for an animator to change anything dynamically  

Page 26: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Method OutlineSetup1. Model static environment as a voxel grid2. Model the liquid volume as a combination of particles 

and an implicit surfaceRepeat each iterationp1. Update the velocity field2. Apply velocity constraints due to moving objects

f bl3. Enforce incompressiblity4. Update the position of the liquid volume using the 

velocity fieldy

Page 27: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Model static environment as a voxel grid– The “staggered” grid shares velocity components between adjacent cells at the faces– Each cell is marked as either empty or full

● ● ● ● ●● ● ● ● ●

● ● ● ● ●

● ● ● ● ●

● ● ● ● ●

● ● ● ● ●

Page 28: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids● ● ● ● ●

● ● ● ● ●• Model the liquid volume as a combination of particles and an implicit surface– Randomly generate particles with 

surfaces represented as implicit surfaces

● ● ● ● ●

● ● ● ● ●

surfaces represented as implicit surfaces.– Generate an initial isocontour of the 

liquid by taking the minimum signed distance for each grid cell and smoothing it out

● ● ● ● ●

● ● ● ● ●

Page 29: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Hybrid Surface ModelHybrid Surface Model– The Level Set method alone tends to have problems preserving fine feature details like thinproblems preserving fine feature details like thin splashing

– A layer of particles are maintained just inside theA layer of particles are maintained just inside the isocontour surface and are evolved forward in time using Lagrangian methods.

Page 30: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Hybrid Surface ModelHybrid Surface Model– For each particle the local curvature of φ is tested by

– For areas of low curvature the particle is ignored but for f hi h h i l i ll d dif

k

areas of high curvature the particle is allowed to modify φ

– Particles that escape to the exterior region can be visualized as water droplets or mistvisualized as water droplets or mist

Page 31: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Update the velocity fieldp y– Performed using Stam’s formulation of Navier‐Stokes– Enough said.

Page 32: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Apply velocity constraints due to moving objects

1. Any cell within a solid object has i l i i h d h fits velocities changed to that of the moving object

2. Apply the velocity update3 Each cell that intersects the3. Each cell that intersects the 

surface of the object gets its velocity set to be tangent to the surface of the object

4 Cells inside the object have their4. Cells inside the object have their velocities put back to the object veclocity

Page 33: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Practical Animation of LiquidsPractical Animation of Liquids

• Enforce incompressiblityp y– Last step of Navier‐Stokes update

• Update the position of the liquid volume using the velocity field

Apply the level set equation to the liquid field– Apply the level set equation to the liquid field

0 u 0 ut

Page 34: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

ResultsResults

Page 35: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions

• A discrete approximation of the implicit function can be achieved via a Cartesian grid.

Outside Ω+

0

3.24 2.61 2.16 2.00 2.16 2.61 3.24

2 61 1 83 1 24 1 00 1 24 1 83 2 61 φ > 02.61 1.83 1.24 1.00 1.24 1.83 2.61

2.16 1.24 0.41 0.00 0.41 1.24 2.16

-1

Inside Ω‐

φ < 0Interface

2.00 1.00 0.00 .00

0.00 1.00 2.00

2.16 1.24 0.41 0.00 0.41 1.24 2.16 0122 yxx2.61 1.83 1.24 1.00 1.24 1.83 2.61

3.24 2.61 2.16 2.00 2.16 2.61 3.24

Page 36: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions

• The finer the resolution of the grid the moreThe finer the resolution of the grid the more numerically accurate the model will be.

Outside Ω+

0φ > 0

Interface Inside Ω‐

φ < 0 0122 yxx

Page 37: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit Vs. ExplicitImplicit Vs. Explicit

• Splitting and MergingSplitting and Merging

The merge of two implicit functions is the union operation– The merge of two implicit functions is the union operation

Page 38: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit Vs. ExplicitImplicit Vs. Explicit

• Expansion and Contraction

– Although there is no need to resample the region there are prescribed limits of expansion and contractions based on initial grid sizelimits of expansion and contractions based on initial grid size.

Page 39: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions

• Important RealizationsImportant Realizations– The Cartesian grid represents the evolving implicit function φ(x)function φ(x).

– It may begin as the reflection of the form of a circle or sphere or any shape but will sooncircle or sphere or any shape but will soon represent something else entirely.

– The only relation to its original form it must y gmaintain is φ(x) = 0 represents the interface.

Page 40: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions

• Important RealizationsImportant Realizations– The interface evolves as elements of the grid become less positive or negativebecome less positive or negative.   

– It is best not to think in terms of the interface itself moving but that the grid cells around it areitself moving but that the grid cells around it are getting values closer to 0.  

Page 41: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions

• ExampleExample– Using an active contour to segment an image

Page 42: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit Functions: Discrete RepresentationsImplicit Functions: Discrete Representations

• Points– Another way to represent φ(x) is to discretize Ωinto grid cells and put the value of φ(x) in each cell.

12 xx

… 8 3 0 -1 0 3 8 …

0 1 2 3‐1‐2‐3

Page 43: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit FunctionsImplicit Functions• Points– Or define φ(x) as a height.  φ( ) g

12 xx

0

0 1 2 3‐1‐2‐3

Page 44: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Implicit Surface & IsosurfaceImplicit Surface & Isosurface

• When c is 0, we say that f implicitly defines a locus, called animplicit surface, .

• The implicit surface is sometimes called the zero set (or zero

})(|{ 3 cfR pp

The implicit surface is sometimes called the zero set (or zerosurface) of f.

h i f ( l ll d l l l l f ) i• The isosurface (also called a level set or level surface) is, , where c is the iso‐value of the surface.}0)(|{ 3 pp fR

Page 45: Level Set Methods - University of Missouriweb.missouri.edu/.../lecture-notes/3b-level-set.pdf · • Level set methods add dynamics to implicit surfaces • Stanley Osher and James

Boolean Operations of Implicit Functionsp p

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

• φ(x) = max (φ1(x), φ2(x)) is the intersection of the interior regions of φ1(x) and φ2(x). 

• φ(x) = ‐φ1(x) is the complement of φ1(x) . 

• φ(x) = max (φ1(x), ‐φ2(x)) represents the subtraction of the interior regions of φ1(x) by the interior regions of φ2(x).