level sets - introduction
TRANSCRIPT
-
7/31/2019 Level Sets - Introduction
1/36
1/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Level Sets - Introduction
Level Set Methods and Dynamic Implicit Surfaces
Stanley Osher & Ronald Fedkiw
Series: Applied Mathematical Sciences, Vol. 153
Springer, 2003
ISBN-10: 0-387-95482-1
ISBN-13: 978-0-387-95482-0
-
7/31/2019 Level Sets - Introduction
2/36
2/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
example
..\..\My Videos\lvelsets\glass00.avi
i
From http://www-sop.inria.fr/ariana/DEMOS/classif_levelset/demo.html
-
7/31/2019 Level Sets - Introduction
3/36
3/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Surfaces
Implicit Functions
Signed Distance Functions
-
7/31/2019 Level Sets - Introduction
4/36
4/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - points
In one spatial dimension, suppose we divide the realline into three distinct pieces using the points x = -1and x = 1.
W- = (-1, 1) is the inside portion of the domain. W+ = (-,-1) (1, ) is the outside portion of the
domain.
W = {-1, 1} is the border between the inside and the
outside and is called the interface.
In one spatial dimension, the inside and outside regionsare one-dimensional objects, while the interface is
zero-dimensional. More generally, in Rn, subdomains are n-dimensional,
while the interface has dimension n - 1. We say thatthe interface has codimension one.
-
7/31/2019 Level Sets - Introduction
5/36
5/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - points
In an explicit interface representation one explicitlywrites down the points that belong to the interface
Alternatively, an implicit interface representation
defines the interface as the isocontour of somefunction.
For example, the zero isocontour off(x) = x2 - 1 is theset of all points where f(x) = 0.
Note that the implicit function f (x) is definedthroughout the one-dimensional domain, while theisocontour defining the interface is one dimension
lower. More generally in Rn, the implicit function f(x) is
defined on all x n; its isocontour has dimension n - 1.
-
7/31/2019 Level Sets - Introduction
6/36
6/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - points
there is nothing specialabout the zero isocontour.
The g(x)=1 isocontour ofg(x) = x2 defines thesame interface.
The partial derivatives off are the same as thepartial derivatives ofg,since the scalar vanishes
upon differentiation.
Thus, all implicit functions f(x) will be defined so thatthe f(x) = 0 isocontour represents the interface.
-
7/31/2019 Level Sets - Introduction
7/36
7/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - curves
In two spatial dimensions, our lower-dimensionalinterface is a curve that separates R2 into separatesubdomains with nonzero areas.
Here we are limiting our interface curves to those thatare closed, so that they have clearly defined interiorand exterior regions.
Example:f(x,y)= x2 + y2 1.
-
7/31/2019 Level Sets - Introduction
8/36
8/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - curves
In two spatial dimensions, the explicit interfacedefinition needs to specify all the points on a curve.
While in this case it is easy to do, it can be somewhat
more difficult for general curves.
In general, one needs to parameterize the curve with avector function x(s),where the parameter s is in [s0, sf].
The condition that the curve be closed implies thatx(s0) = x(sf).
A convenient way of approximating an explicit
representation is to discretize the parameter s into afinite set of points s0 < < si-1 < si < si+1 < < sf,where the subintervals [si, si+1] are not necessarily ofequal size.
-
7/31/2019 Level Sets - Introduction
9/36
9/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - curves
The implicit representation can be stored with adiscretization as well, except now one needs todiscretize all of R2, which is impractical, since it is
unbounded. Instead, we discretize a bounded subdomain D of R2.
Within D, we choose a finite set of points (xi, yi) for i =
1, . . . ,N to discretely approximate the implicitfunction.
This illustrates a drawback of the implicit surfacerepresentation.
Instead of resolving a one-dimensional interval [s0, sf],one needs to resolve a two-dimensional region D.
-
7/31/2019 Level Sets - Introduction
10/36
10/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - curves
More generally, in Rn, a discretization of an explicitrepresentation needs to resolve only an (n - 1)-dimensional set, while a discretization of an implicit
representation needs to resolve an n-dimensional set.
This can be avoided, in part, by placing all the points xvery close to the interface, leaving the rest of D
unresolved.
Since only the f(x) = 0 isocontour is important, onlythe points x near this isocontour are actually needed to
accurately represent the interface. The rest of D isunimportant.
-
7/31/2019 Level Sets - Introduction
11/36
11/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - curves
Neither the explicit nor the implicit discretization tellsus where the interface is located. Instead, they bothgive information at sample locations.
In the explicit representation, we know the location of afinite set of points on the curve, but do not know thelocation of the remaining infinite set of points (on the
curve).
In the implicit representation we know the values of theimplicit function f at only a finite number of points.
Interpolation is needed to find exact locations.
-
7/31/2019 Level Sets - Introduction
12/36
12/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - grid
The set of data points where the implicit function isdefined is called a grid.
Cartesian grids: {(xi, yj) | 1 i m, 1 j n}.x1 < < xi-1 < xi < xi+1 < < xm andy1 < < yj-1 < yj < yj+1 < < yn.
In a uniform Cartesian grid, all the subintervals areequal in size: Dx = xi+1 xi, Dy = yj+1 - yj.
Choose Dx = Dy so that the approximation errors arethe same in the x-direction as they are in the y-
direction.
Cartesian grids imply the use of a rectangular domainD = [x1, xm][y1, yn].
-
7/31/2019 Level Sets - Introduction
13/36
13/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Implicit Functions - surfaces
Extend to 3D: f(x,y,z)=x2 + y2 + z2 1. For complicated surfaces with no analytic representation, we
again need to use a discretization. In three spatial dimensions the explicit representation can be
quite difficult to discretize. One needs to choose a number of points on the two-
dimensional surface and record their connectivity which isless straightforward.
Some of the most popular algorithms can producesurprisingly inaccurate surface representations, e.g., surfaces
with holes.
Connectivity can change for dynamic implicit surfaces, i.e.,surfaces that are moving around. Here, connectivity is not aone-time issue dealt with in constructing an explicit
representation of the surface. Instead, it must be resolved over and over again every timepieces of the surface merge together or pinch apart.
One of the nicest properties ofimplicit surfaces is thatconnectivity does not need to be determined for thediscretization.
-
7/31/2019 Level Sets - Introduction
14/36
14/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
Implicit interface representations include some verypowerful geometric tools.
For example, since we have designated the f(x) = 0isocontour as the interface, we can determine whichside of the interface a point is on simply by looking atthe local sign off.
With an explicit representation of the interface it can bedifficult to determine whether a point is inside oroutside the interface.
-
7/31/2019 Level Sets - Introduction
15/36
15/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
Numerical interpolation produces errors in the estimateoff. This can lead to erroneously designating insidepoints as outside points and vice versa.
These errors amount to perturbing (or moving) theinterface away from its exact position.
If these interface perturbations are small, their effectsmay be minor, and a perturbed interface might beacceptable.
In fact, most numerical methods depend on the factthat the results are stable in the presence of smallperturbations.
-
7/31/2019 Level Sets - Introduction
16/36
16/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
Take numerical approximations with errors proportionalto the size of a Cartesian mesh cell, Dx.
If the implicit function is smooth enough and wellresolved by the grid, these estimates will beappropriate.
Otherwise, these errors might be rather large.
Obviously, this means that we would like our implicitfunction to be as smooth as possible.
A signed distance function to represent the surface
turns out to be a good choice, since steep and flatgradients as well as rapidly changing features areavoided as much as possible.
-
7/31/2019 Level Sets - Introduction
17/36
17/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
The gradient of the implicit function is defined as
The gradient is perpendicular to the isocontours offand points in the direction of increasing f.Therefore, if x is a point on the zero isocontour off,
i.e., a point on the interface, then f evaluated at x is avector that points in the same direction as the local unit(outward) normal N to the interface.Thus, the unit (outward) normal for points on the
interface is
-
7/31/2019 Level Sets - Introduction
18/36
18/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
It will be useful to have as much information aspossible representable on the higher-dimensionaldomain.
Embeds the normal in a function N defined on theentire domain that agrees with the normal for points onthe interface.
-
7/31/2019 Level Sets - Introduction
19/36
19/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
The normal is not defined in the origin where all partialderivatives vanish.
A simple technique for evaluating N at these points isjust to pick an arbitrary direction for the normal as it isan isolated singularity.
The standard trick of adding a small e > 0 to thedenominator can be a bad idea in general, since itproduces a normal with | N | 1.
In fact, when the denominator is zero, so is thenumerator.
-
7/31/2019 Level Sets - Introduction
20/36
20/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
On our Cartesian grid, the derivatives need to beapproximated, for example using finite differencetechniques.
We can use a first-order accurate forward differenceD+f
a first-order accurate backward difference D-f
or a second-order accurate central difference D0f
-
7/31/2019 Level Sets - Introduction
21/36
21/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
When all numerically calculated finite differences areidentically zero, the denominator of N vanishes.
As in the analytic case, we can simply randomly choosea normal. Here, however, randomly choosing a normalis somewhat justified, since it is equivalent to randomlyperturbing the values of on our Cartesian mesh by
values near round-off error.
These small changes in the values off are dominatedby the local approximation errors in the finite difference
formula for the derivatives.
-
7/31/2019 Level Sets - Introduction
22/36
22/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
The mean curvature of the interface is defined as thedivergence of the normal N = (n1, n2, n3),
so thatk > 0 for convex regions,k < 0 for concave regions,and k = 0 for a plane.
Using the definition of N:
-
7/31/2019 Level Sets - Introduction
23/36
23/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
This gives k explicitly:
A second-order accurate finite difference formula forfxx, the second partial derivative off in the x direction,is given by D+D-f = D-D+f :
A second order accurate finite difference formula for fxyis given by Dy
0Dx0f, or equivalently, Dx
0Dy0f.
Similar for fyx and fyy
-
7/31/2019 Level Sets - Introduction
24/36
24/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
Again the origin is a removable singularity.
It seems nonsensical to be troubled by k as weapproach the origin, since this is only a consequence of
the embedding.
The smallest unit of measure on the Cartesian grid isthe cell size Dx, it makes little sense to hope to resolve
objects smaller than this. That is, it makes little senseto model circles (or spheres) with a radius smaller thanDx. Therefore, we limit the curvature so that
If a value ofk is calculated outside this range, wereplace it with the closest limiting case.
-
7/31/2019 Level Sets - Introduction
25/36
25/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry Toolbox
The characteristic function c- of the interior region W- isdefined as
where we arbitrarily include the boundary with theinterior region.
The characteristic function c+ of the exterior region W+
is defined similarly as
-
7/31/2019 Level Sets - Introduction
26/36
26/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Calculus Toolbox
These functions are functions of a multidimensionalvariable x. Thus define the one-dimensional Heavisidefunction
The volume integral of a function f over the interior
region is defined as
or
-
7/31/2019 Level Sets - Introduction
27/36
27/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Calculus Toolbox
The directional derivative of the Heaviside function H inthe normal direction N is the Dirac delta function
which is a function of the multidimensional variable x.Note that this distribution is nonzero only on theinterface where f = 0. We can rewrite it as
In one spatial dimension, the delta function is defined
as the derivative of the one-dimensional Heavisidefunction giving
-
7/31/2019 Level Sets - Introduction
28/36
28/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Calculus Toolbox
The surface integral of a function f over the boundary isdefined as
where the region of integration is all ofW, since itprunes out everything except the boundaryautomatically. The one-dimensional delta function canbe used to rewrite this surface integral as
By embedding the volume and surface integrals in
higher dimensions, the need for identifying inside,outside, or boundary regions is avoided. Instead, theintegrals are taken over the entire region.
-
7/31/2019 Level Sets - Introduction
29/36
29/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Calculus Toolbox
The one dimensional delta function needs to beevaluated. Since d(f) = 0 almost everywhere, i.e.,except on the lower-dimensional interface, which hasmeasure zero, it seems unlikely that any standard
numerical approximation based on sampling will give agood approximation to this integral.
Thus, we use a first-order accurate smeared-outapproximation ofd(f).
Define the smeared-out Heaviside function
where e is a tunable parameter that determines the sizeof the bandwidth of numerical smearing.A typically good value is e = 1.5Dx
-
7/31/2019 Level Sets - Introduction
30/36
30/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Calculus Toolbox
Then the delta function is defined as the derivative ofthe Heaviside function:
the smeared-out Heaviside and delta functionsapproach to the calculus of implicit functions leads tofirst order accurate methods.
Also when used with some integration method.
-
7/31/2019 Level Sets - Introduction
31/36
31/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Distance Functions
A distance function d(x) is defined as
implying that d(x) = 0 on the boundary. Geometrically, d may be constructed as follows:
If x is on the boundary, then d(x) = 0.
Otherwise, for a given point x, find the point on the
boundary set closest to x, and label this point xC.Then d(x) = |x - xC|.
The line segment from x to xC is the shortest path(steepest descent) from x to the interface.
Since d is Euclidean distance, |d| = 1. Not unique, but one of the triumphs of the level set
method involves the ease with which these degeneratepoints are treated numerically.
-
7/31/2019 Level Sets - Introduction
32/36
32/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Signed Distance Functions
A signed distance function is an implicit function f with|f(x)| = d(x) for all x.
Thus:
f(x) = d(x) = 0 for all x W , f(x) = -d(x) for all x W-,
f(x) = d(x) for all x W+.
Furthermore, |f| = 1
Only in a general sense, but:
Equations that are true in a general sense can be used in
numerical approximations as long as they fail in a gracefulway that does not cause an overall deterioration of thenumerical method.
-
7/31/2019 Level Sets - Introduction
33/36
33/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
example
For 1D:
-
7/31/2019 Level Sets - Introduction
34/36
34/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
examples
For 2D:
And 3D:
Again: only singularities far from the front.
-
7/31/2019 Level Sets - Introduction
35/36
35/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Geometry and Calculus Toolboxes
Using |f| = 1:
And for the surface integral:
-
7/31/2019 Level Sets - Introduction
36/36
36/36Johann Radon Institute for Computational and Applied Mathematics: www.ricam.oeaw.ac.at
Summary
Basics on implicit functions:
Implicit functions use an extra dimension
Consider the zero-isocontour
Define regions inside and outside using the Heavisidefunction and the boundary with a delta function
For discrete computations use a smeared version
Singularities in the normal vector can usually be ignoredas they are far away and removable.
The signed distance function give the Euclidian distanceof a point to the boundary.
A very good choice for an implicit function