iso-contouring and level-sets
DESCRIPTION
Iso-Contouring and Level-Sets. Roger Crawfis. Contributors: Roger Crawfis, Han-Wei Shen, Raghu Machiraju, Torsten Moeller, Huang Zhiyong, Fan Ding, and Charles Dyer. Iso-contour/surface Extractions. 3D Iso-surface. 2D Iso-contour. Contouring - The Problem. - PowerPoint PPT PresentationTRANSCRIPT
Iso-Contouring and Level-Sets
Roger Crawfis
Contributors: Roger Crawfis, Han-Wei Shen, Raghu Machiraju, Torsten Moeller, Huang Zhiyong, Fan Ding, and Charles Dyer
04/22/23 R. Crawfis, Ohio State Univ. 2
Iso-contour/surface Extractions
2D Iso-contour 3D Iso-surface
04/22/23 R. Crawfis, Ohio State Univ. 3
Contouring - The Problem
Extracting an iso- surface from an implicit function, that is,
Extracting a surface from volume data (discrete implicit function), f (x ,y ,zT
04/22/23 R. Crawfis, Ohio State Univ. 4
More Formally
A scalar visualization technique that creates curves (in 2D) or surfaces (in 3D) representing a constant scalar value across a scalar field.
Contour lines are called isovalue lines or isolines.
Contour surfaces are called isovalue surfaces or isosurfaces
04/22/23 R. Crawfis, Ohio State Univ. 5
Contouring a 2D structured grid with contour line value = 5
0 1 1 3 2
1 3 6 6 3
3 7 9 7 3
2 7 8 6 2
1 2 3 4 3
1. Using interpolation to generate points along edges with the constant value
2. Connect these points into contours using a few different approaches. One of the approaches:
. Detects edge intersection . Tracks this contour as it moves across cell boundary . Repeat for all contours
04/22/23 R. Crawfis, Ohio State Univ. 6
2D Contouring – Not so easy
AnnotationsSmooth Curves
Topographic Map of Jerusalem (Contour interval 10 meters)
North is at the top of the map. The Mount of Olives is on the far right, Mount Zion on the left. Mount Moriah rises as a long ridge at the south end of the City of David and continues on past the present Temple Mount, and reaches its highest point outside the Northern walls of the Old City, at the top of the map.
http://www.skullandcrossbones.org/articles/solomontemple/solomontemple2.htm
04/22/23 R. Crawfis, Ohio State Univ. 7
Quantitative and Qualitative In this figure, we can
actually read off any value to about three significant digits.
Hard and tedious problem to determine where to place labels.
Usually done as vector graphics, rather than raster graphics for precision.
http://omnimap.com/catalog/cats/fish/fish-contour.htm
04/22/23 R. Crawfis, Ohio State Univ. 8
Divide and Conquer
Partition space into rectangular sub-regions.
04/22/23 R. Crawfis, Ohio State Univ. 9
Dividing Cubes/Squares Generates Points and
renders them Rendering points is
faster than polygons Principle - Divide a
square until contour passes thru the cell
1 2 3 4 3
2 7 8 6 2
3 7 9 7 3
1 3 6 6 3
0 1 1 3 2
Iso-value=5
04/22/23 R. Crawfis, Ohio State Univ. 10
Dividing Cubes
1. Create a cell2. Determine if the cell is a surface cell3. Subdivide surface cells to image resolution4. Determine intensity or color of refined cell5. Output a point for each remaining surface cell
04/22/23 R. Crawfis, Ohio State Univ. 11
Step 3: Subdivide Subdivide each cell such that the resolution is
higher than the image resolution. For example, when a 1282 gridded field is rendered to a 5122 image, cells containing the contour will be divided to 4x4 smaller squares.
classify subdivide output points
04/22/23 R. Crawfis, Ohio State Univ. 12
Surface Tracking Given function
S(t,x,y,z) that returns 1 if (x,y,z) is on the surface t and 0 otherwise
Needed: a seed cell p that is on the surface.
1 2 3 4 3
2 7 8 6 2
3 7 9 7 3
1 3 6 6 3
0 1 1 3 2
Iso-value=5
Seed cell
04/22/23 R. Crawfis, Ohio State Univ. 13
Surface TrackingLet Q be a queue of cells.
Push p onto QFlag p as “visited”While Q is not empty do
Pop q from Q and output it.For each cell v in the neighborhood of q doIf S(t, v) = 1 then
If v was not visited thenPush v onto QFlag it as “visited”
end {while}
04/22/23 R. Crawfis, Ohio State Univ. 14
Tracking and Smooth Curves
Recall that the gradient to a scalar field is normal to the isolines.
Therefore, the curve will be towards the direction perpendicular to the gradient.
Can also use the gradient to calculate tangents for each point on the curve to generate smooth curves.
04/22/23 R. Crawfis, Ohio State Univ. 15
Restricted Topological Cases
Filled circle vertices indicate scalar value is above the contour valueUnfilled ones which scalar values are below the contour values
•A closed curve can not be contained in the cell.•The curve can only enter and exit the cell once per edge.
04/22/23 R. Crawfis, Ohio State Univ. 16
Not Allowed
04/22/23 R. Crawfis, Ohio State Univ. 17
Linear Topology The restricted set is topologically equivalent to linear
segments. Topologically equivalent if we restrict the edge
intersections to lie at the mid-points of each edge.
04/22/23 R. Crawfis, Ohio State Univ. 18
Using Symmetry to Reduce to 5
Contour ambiguity: either solidor dash lines look OK
04/22/23 R. Crawfis, Ohio State Univ. 19
2D Iso-contour (0)
Remember bi-linear interpolation
p2 p3
p0 p1
P =?p4 p5
To know the value of P, we can first compute p4 andP5 and then linearly interpolateP
04/22/23 R. Crawfis, Ohio State Univ. 20
2D Iso-contour (1)
Consider a simple case: one cell data set
The problem of extracting an iso-contour is an inverse of value interpolation. That is:
p2 p3
p0 p1
Given f(p0)=v0, f(p1)=v1, f(p2)=v2, f(p3)=v3
Find the point(s) P within the cell that have values F(p) = C
04/22/23 R. Crawfis, Ohio State Univ. 21
2D Iso-contour (2)
p2 p3
p0 p1
We can solve the problem based on linear interpolation
(1) Identify edges that contain points P that have value f(P) = C
(2) Calculate the positions of P
(3) Connect the points with lines
04/22/23 R. Crawfis, Ohio State Univ. 22
2D Iso-contouring – Step 1
(1) Identify edges that contain points P that have value f(P) = C
v1 v2
If v1 < C < v2 then the edge contains such a point
04/22/23 R. Crawfis, Ohio State Univ. 23
2D Iso-contouring – Step 2
(2) Calculate the position of P
Use linear interpolation:
P = P1 + (C-v1)/(v2-v1) * (P2 – P1)v1 v2
Pp1 p2
C
04/22/23 R. Crawfis, Ohio State Univ. 24
2D Iso-contouring – Step 3
p2 p3
p0 p1
Connect the points with line(s)
Based on the principle of linear variation, all the points on the line have values equal C
04/22/23 R. Crawfis, Ohio State Univ. 25
Inside or Outside?
Just a naming convention
1. If a value is smaller than the iso-value, we call it “Outside”2. If a value is greater than the iso-value, we call it “Inside”
p2 p3
p0 p1- +
inside cell
p2 p3
p0 p1-
outside cell
04/22/23 R. Crawfis, Ohio State Univ. 26
Contouring in 3D
Treat volume as a set of 2D slices Apply 2D Contouring algorithm on each
slice. Or given as a set of hand-drawn
contoursStitch the slices together.
04/22/23 R. Crawfis, Ohio State Univ. 27
Contour Stitching•Problem:Problem:
Given: 2 two-dimensional Given: 2 two-dimensional closedclosed curves curves Curve #1 has Curve #1 has mm points points Curve #2 has Curve #2 has nn points points
Which point(s) does vertex Which point(s) does vertex ii on curve one correspond to on curve one correspond to on curve two?on curve two? ?
?
i
04/22/23 R. Crawfis, Ohio State Univ. 28
A Solution
Fuchs, et. al. Optimization problem 1 stitch consists of:
2 spans between curves1 contour segment
Triangles of {Pi,Qj,Pi+1} or {Qj+1,Pi,Qj}Consistent normal directions
Pi Pi+1
Qj
04/22/23 R. Crawfis, Ohio State Univ. 29
Fuchs, et. al.
Left span PiQj => go up
Right span (either) Pi+1Qj => go down PiQj+1 => go down
04/22/23 R. Crawfis, Ohio State Univ. 30
Fuchs, et. al.
Constraints Each contour segment is used once and
only once. If a span appears as a left span, then it
must also appear as a right span. If a span appears as a right span, then it
must also appear as a left span.
04/22/23 R. Crawfis, Ohio State Univ. 31
Fuchs, et. al.
This produces an acceptable surface (from a topological point of view) No holes
We would like an optimal one in some sense.
04/22/23 R. Crawfis, Ohio State Univ. 32
Fuchs et. al.
Graph problemVertices Vij = span between Pi and
QjEdges are constructed from a left
span to a right span. Only two valid right
spans for a left span.PPii
QQjj QQj+1j+1
PPi+1i+1
04/22/23 R. Crawfis, Ohio State Univ. 33
Fuchs, et. al.
Organize these edges as a grid or matrix.
PP
i
j
PiQjPi+1QjPiQj+1
04/22/23 R. Crawfis, Ohio State Univ. 34
Fuchs, et. al.
Acceptable graphs Exactly one vertical arc between Pi and Pi+1 Exactly one horiz. arc between Qj and Qj+1 Either
indegree(Vij) = outdegree(Vij) = 0both > 0
• (if a right, also has to be a left)
04/22/23 R. Crawfis, Ohio State Univ. 35
Fuchs, et. al.
Claim: An acceptable graph, S, is weakly
connected.Lemma 2 Only 0 or 1 vertex of S has an indegree = 2.
E.g., Two cones touching in the center. All other vertices have indegree=1 (recall indegree = outdegree)
04/22/23 R. Crawfis, Ohio State Univ. 36
Fuchs, et. al.
Thereom 1: S is an acceptable surface if and only if: S has one and only one horizontal arc
between adjacent columns. S has one and only one vertical arc
between adjacent rows. S is Eulerian (closed walk with every arc
only once).
04/22/23 R. Crawfis, Ohio State Univ. 37
Fuchs, et. al.
Number of arcs is thus m+n.Many possible solutions still!!!Associate costs with each edge Area of resulting triangle Aspect ratio of resulting triangle
04/22/23 R. Crawfis, Ohio State Univ. 38
Fuchs, et. al.
Note that Vi0 is in S for some i.Note that V0j is in S for some j. With the weights (costs), we can
compute the minimum path from a starting node Vi0. Since we do not know which Vi0, we compute
the paths for all of them and take the minimum.Some cost saving are achievable.
04/22/23 R. Crawfis, Ohio State Univ. 39
Marching Cubes
Predominant method used today.Efficient and simpleIt was independently reported by
Wyvill and McPeeters in 1986, Lorenson and Cline in 1987
04/22/23 R. Crawfis, Ohio State Univ. 40
Marching Cubes
Treat each cube individual No 2D contour curves
Allow intersections only on the edges or at vertices.
Pre-calculate all of the necessary information to construct a surface.
04/22/23 R. Crawfis, Ohio State Univ. 41
Marching Cubes
Consider a single cube All vertices above the
contour threshold All vertices below Mixed above and
below+ +
+
+ +
+-
+
04/22/23 R. Crawfis, Ohio State Univ. 42
Marching Cubes
Binary label each node => (above/below)
Examine all possible cases of above or below for each vertex.
8 vertices implies 256 possible cases.
+ +
+
+ +
+-
+
04/22/23 R. Crawfis, Ohio State Univ. 43
How many cases?
Now we have 8 vertices
So it is: 2 = 2568
How many unique topological cases?
04/22/23 R. Crawfis, Ohio State Univ. 44
Case Reduction
Value Symmetry
+
+
_ _
_
__
_+
+
_
_
+
+
+
+
04/22/23 R. Crawfis, Ohio State Univ. 45
Case Reduction
Rotation Symmetry
+
+
_ _
_
__
__
_
+
+
_ _
__
04/22/23 R. Crawfis, Ohio State Univ. 46
Case Reduction
Mirror Symmetry
+
+
_ +
_
+_
__
+
+
+
+ _
__
By inspection, we can reduce 256 15
04/22/23 R. Crawfis, Ohio State Univ. 47
Marching Cube - Summary
Create a cubeClassify each voxelBuild an indexLookup edge listInterpolate triangle verticesCalculate and interpolate normals
04/22/23 R. Crawfis, Ohio State Univ. 48
Step 1: Create a Cube
Consider a cube defined by eight data values: four from slice K, and four from slice K+ 1
04/22/23 R. Crawfis, Ohio State Univ. 49
Step 2: Classify Each Voxel
Binary classification of each vertex of the cube as to whether it lies outside the surface (voxel value < isosurface
value) or inside the surface (voxel value <=
isosurface value).
04/22/23 R. Crawfis, Ohio State Univ. 50
Step 3: Build an Index
Use the binary labeling of each voxel to create an 8-bit index: 8 vertices - 256 cases Requires a canonical
ordering of the cube.
04/22/23 R. Crawfis, Ohio State Univ. 51
Step 4: Look-up the Topology
Given the index for each cell, a table lookup is performed to identify the edges that intersect the iso-surface.
Also requires a canonical ordering of the edges: e1, e2, …, e12 0
12
3
14
e1, e3, e5…
Index intersection edges
e1
e2
e3
e4e5
e6
e7
e8
e9 e10
e11 e12
04/22/23 R. Crawfis, Ohio State Univ. 52
Step 4: Look-up the Topology
all 256 cases could be derived from 15 base cases. Difficult to determine rotational symmetry and map it correctly to the table.
04/22/23 R. Crawfis, Ohio State Univ. 53
Step 4: Example Index = 10001101 triangle 1 = e4,e7,e12 triangle 2 = e1, e7, e4 triangle 3 = e1, e6, e7 triangle 4 = e1, e10,
e6
e1e10
e6
e7e12
e4
v1 v2
v7
e2
04/22/23 R. Crawfis, Ohio State Univ. 54
Step 5: Interpolate Triangle Vertices
For each edge, find the vertex location along the edge using linear interpolation of the voxel values.
04/22/23 R. Crawfis, Ohio State Univ. 55
Step 6: Compute Normals
Calculate the normal at each cube vertex
Use linear interpolation to interpolate the polygon vertex normal
04/22/23 R. Crawfis, Ohio State Univ. 56
Why is it called marching cubes?
Linear search through cells •Row by row, layer by layer•Reuse the interpolated points for adjacent cells
No neighborhood informationNo neighborhood informationis required!!!is required!!!
04/22/23 R. Crawfis, Ohio State Univ. 57
Problems
Ambiguities: Are the curves below right or wrong?
04/22/23 R. Crawfis, Ohio State Univ. 58
Problems
Inconsistencies: Does the result produce the correct topology?
An iso-contour surface should always be a manifold (with boundary). We know whether these cases are right
or wrong.wrong
04/22/23 R. Crawfis, Ohio State Univ. 59
2D Contouring Ambiguity
Break contour Join contour
or
Either choice isacceptable becausecontour lines are continuousand closed
Independent of otherchoices
04/22/23 R. Crawfis, Ohio State Univ. 60
Marching Cubes
Topological inconsistencies in the 15 cases Turns out positive and negative are
not symmetric.
+ +
+
+ +
+- -
+ -
-
+ +
---
04/22/23 R. Crawfis, Ohio State Univ. 61
Topological Inconsistencies
The problem is that the edge intersections match, but the face intersections do not.
In 2D we only had edge intersections, so this was not a problem.
In 4D and higher the problem gets even worse.
04/22/23 R. Crawfis, Ohio State Univ. 62
A Bad Example
Resolution:Favor positive pathways thru the voxel (or negative, but be consistent).
Case 3 Case 3
Case 3Case 6
(compliment symmetry)
04/22/23 R. Crawfis, Ohio State Univ. 63
Ambiguous Cases Ambiguous cases:
3, 4, 6, 7, 10, 12, 13 Adjacent vertices:
different states Diagonal vertices:
same state Case 4 is not usually
considered ambiguous, but we could favor a tunnel through the long diagonal.
or
or
04/22/23 R. Crawfis, Ohio State Univ. 64
Ambiguous Cases
The ambiguous cases lead to a continuous manifold, but due to improper sampling of the volume, a (somewhat arbitrary) decision can be made on whether to close two curves or connect them.
Asymptotic Decider - by Nielson and Hamann (IEEE Vis’91) examines neighboring cells to determine this choice.
04/22/23 R. Crawfis, Ohio State Univ. 65
Asymptotic Decider
Based on bilinear interpolation over faces
B01
B00 B10
B11
(s,t)B(s,t) = (1-s, s) B00 B01
B10 B111-t t
The contour curves of B:
{(s,t) | B(s,t) = } are hyperbolas
04/22/23 R. Crawfis, Ohio State Univ. 66
Asymptotic Decider (2)
(0,0)
(1,1)
Where the hyperbolasgo through the cell depends on the valuesat the corners, I.e., B00, B01, B10, B11
04/22/23 R. Crawfis, Ohio State Univ. 67
Asymptotic Decider (3)
(0,0)
(1,1)
Asymptote
(ST
If B(ST
04/22/23 R. Crawfis, Ohio State Univ. 68
Asymptotic Decider (4)
(1,1)
Asymptote
(ST
(0,0)
If B(ST
04/22/23 R. Crawfis, Ohio State Univ. 69
Asymptotic Decider (5)
(1,1) (ST
(0,0)
S B00 - B01 B00 + B11 – B01 – B10
T B00 – B10 B00 + B11 – B01 – B10
B(ST B00 B11 + B10 B01 B00 + B11 – B01 – B10
04/22/23 R. Crawfis, Ohio State Univ. 70
Asymptotic Decider (6)
Based on the result of asymptotic decider, we expand the marching cube case 3, 6, 12, 10, 7, 13(These are the cases with at least one ambiguous faces).
04/22/23 R. Crawfis, Ohio State Univ. 71
Marching Cubes Demo
Animating the contour value
Special functions for contouring
Varying speeds and numbers of triangles
04/22/23 R. Crawfis, Ohio State Univ. 72
Marching Cubes
Data Structures/Tablesstatic int const HexaEdges[12][2] = { {0,1}, {1,2}, {2,3}, {3,0}, {4,5}, {5,6}, {6,7}, {7,4}, {0,4}, {1,5}, {3,7}, {2,6}};
typedef struct { EDGE_LIST HexaEdges[16];} HEXA_TRIANGLE_CASES;
/* Edges to intersect. Three at a time form a triangle. */
static const HEXA_TRIANGLE_CASES HexaTriCases[] = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 0 */{ 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 */{ 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 2 */{ 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 3 */
...
04/22/23 R. Crawfis, Ohio State Univ. 73
Marching Cubes - How simple /* Determine the marching cubes index */ for ( i=0, index = 0; i < 8; i++) if (val1[nodes[i]] >= thresh) /* If the nodal value is above the */ index |= CASE_MASK[i]; /* threshold, set the appropriate bit. */
triCase = HexaTriCases[index]; /* triCase indexes into the MC table. */ edge = triCase->HexaEdges; /* edge points to the list of intersected edges */
for ( ; edge[0] > -1; edge += 3 ) /* stop if we hit the -1 flag */ { for (i=0; i<3; i++) /* Calculate and store the three edge intersections */ { vert = HexaEdges[edge[i]]; n0 = nodes[vert[0]]; n1 = nodes[vert[1]]; t = (thresh - val1[n0]) / (val1[n1] - val1[n0]); tri_ptr[i] = add_intersection( n0, n1, t ); /* Save an index to the pt. */ } add_triangle( tri_ptr[0], tri_ptr[1], tri_ptr[2], zoneID); /* Store the triangle */ }}
04/22/23 R. Crawfis, Ohio State Univ. 74
Iso-Contouring – Advanced Issues
1. Efficiently determining which cells to examine.
2. Using iso-contouring as a slicing mechanism
3. Iso-contouring in higher dimensions4. Texturing and coloring of iso-contours5. Polygonal simplification of contours.6. Choosing a good iso-value
04/22/23 R. Crawfis, Ohio State Univ. 75
Iso-surface cells: cells that contain iso-surface.
min < iso-value < max Marching cubes algorithm performs a
linear search to locate the iso-surface cells – not very efficient for large-scale data sets.
Iso-surface cell search
04/22/23 R. Crawfis, Ohio State Univ. 76
Iso-surface Cells
For a given iso-value, only a smaller portion of the cells contain part of the iso-surface.
For a volume with n x n x n cells, the average number of the iso-surface cells is O(n x n) (ratio of surface v.s. volume) n
nn
04/22/23 R. Crawfis, Ohio State Univ. 77
Efficient Searching
With < 10% of the voxels contributing to the surface, it is a waste to look at every voxel.
A voxel can be specified in terms of its interval, its minimum and maximum values.
04/22/23 R. Crawfis, Ohio State Univ. 78
Efficient iso-surface cell search
Problem statement: Given a scalar field with N cells:
c1, c2, …, cn
With min-max range:(a1,b1), (a2,b2),…, (an, bn)
Find {Ck | ak < C < bk; C=iso-value}
04/22/23 R. Crawfis, Ohio State Univ. 79
Efficient search methods
1. Spatial subdivision (domain search)
2. Value subdivision (range search) 3. Contour propagation
04/22/23 R. Crawfis, Ohio State Univ. 80
Domain search
• Subdivide the space into several sub-domains, check the min/max values for each sub-domain
• If the min/max values (extreme values) do not contain the iso-value, we skip the entire region
Min/max
Complexity = O( k log(n/k) )
04/22/23 R. Crawfis, Ohio State Univ. 81
Span Space
MinimumThreshold
Threshold
High Gradient
Low Gradient
04/22/23 R. Crawfis, Ohio State Univ. 82
Span Space Given: iso-value v Candidate cells:
Minimum cell value less than the iso-value.
Maximum cell value greater than the iso-value.
Different algorithms query this span-space with different efficiencies.
min
max
v
v
Possiblecandidates
04/22/23 R. Crawfis, Ohio State Univ. 83
Span Space Create two lists:
Store (in order) the minima of each cell into the first list
Store (in order) the maxima of each cell into the second list.
Can easily get the set of cells with minimum less than the iso-value.
min
max
v
04/22/23 R. Crawfis, Ohio State Univ. 84
Span Space
Can easily get the set of cells with maximum greater than the iso-value.
Need the intersection of the two sets.
Not very efficient.min
max
v
v
04/22/23 R. Crawfis, Ohio State Univ. 85
Span Space - Active List
Given: iso-value v andmaximum cell range, r
gracefully update to new value nv
min
max
v
v
v-r
v+r
nvnv-r
nv
nv+r
04/22/23 R. Crawfis, Ohio State Univ. 86
Span Space – NOISE Algorithm
Minimum
• K-d TreesK-d Trees
Split Min. axisSplit Max. axis
04/22/23 R. Crawfis, Ohio State Univ. 87
Span Space
Search Method (2): ISSUE, discretized span space
O(log(N/L))
O(log(N/L))
O(1)
?
Complexity = ?
04/22/23 R. Crawfis, Ohio State Univ. 88
Range Search: Interval Tree
Interval Tree:
I
I left I right
Sort all the data points(x1,x2,x3,x4,…. , xn)Let = x mid point)n/2
We use to divide the cells into threesets II left, and I right
Icells that have min < max
I left: cells that have max < I right: cells that have min >
… …
04/22/23 R. Crawfis, Ohio State Univ. 89
Basic Idea:
Given an initial cell that contains iso-surface, the remainder of the iso-surface can be found by propagation
Contour Propagation
A
BD
CE
Initial cell: A
Enqueue: B, C
Dequeue: B
Enqueue: D
…
FIFO QueueA
B C
C
C D
….
Breadth-First Search
04/22/23 R. Crawfis, Ohio State Univ. 90
Challenges
Need to know the initial cells!
For any given iso-value C, findingthe initial cells to start the propagation is almost as hard as finding the iso-surface cells.
You could do a global search, but …
04/22/23 R. Crawfis, Ohio State Univ. 91
Solutions
(1) Extrema Graph (Itoh vis’95)(2) Seed Sets (Bajaj volvis’96)
Problem Statement:
Given a scalar field with a cell set G, find a subset S G, such that for any given iso-value C, the set S contains initial cells to start the propagation.
We need search through S, but S is usually (hopefully) much smallerthan G.
We will only talk about extrema graph due to time constraint
04/22/23 R. Crawfis, Ohio State Univ. 92
Extrema Graph (1)
Basic Idea:
If we find all the local minimum and maximum points (Extrema), and connect them together by straight lines (Arcs), then any closed Iso-contour is intersected by at least one of the arcs.
04/22/23 R. Crawfis, Ohio State Univ. 93
Extrema Graph (2)
04/22/23 R. Crawfis, Ohio State Univ. 94
Extrema Graph (3)
E1 E2
E3 E4
E7
E5E6 E8
a2a3
a4a5
a6a7
a1
Extreme Graph:
{ E, A: E: extrema points A: Arcs conneccts E }
An ‘arc’ consists of cells that connectextrema points (we only store min/max of the arc though)
04/22/23 R. Crawfis, Ohio State Univ. 95
Extrema Graph (4)
Algorithm:
Given an iso-value1) Search the arcs of the extrema graph (to find the arcs that have
min/max values that contain the iso-value2) Walk through the cells along each of these arcs to find the
seed cells3) Start the iso-contour propagation from the seed cells 4) ….
There is something more that needs to be done…
04/22/23 R. Crawfis, Ohio State Univ. 96
We are not done yet …
What ?!
We just mentioned that all the closed iso-contours will intersect with the arcs connecting the extrema points
How about non-closed iso-contours? (or called open iso-contours)
04/22/23 R. Crawfis, Ohio State Univ. 97
Extrema Graph (5)
Contours missed
These open iso-contours will intersect with ?? cells
Boundary Cells!!
04/22/23 R. Crawfis, Ohio State Univ. 98
Extrema Graph (6)
Algorithm (continued)Given an iso-value:
1) Search the arcs of the extrema graph (to find the arcs that have min/max values that contain the iso-value.
2) Walk through the cells along each of the arcs to find the seed cells.3) Start the iso-contour propagation from the seed cells.4) Search the cells along the boundary and find additional seed
cells.5) Propagate from these new seed cells for the open iso-contours.
04/22/23 R. Crawfis, Ohio State Univ. 99
Extrema Graph Efficiency - Number of cells visited:
extrema graph - N0.33
boundary - N 0.66
Iso-surface - N 0.66
based on tetrahedra - will create more surface triangles ...
should extract the same number of cells/ triangulation as Marching Cubes
04/22/23 R. Crawfis, Ohio State Univ. 100
Extrema Graph
Storage Costs: Extrema graph – very small amount of
memory for most datasets. For unstructured grids, I need to be able
to access my neighbors. This requires a very expensive data structure, more than the span-space data structures.
04/22/23 R. Crawfis, Ohio State Univ. 101
Selecting iso-valuesWhich iso-values should I examine
to best comprehend my dataset?Some data has very specific values: The aluminum structure in my
simulation will start to fail at a pressure of 5672psi. The molecular state changes from a
liquid to a gas at 100° C.
04/22/23 R. Crawfis, Ohio State Univ. 102
Contour Spectrum
Basic Idea: Calculate and present to the user several properties of an iso-contour.
Do this for all iso-contours.This leads to several functions in terms of
the iso-value, .Present these functions to the user as an
aid in picking contour values.
These slides are from Baja, Pascucci and Schikore (IEEE Visualization 1997)
04/22/23 R. Crawfis, Ohio State Univ. 103
OutlineUser Interface Signature Computation Real Time Quantitative Queries Rule-based Contouring Topological Information Future Directions
04/22/23 R. Crawfis, Ohio State Univ. 104
Graphical User Interface Graphical User Interface for Static Data for Static Data
• The horizontal axis spans the scalar values
• Plot of a set of signatures (length, area, gradient ...) as functions of the scalar value .
• Vertical axis spans normalized ranges of each signature. • White vertical bars mark current selected isovalues.
04/22/23 R. Crawfis, Ohio State Univ. 105
Graphical User Interface for time varying data
(,t ) --> c
The color, c, is mapped to the magnitude of a signature function of time, t, and isovalue
t
c
low
high
magnitude
• The horizontal axis spans the scalar value dimension .
• The vertical axis spans the time dimension t .
04/22/23 R. Crawfis, Ohio State Univ. 106
User Interface - MRI of a human torso -
• In real time the exact value of each signature is displayed.• The isocontour that bounds the region of interest is
obtained by selecting the maximum of the gradient signature.
04/22/23 R. Crawfis, Ohio State Univ. 107
Signature Computation Consider a terrain of
which you want to compute the length of each isocontour and the area contained inside each isocontour
04/22/23 R. Crawfis, Ohio State Univ. 108
Signature Computation
• The length of each contour is a C0 spline function.
• The area inside/outside each isocontour is a C1 spline function.
04/22/23 R. Crawfis, Ohio State Univ. 109
Signature Computation In general, the size
(surface area) of each iso-contour of a scalar field of dimension d is a spline function of d-2 continuity.
The size (volume) of the region inside/ outside is given by a spline function of d-1 continuity
04/22/23 R. Crawfis, Ohio State Univ. 110
Real Time Quantitative Queries(agricultural yield data)
size and position of the region with unsatisfactory production
size and size and position of the position of the region where region where wrong data wrong data acquisition acquisition occurredoccurred
Spectrum space is a useful space to visualize by itself.
04/22/23 R. Crawfis, Ohio State Univ. 111
Rule-based Contouring (CT scan of an engine)
The contour spectrum allows the development of an adaptive ability to separate interesting isovalues from the others.
04/22/23 R. Crawfis, Ohio State Univ. 112
Rule-based Contouring
(foot of the Visible Human) The contour
spectrum allows the development of an adaptive ability to separate interesting isovalues from the others.
04/22/23 R. Crawfis, Ohio State Univ. 113
Topological information.
an isocontour with three connected components two of which are about to merge}
•number of components per number of components per isocontourisocontour•which isocontours merge together which isocontours merge together or split while modifying the or split while modifying the isovalue.isovalue.
04/22/23 R. Crawfis, Ohio State Univ. 114
Other Topics
Interval Volumes4D Iso-contouringSmooth surfacesPolygon ReductionTriangle Strip generationTime-varying iso-contoursTexture map parameterization
Penny Rheingans
Level Sets
Roger Crawfis
Slides collected from: Fan Ding, Charles Dyer, Donald Tanguay, Theodore Kim and Roger Crawfis
04/22/23 R. Crawfis, Ohio State Univ. 116
Motivation:
04/22/23 R. Crawfis, Ohio State Univ. 117
Easy Case – Use Marching Cubes
04/22/23 R. Crawfis, Ohio State Univ. 118
Input Data Noisy
04/22/23 R. Crawfis, Ohio State Univ. 119
Non-uniform Exposure
04/22/23 R. Crawfis, Ohio State Univ. 120
Intensity Varies
04/22/23 R. Crawfis, Ohio State Univ. 121
Multiple problems
04/22/23 R. Crawfis, Ohio State Univ. 122
Applying Marching Cubes (thresholding)
04/22/23 R. Crawfis, Ohio State Univ. 123
Applying A Threshold
04/22/23 R. Crawfis, Ohio State Univ. 124
Applying A Threshold
04/22/23 R. Crawfis, Ohio State Univ. 125
Four (contour) Levels
04/22/23 R. Crawfis, Ohio State Univ. 126
What To Do?
User Intervention!!! We see it!! It’s right there!!! Well, the edges get pretty fuzzy .
Two step process:1. Draw an initial curve (or surface)
within the desired region.2. Expand that interface outward towards
the edge of our desired region.
04/22/23 R. Crawfis, Ohio State Univ. 127
Interfaces
An interface (or front) is a boundary between two regions: “inside” and “outside.”
In 2-D, an interface is a simple closed curve:
04/22/23 R. Crawfis, Ohio State Univ. 128
Propagating InterfacesHow does an interface evolve over time?At a specific moment, the speed function F (L, G, I) describesthe motion of the interface in the normal direction.
04/22/23 R. Crawfis, Ohio State Univ. 129
Propagating Interfaces
• Local – depend on local geometric information (e.g., curvature and normal direction)• Global – depend on the shape and position of the front (e.g., integrals along the front, heat diffusion)• Independent – do not depend on the shape of the front (e.g., an underlying fluid velocity that passively transports the front)
Speed F(L,G,I) is a function of 3 types of properties:
04/22/23 R. Crawfis, Ohio State Univ. 130
Motion Under Curvature
Example: Motion by curvature. Each piece moves perpendicularto the curve with speed proportional to the local curvature.
largepositivemotion
smallnegativemotion
04/22/23 R. Crawfis, Ohio State Univ. 131
Motion Under Curvature
Curvature κ is the inverse of theradius r of the osculating circle.
04/22/23 R. Crawfis, Ohio State Univ. 132
Motion Under Curvature
http://math.berkeley.edu/~sethian/Applets/java_curve_flow.html
04/22/23 R. Crawfis, Ohio State Univ. 133
Functional Representation
Eulerian framework: define fixed coordinate system on the world.For every world point x, there is (at most) one value y = ft(x).Falling snow example:
)(0 xfy t )(1 xfy t
04/22/23 R. Crawfis, Ohio State Univ. 134
Functional RepresentationHowever, many simple shapes are multivalued;they are not functions regardless of the orientation of thecoordinate system.
04/22/23 R. Crawfis, Ohio State Univ. 135
Parametric RepresentationSpatially parameterize the curve x by s so that at time t the curve is xt(s), where 0 s S and the curve is closed: xt(0) = xt(S).
Points on initial curve.
Gradient (wrt time) is thespeed in normal direction.
Normal is perpendicularto curve, as is curvature.
04/22/23 R. Crawfis, Ohio State Univ. 136
Parametric RepresentationFor motion under curvature, speed F depends only onlocal curvature κ – the equation of motion is thus:
where curvature is
and the normal is
2/322 )()(
ss
sssssst yx
yxxys
2/1222/122 )()(
)(ss
Tss
ss
Tss
t yxxy
yxyx
xxsn
),())(()( snsFsxt ttt
04/22/23 R. Crawfis, Ohio State Univ. 137
Particle MethodsIn order to compute, discretize the parameterization into moving particles which reconstruct the front.Known under a variety of names: marker particle techniques, string methods, nodal methods.
= # mesh particles
st
sS
= time step
= parameterization step
),( ni
ni yx = location of point iΔs at time nΔt
Δs
04/22/23 R. Crawfis, Ohio State Univ. 138
Problem Statement
Generally, given: An initial front Equations that govern its evolution
How do we simulate the front’s evolution?
Called an ‘initial value problem’ Given the initial position Solve for a position at a future time
04/22/23 R. Crawfis, Ohio State Univ. 139
More formally:
Given some initial front Г:
04/22/23 R. Crawfis, Ohio State Univ. 140
More formally: (2)
And a function F that specifies the velocity of the front in the normal direction:
04/22/23 R. Crawfis, Ohio State Univ. 141
More formally: (3)
Solve for Г at some future timeLevel set methods are used to track
an interfaceWater/air interface, for example
04/22/23 R. Crawfis, Ohio State Univ. 142
What’s Wrong with the Obvious Solution?
Why is a level set method necessary?
There seems to be a more intuitive way to solve this problem
04/22/23 R. Crawfis, Ohio State Univ. 143
Marker/String Methods
Why not just connect some control points (in 3D, triangulate):
04/22/23 R. Crawfis, Ohio State Univ. 144
Marker/String Methods (2)
And run the simulation on the points?
04/22/23 R. Crawfis, Ohio State Univ. 145
Ocean Waves
Think of an air/water interface with two waves racing towards each other:
04/22/23 R. Crawfis, Ohio State Univ. 146
Ocean Waves (2)
What happens to the control points when the waves collide?
04/22/23 R. Crawfis, Ohio State Univ. 147
Shocks
Event known as a ‘shock’Below formation called a
‘swallowtail’
04/22/23 R. Crawfis, Ohio State Univ. 148
Shocks (2)
How to fix up the control points?Fixing swallowtails known as ‘de-
looping’ Very difficult Some methods exist in 2D No robust 3D methods so far
04/22/23 R. Crawfis, Ohio State Univ. 149
Changing Topology
Example: two fires merge into a single fire.
04/22/23 R. Crawfis, Ohio State Univ. 150
Changing Topology
Buoys!
In particle methods:• Difficult (and expensive) to detect and change the particle chains• Much more difficult as dimensionality increases
04/22/23 R. Crawfis, Ohio State Univ. 151
Difficulties With Particle MethodsInstabilityLocal singularitiesManagement of particles: remove,
redistribute, connect
04/22/23 R. Crawfis, Ohio State Univ. 152
Level Set FormulationRecast problem with one additional dimension – the distance from the interface.
And then use Marching Cubes to extract the surface.
),(0 yxz t
04/22/23 R. Crawfis, Ohio State Univ. 153
Level Set Methods
Contour evolution method due to J. Sethian and S. Osher, 1988 www.math.berkeley.edu/~sethian/level_set.html Difficulties with snake-type methods Hard to keep track of contour if it self-
intersects during its evolution Hard to deal with changes in topology
04/22/23 R. Crawfis, Ohio State Univ. 154
The level set approach: Define problem in 1 higher dimension Define level set function z = (x,y,t=0)
where the (x,y) plane contains the contour, andz = signed Euclidean distance transform value (negative means inside closed contour, positive means outside contour)
04/22/23 R. Crawfis, Ohio State Univ. 155
How to Move the Contour?
Move the level set function, (x,y,t), so that it rises, falls, expands, etc. Contour = cross section at z = 0
04/22/23 R. Crawfis, Ohio State Univ. 156
Level Set Surface
The zero level set (in blue) at one point in time is a slice of the level set surface (in red)
04/22/23 R. Crawfis, Ohio State Univ. 157
Level Set Surface
Later in time the level set surface (red) has moved and the new zero level set (blue) defines the new contour
04/22/23 R. Crawfis, Ohio State Univ. 158
Level Set Surface
04/22/23 R. Crawfis, Ohio State Univ. 159
Level Set FormulationThe interface always lies at the zeroth level set of the function ,i.e., the interface is defined by the implicit equation t (x, y) = 0.
04/22/23 R. Crawfis, Ohio State Univ. 160
How to Move the Level Set Surface?
1. Define a velocity field, F, that specifies how contour points move in time Based on application-specific physics such as time,
position, normal, curvature, image gradient magnitude2. Build an initial value for the level set function,
(x,y,t=0), based on the initial contour position3. Adjust over time; current contour defined by
(x(t), y(t), t) = 0
0yΦ
xΦF
tΦ
0ΦFtΦ
2122
04/22/23 R. Crawfis, Ohio State Univ. 161
Speed Function εK1(k)FFF(K) 10
εK1x,ykF(K) I
x,yIG-
I
σI
σ ek
x,yIG11k
04/22/23 R. Crawfis, Ohio State Univ. 162
Example: Shape Simplification
F = 1 – 0.1 where is the curvature at each contour point
04/22/23 R. Crawfis, Ohio State Univ. 163
Example: Segmentation
Digital Subtraction Angiogram F based on image gradient and contour curvature
04/22/23 R. Crawfis, Ohio State Univ. 164
Example (cont.)
Initial contour specified manually
04/22/23 R. Crawfis, Ohio State Univ. 165
Result – segmentation using Fast marching
No level set tuning
04/22/23 R. Crawfis, Ohio State Univ. 166
Results – vein segmentation
No level set tuning With level set tuning
04/22/23 R. Crawfis, Ohio State Univ. 167
Results – vein segmentation continued
Original Our result Sethian’s result (Fast marching + (Level set only) Level set tuning)
04/22/23 R. Crawfis, Ohio State Univ. 168
Result – segmentation using Fast marching
No level set tuning
04/22/23 R. Crawfis, Ohio State Univ. 169
Results – brain segmentation continued
No level set tuning With level set tuning
04/22/23 R. Crawfis, Ohio State Univ. 170
Results – brain image segmentation
# of iterations = 9000 # of iterations = 12000 Fast marching only, no level set tuning