Presentation is loading. Please wait.

Presentation is loading. Please wait.

Iso-Contouring and Level-Sets

Similar presentations


Presentation on theme: "Iso-Contouring and Level-Sets"— Presentation transcript:

1 Iso-Contouring and Level-Sets
Roger Crawfis Contributors: Roger Crawfis, Han-Wei Shen, Raghu Machiraju, Torsten Moeller, Huang Zhiyong, Fan Ding, and Charles Dyer

2 Iso-contour/surface Extractions
2D Iso-contour 3D Iso-surface 11/21/2018 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 ,z ) = T 11/21/2018 R. Crawfis, Ohio State Univ.

4 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

5 Contouring a 2D structured grid with contour line value = 5
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 11/21/2018 R. Crawfis, Ohio State Univ.

6 2D Contouring – Not so easy
Annotations Smooth 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. 11/21/2018 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. 11/21/2018 R. Crawfis, Ohio State Univ.

8 R. Crawfis, Ohio State Univ.
Divide and Conquer Partition space into rectangular sub-regions. 11/21/2018 R. Crawfis, Ohio State Univ.

9 Dividing Cubes/Squares
1 1 3 2 Generates Points and renders them Rendering points is faster than polygons Principle - Divide a square until contour passes thru the cell 1 3 6 6 3 3 7 9 7 3 2 7 8 6 2 1 2 3 4 3 Iso-value=5 11/21/2018 R. Crawfis, Ohio State Univ.

10 R. Crawfis, Ohio State Univ.
Dividing Cubes 1. Create a cell 2. Determine if the cell is a surface cell 3. Subdivide surface cells to image resolution 4. Determine intensity or color of refined cell 5. Output a point for each remaining surface cell 11/21/2018 R. Crawfis, Ohio State Univ.

11 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

12 R. Crawfis, Ohio State Univ.
Surface Tracking 1 1 3 2 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 3 6 6 3 3 7 9 7 3 2 7 8 6 2 1 2 3 4 3 Seed cell Iso-value=5 11/21/2018 R. Crawfis, Ohio State Univ.

13 R. Crawfis, Ohio State Univ.
Surface Tracking Let Q be a queue of cells. Push p onto Q Flag 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 do If S(t, v) = 1 then If v was not visited then Push v onto Q Flag it as “visited” end {while} 11/21/2018 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. 11/21/2018 R. Crawfis, Ohio State Univ.

15 Restricted Topological Cases
A closed curve can not be contained in the cell. The curve can only enter and exit the cell once per edge. Filled circle vertices indicate scalar value is above the contour value Unfilled ones which scalar values are below the contour values 11/21/2018 R. Crawfis, Ohio State Univ.

16 R. Crawfis, Ohio State Univ.
Not Allowed 11/21/2018 R. Crawfis, Ohio State Univ.

17 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

18 Using Symmetry to Reduce to 5
Contour ambiguity: either solid or dash lines look OK 11/21/2018 R. Crawfis, Ohio State Univ.

19 R. Crawfis, Ohio State Univ.
2D Iso-contour (0) Remember bi-linear interpolation p2 p3 To know the value of P, we can first compute p4 and P5 and then linearly interpolate P P =? p4 p5 p1 p0 11/21/2018 R. Crawfis, Ohio State Univ.

20 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

21 R. Crawfis, Ohio State Univ.
2D Iso-contour (2) We can solve the problem based on linear interpolation p2 p3 p0 p1 (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 11/21/2018 R. Crawfis, Ohio State Univ.

22 2D Iso-contouring – Step 1
(1) Identify edges that contain points P that have value f(P) = C If v1 < C < v2 then the edge contains such a point v1 v2 11/21/2018 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 P p1 p2 C 11/21/2018 R. Crawfis, Ohio State Univ.

24 2D Iso-contouring – Step 3
Connect the points with line(s) p2 p3 p0 p1 Based on the principle of linear variation, all the points on the line have values equal C 11/21/2018 R. Crawfis, Ohio State Univ.

25 R. Crawfis, Ohio State Univ.
Inside or Outside? Just a naming convention If a value is smaller than the iso-value, we call it “Outside” If a value is greater than the iso-value, we call it “Inside” p2 p3 p0 p1 - + inside cell outside cell 11/21/2018 R. Crawfis, Ohio State Univ.

26 R. Crawfis, Ohio State Univ.
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 contours Stitch the slices together. 11/21/2018 R. Crawfis, Ohio State Univ.

27 R. Crawfis, Ohio State Univ.
Contour Stitching Problem: Given: 2 two-dimensional closed curves Curve #1 has m points Curve #2 has n points Which point(s) does vertex i on curve one correspond to on curve two? i ? ? 11/21/2018 R. Crawfis, Ohio State Univ.

28 R. Crawfis, Ohio State Univ.
A Solution Fuchs, et. al. Optimization problem 1 stitch consists of: 2 spans between curves 1 contour segment Triangles of {Pi,Qj,Pi+1} or {Qj+1,Pi,Qj} Consistent normal directions Qj Pi Pi+1 11/21/2018 R. Crawfis, Ohio State Univ.

29 R. Crawfis, Ohio State Univ.
Fuchs, et. al. Left span PiQj => go up Right span (either) Pi+1Qj => go down PiQj+1 => go down 11/21/2018 R. Crawfis, Ohio State Univ.

30 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

31 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

32 R. Crawfis, Ohio State Univ.
Fuchs et. al. Graph problem Vertices Vij = span between Pi and Qj Edges are constructed from a left span to a right span. Only two valid right spans for a left span. Pi Qj Qj+1 Pi+1 11/21/2018 R. Crawfis, Ohio State Univ.

33 R. Crawfis, Ohio State Univ.
Fuchs, et. al. Organize these edges as a grid or matrix. Q j i P QjPiQj+1 PiQjPi+1 11/21/2018 R. Crawfis, Ohio State Univ.

34 R. Crawfis, Ohio State Univ.
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) = 0 both > 0 (if a right, also has to be a left) 11/21/2018 R. Crawfis, Ohio State Univ.

35 R. Crawfis, Ohio State Univ.
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) 11/21/2018 R. Crawfis, Ohio State Univ.

36 R. Crawfis, Ohio State Univ.
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). 11/21/2018 R. Crawfis, Ohio State Univ.

37 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

38 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

39 R. Crawfis, Ohio State Univ.
Marching Cubes Predominant method used today. Efficient and simple It was independently reported by Wyvill and McPeeters in 1986, Lorenson and Cline in 1987 11/21/2018 R. Crawfis, Ohio State Univ.

40 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

41 R. Crawfis, Ohio State Univ.
Marching Cubes Consider a single cube All vertices above the contour threshold All vertices below Mixed above and below + - 11/21/2018 R. Crawfis, Ohio State Univ.

42 R. Crawfis, Ohio State Univ.
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. + - 11/21/2018 R. Crawfis, Ohio State Univ.

43 R. Crawfis, Ohio State Univ.
How many cases? Now we have 8 vertices So it is: 2 = 256 8 How many unique topological cases? 11/21/2018 R. Crawfis, Ohio State Univ.

44 R. Crawfis, Ohio State Univ.
Case Reduction Value Symmetry + _ 11/21/2018 R. Crawfis, Ohio State Univ.

45 R. Crawfis, Ohio State Univ.
Case Reduction Rotation Symmetry + _ 11/21/2018 R. Crawfis, Ohio State Univ.

46 R. Crawfis, Ohio State Univ.
Case Reduction Mirror Symmetry + _ By inspection, we can reduce 11/21/2018 R. Crawfis, Ohio State Univ.

47 Marching Cube - Summary
Create a cube Classify each voxel Build an index Lookup edge list Interpolate triangle vertices Calculate and interpolate normals 11/21/2018 R. Crawfis, Ohio State Univ.

48 R. Crawfis, Ohio State Univ.
Step 1: Create a Cube Consider a cube defined by eight data values: four from slice K, and four from slice K+ 1 11/21/2018 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). 11/21/2018 R. Crawfis, Ohio State Univ.

50 R. Crawfis, Ohio State Univ.
Step 3: Build an Index Use the binary labeling of each voxel to create an 8-bit index: 8 vertices cases Requires a canonical ordering of the cube. 11/21/2018 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 Index intersection edges e1, e3, e5 1 2 e7 3 e11 e8 e12 e6 e3 e5 e4 e2 e9 e10 14 e1 11/21/2018 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. 11/21/2018 R. Crawfis, Ohio State Univ.

53 R. Crawfis, Ohio State Univ.
Step 4: Example Index = triangle 1 = e4,e7,e12 triangle 2 = e1, e7, e4 triangle 3 = e1, e6, e7 triangle 4 = e1, e10, e6 e7 v7 e12 e6 e4 e10 v1 e1 v2 e2 11/21/2018 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. 11/21/2018 R. Crawfis, Ohio State Univ.

55 R. Crawfis, Ohio State Univ.
Step 6: Compute Normals Calculate the normal at each cube vertex Use linear interpolation to interpolate the polygon vertex normal 11/21/2018 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 information is required!!! 11/21/2018 R. Crawfis, Ohio State Univ.

57 R. Crawfis, Ohio State Univ.
Problems Ambiguities: Are the curves below right or wrong? 11/21/2018 R. Crawfis, Ohio State Univ.

58 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

59 2D Contouring Ambiguity
Either choice is acceptable because contour lines are continuous and closed Independent of other choices or Join contour Break contour 11/21/2018 R. Crawfis, Ohio State Univ.

60 R. Crawfis, Ohio State Univ.
Marching Cubes Topological inconsistencies in the 15 cases Turns out positive and negative are not symmetric. + + + + + - - - - - + - + 11/21/2018 + 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. 11/21/2018 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 3 Case 6 (compliment symmetry) 11/21/2018 R. Crawfis, Ohio State Univ.

63 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

64 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

65 R. Crawfis, Ohio State Univ.
Asymptotic Decider Based on bilinear interpolation over faces B01 B11 (s,t) B00 B01 B10 B11 1-t t B(s,t) = (1-s, s) The contour curves of B: {(s,t) | B(s,t) = a } are hyperbolas B00 B10 11/21/2018 R. Crawfis, Ohio State Univ.

66 R. Crawfis, Ohio State Univ.
Asymptotic Decider (2) (1,1) (0,0) Where the hyperbolas go through the cell depends on the values at the corners, I.e., B00, B01, B10, B11 11/21/2018 R. Crawfis, Ohio State Univ.

67 R. Crawfis, Ohio State Univ.
Asymptotic Decider (3) (1,1) (Sa, Ta) If a < B(Sa, Ta) (0,0) Asymptote 11/21/2018 R. Crawfis, Ohio State Univ.

68 R. Crawfis, Ohio State Univ.
Asymptotic Decider (4) (1,1) (Sa, Ta) If a > B(Sa, Ta) (0,0) Asymptote 11/21/2018 R. Crawfis, Ohio State Univ.

69 R. Crawfis, Ohio State Univ.
Asymptotic Decider (5) (1,1) (Sa, Ta) Sa = B00 - B01 B00 + B11 – B01 – B10 Ta= B00 – B10 B(Sa,Ta) = B00 B11 + B10 B01 (0,0) 11/21/2018 R. Crawfis, Ohio State Univ.

70 R. Crawfis, Ohio State Univ.
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). 11/21/2018 R. Crawfis, Ohio State Univ.

71 R. Crawfis, Ohio State Univ.
Marching Cubes Demo Animating the contour value Special functions for contouring Varying speeds and numbers of triangles 11/21/2018 R. Crawfis, Ohio State Univ.

72 R. Crawfis, Ohio State Univ.
Marching Cubes Data Structures/Tables static 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 */ ... 11/21/2018 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 */ 11/21/2018 R. Crawfis, Ohio State Univ.

74 Iso-Contouring – Advanced Issues
Efficiently determining which cells to examine. Using iso-contouring as a slicing mechanism Iso-contouring in higher dimensions Texturing and coloring of iso-contours Polygonal simplification of contours. Choosing a good iso-value 11/21/2018 R. Crawfis, Ohio State Univ.

75 Iso-surface cell search
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. 11/21/2018 R. Crawfis, Ohio State Univ.

76 R. Crawfis, Ohio State Univ.
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 n n 11/21/2018 R. Crawfis, Ohio State Univ.

77 R. Crawfis, Ohio State Univ.
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. 11/21/2018 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} 11/21/2018 R. Crawfis, Ohio State Univ.

79 Efficient search methods
Spatial subdivision (domain search) Value subdivision (range search) Contour propagation 11/21/2018 R. Crawfis, Ohio State Univ.

80 R. Crawfis, Ohio State Univ.
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) ) 11/21/2018 R. Crawfis, Ohio State Univ.

81 R. Crawfis, Ohio State Univ.
Span Space High Gradient Low Gradient Threshold Maximum Minimum 11/21/2018 R. Crawfis, Ohio State Univ.

82 R. Crawfis, Ohio State Univ.
Span Space max Possible candidates 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. v v min 11/21/2018 R. Crawfis, Ohio State Univ.

83 R. Crawfis, Ohio State Univ.
Span Space max 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. v min 11/21/2018 R. Crawfis, Ohio State Univ.

84 R. Crawfis, Ohio State Univ.
Span Space max Can easily get the set of cells with maximum greater than the iso-value. Need the intersection of the two sets. Not very efficient. v v min 11/21/2018 R. Crawfis, Ohio State Univ.

85 Span Space - Active List
max Given: iso-value v and maximum cell range, r gracefully update to new value nv nv+r v+r nv v v-r v nv nv-r min 11/21/2018 R. Crawfis, Ohio State Univ.

86 Span Space – NOISE Algorithm
K-d Trees Maximum Split Min. axis Split Max. axis Minimum 11/21/2018 R. Crawfis, Ohio State Univ.

87 R. Crawfis, Ohio State Univ.
Span Space Search Method (2): ISSUE, discretized span space O(log(N/L)) O(1) Complexity = ? ? O(log(N/L)) 11/21/2018 R. Crawfis, Ohio State Univ.

88 Range Search: Interval Tree
Sort all the data points (x1,x2,x3,x4,…. , xn) Let d = x (mid point) n/2 Id I left I right We use d to divide the cells into three sets Id, I left, and I right Id : cells that have min < d < max I left: cells that have max < d I right: cells that have min > d 11/21/2018 R. Crawfis, Ohio State Univ.

89 R. Crawfis, Ohio State Univ.
Contour Propagation Basic Idea: Given an initial cell that contains iso-surface, the remainder of the iso-surface can be found by propagation FIFO Queue A B C C C D …. Initial cell: A Enqueue: B, C Dequeue: B Enqueue: D A B D C E Breadth-First Search 11/21/2018 R. Crawfis, Ohio State Univ.

90 R. Crawfis, Ohio State Univ.
Challenges Need to know the initial cells! For any given iso-value C, finding the initial cells to start the propagation is almost as hard as finding the iso-surface cells. You could do a global search, but … 11/21/2018 R. Crawfis, Ohio State Univ.

91 R. Crawfis, Ohio State Univ.
Solutions Extrema Graph (Itoh vis’95) 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 smaller than G. We will only talk about extrema graph due to time constraint 11/21/2018 R. Crawfis, Ohio State Univ.

92 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

93 R. Crawfis, Ohio State Univ.
Extrema Graph (2) 11/21/2018 R. Crawfis, Ohio State Univ.

94 R. Crawfis, Ohio State Univ.
Extrema Graph (3) Extreme Graph: { E, A: E: extrema points A: Arcs conneccts E } E1 E2 a1 a2 a3 E3 E4 a5 An ‘arc’ consists of cells that connect extrema points (we only store min/max of the arc though) a4 E7 a7 E5 a6 E6 E8 11/21/2018 R. Crawfis, Ohio State Univ.

95 R. Crawfis, Ohio State Univ.
Extrema Graph (4) Algorithm: Given an iso-value Search the arcs of the extrema graph (to find the arcs that have min/max values that contain the iso-value Walk through the cells along each of these arcs to find the seed cells Start the iso-contour propagation from the seed cells …. There is something more that needs to be done… 11/21/2018 R. Crawfis, Ohio State Univ.

96 R. Crawfis, Ohio State Univ.
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) 11/21/2018 R. Crawfis, Ohio State Univ.

97 R. Crawfis, Ohio State Univ.
Extrema Graph (5) Boundary Cells!! Contours missed These open iso-contours will intersect with ?? cells 11/21/2018 R. Crawfis, Ohio State Univ.

98 R. Crawfis, Ohio State Univ.
Extrema Graph (6) Algorithm (continued) Given an iso-value: Search the arcs of the extrema graph (to find the arcs that have min/max values that contain the iso-value. Walk through the cells along each of the arcs to find the seed cells. Start the iso-contour propagation from the seed cells. Search the cells along the boundary and find additional seed cells. Propagate from these new seed cells for the open iso-contours. 11/21/2018 R. Crawfis, Ohio State Univ.

99 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

100 R. Crawfis, Ohio State Univ.
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. 11/21/2018 R. Crawfis, Ohio State Univ.

101 R. Crawfis, Ohio State Univ.
Selecting iso-values Which 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. 11/21/2018 R. Crawfis, Ohio State Univ.

102 R. Crawfis, Ohio State Univ.
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, a. Present these functions to the user as an aid in picking contour values. These slides are from Baja, Pascucci and Schikore (IEEE Visualization 1997) 11/21/2018 R. Crawfis, Ohio State Univ.

103 R. Crawfis, Ohio State Univ.
Outline User Interface Signature Computation Real Time Quantitative Queries Rule-based Contouring Topological Information Future Directions 11/21/2018 R. Crawfis, Ohio State Univ. 2 2 2 2

104 Graphical User Interface for Static Data
The horizontal axis spans the scalar values a Plot of a set of signatures (length, area, gradient ...) as functions of the scalar value a. Vertical axis spans normalized ranges of each signature. White vertical bars mark current selected isovalues. 11/21/2018 R. Crawfis, Ohio State Univ.

105 Graphical User Interface for time varying data
high (,t ) --> c The color, c, is mapped to the magnitude of a signature function of time, t, and isovalue  c magnitude t low The horizontal axis spans the scalar value dimension . The vertical axis spans the time dimension t . 11/21/2018 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. 11/21/2018 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 11/21/2018 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. 11/21/2018 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 11/21/2018 R. Crawfis, Ohio State Univ.

110 Real Time Quantitative Queries (agricultural yield data)
size and position of the region with unsatisfactory production size and position of the region where wrong data acquisition occurred Spectrum space is a useful space to visualize by itself. 11/21/2018 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. 11/21/2018 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. 11/21/2018 R. Crawfis, Ohio State Univ.

113 Topological information.
number of components per isocontour which isocontours merge together or split while modifying the isovalue. } an isocontour with three connected components two of which are about to merge 11/21/2018 R. Crawfis, Ohio State Univ.

114 R. Crawfis, Ohio State Univ.
Other Topics Interval Volumes 4D Iso-contouring Smooth surfaces Polygon Reduction Triangle Strip generation Time-varying iso-contours Texture map parameterization Penny Rheingans 11/21/2018 R. Crawfis, Ohio State Univ.

115 Level Sets Roger Crawfis
Slides collected from: Fan Ding, Charles Dyer, Donald Tanguay, Theodore Kim and Roger Crawfis

116 R. Crawfis, Ohio State Univ.
Motivation: 11/21/2018 R. Crawfis, Ohio State Univ.

117 Easy Case – Use Marching Cubes
11/21/2018 R. Crawfis, Ohio State Univ.

118 R. Crawfis, Ohio State Univ.
Input Data Noisy 11/21/2018 R. Crawfis, Ohio State Univ.

119 R. Crawfis, Ohio State Univ.
Non-uniform Exposure 11/21/2018 R. Crawfis, Ohio State Univ.

120 R. Crawfis, Ohio State Univ.
Intensity Varies 11/21/2018 R. Crawfis, Ohio State Univ.

121 R. Crawfis, Ohio State Univ.
Multiple problems 11/21/2018 R. Crawfis, Ohio State Univ.

122 Applying Marching Cubes (thresholding)
11/21/2018 R. Crawfis, Ohio State Univ.

123 R. Crawfis, Ohio State Univ.
Applying A Threshold 11/21/2018 R. Crawfis, Ohio State Univ.

124 R. Crawfis, Ohio State Univ.
Applying A Threshold 11/21/2018 R. Crawfis, Ohio State Univ.

125 R. Crawfis, Ohio State Univ.
Four (contour) Levels 11/21/2018 R. Crawfis, Ohio State Univ.

126 R. Crawfis, Ohio State Univ.
What To Do? User Intervention!!! We see it!! It’s right there!!! Well, the edges get pretty fuzzy . Two step process: Draw an initial curve (or surface) within the desired region. Expand that interface outward towards the edge of our desired region. 11/21/2018 R. Crawfis, Ohio State Univ.

127 R. Crawfis, Ohio State Univ.
Interfaces An interface (or front) is a boundary between two regions: “inside” and “outside.” In 2-D, an interface is a simple closed curve: 11/21/2018 R. Crawfis, Ohio State Univ.

128 Propagating Interfaces
How does an interface evolve over time? At a specific moment, the speed function F (L, G, I) describes the motion of the interface in the normal direction. 11/21/2018 R. Crawfis, Ohio State Univ.

129 Propagating Interfaces
Speed F(L,G,I) is a function of 3 types of properties: 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) 11/21/2018 R. Crawfis, Ohio State Univ.

130 Motion Under Curvature
Example: Motion by curvature. Each piece moves perpendicular to the curve with speed proportional to the local curvature. small negative motion large positive motion 11/21/2018 R. Crawfis, Ohio State Univ.

131 Motion Under Curvature
Curvature κ is the inverse of the radius r of the osculating circle. 11/21/2018 R. Crawfis, Ohio State Univ.

132 Motion Under Curvature
11/21/2018 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: 11/21/2018 R. Crawfis, Ohio State Univ.

134 Functional Representation
However, many simple shapes are multivalued; they are not functions regardless of the orientation of the coordinate system. 11/21/2018 R. Crawfis, Ohio State Univ.

135 Parametric Representation
Spatially 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 the speed in normal direction. Normal is perpendicular to curve, as is curvature. 11/21/2018 R. Crawfis, Ohio State Univ.

136 Parametric Representation
For motion under curvature, speed F depends only on local curvature κ – the equation of motion is thus: where curvature is and the normal is 11/21/2018 R. Crawfis, Ohio State Univ.

137 R. Crawfis, Ohio State Univ.
Particle Methods In 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. = time step = parameterization step = # mesh particles Δs = location of point iΔs at time nΔt 11/21/2018 R. Crawfis, Ohio State Univ.

138 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

139 R. Crawfis, Ohio State Univ.
More formally: Given some initial front Г: That symbol is a gamma 11/21/2018 R. Crawfis, Ohio State Univ.

140 R. Crawfis, Ohio State Univ.
More formally: (2) And a function F that specifies the velocity of the front in the normal direction: 11/21/2018 R. Crawfis, Ohio State Univ.

141 R. Crawfis, Ohio State Univ.
More formally: (3) Solve for Г at some future time Level set methods are used to track an interface Water/air interface, for example 11/21/2018 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 11/21/2018 R. Crawfis, Ohio State Univ.

143 Marker/String Methods
Why not just connect some control points (in 3D, triangulate): 11/21/2018 R. Crawfis, Ohio State Univ.

144 Marker/String Methods (2)
And run the simulation on the points? 11/21/2018 R. Crawfis, Ohio State Univ.

145 R. Crawfis, Ohio State Univ.
Ocean Waves Think of an air/water interface with two waves racing towards each other: 11/21/2018 R. Crawfis, Ohio State Univ.

146 R. Crawfis, Ohio State Univ.
Ocean Waves (2) What happens to the control points when the waves collide? 11/21/2018 R. Crawfis, Ohio State Univ.

147 R. Crawfis, Ohio State Univ.
Shocks Event known as a ‘shock’ Below formation called a ‘swallowtail’ 11/21/2018 R. Crawfis, Ohio State Univ.

148 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

149 R. Crawfis, Ohio State Univ.
Changing Topology Example: two fires merge into a single fire. 11/21/2018 R. Crawfis, Ohio State Univ.

150 R. Crawfis, Ohio State Univ.
Changing Topology In particle methods: Difficult (and expensive) to detect and change the particle chains Much more difficult as dimensionality increases Buoys! 11/21/2018 R. Crawfis, Ohio State Univ.

151 Difficulties With Particle Methods
Instability Local singularities Management of particles: remove, redistribute, connect 11/21/2018 R. Crawfis, Ohio State Univ.

152 R. Crawfis, Ohio State Univ.
Level Set Formulation Recast problem with one additional dimension – the distance from the interface. And then use Marching Cubes to extract the surface. 11/21/2018 R. Crawfis, Ohio State Univ.

153 R. Crawfis, Ohio State Univ.
Level Set Methods Contour evolution method due to J. Sethian and S. Osher, 1988 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 11/21/2018 R. Crawfis, Ohio State Univ.

154 R. Crawfis, Ohio State Univ.
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, and z = signed Euclidean distance transform value (negative means inside closed contour, positive means outside contour) 11/21/2018 R. Crawfis, Ohio State Univ.

155 R. Crawfis, Ohio State Univ.
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 11/21/2018 R. Crawfis, Ohio State Univ.

156 R. Crawfis, Ohio State Univ.
Level Set Surface The zero level set (in blue) at one point in time is a slice of the level set surface (in red) 11/21/2018 R. Crawfis, Ohio State Univ.

157 R. Crawfis, Ohio State Univ.
Level Set Surface Later in time the level set surface (red) has moved and the new zero level set (blue) defines the new contour 11/21/2018 R. Crawfis, Ohio State Univ.

158 R. Crawfis, Ohio State Univ.
Level Set Surface 11/21/2018 R. Crawfis, Ohio State Univ.

159 R. Crawfis, Ohio State Univ.
Level Set Formulation The 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. 11/21/2018 R. Crawfis, Ohio State Univ.

160 How to Move the Level Set Surface?
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 magnitude Build an initial value for the level set function, (x,y,t=0), based on the initial contour position Adjust  over time; current contour defined by (x(t), y(t), t) = 0 11/21/2018 R. Crawfis, Ohio State Univ.

161 R. Crawfis, Ohio State Univ.
Speed Function 11/21/2018 R. Crawfis, Ohio State Univ.

162 Example: Shape Simplification
F = 1 – 0.1 where  is the curvature at each contour point 11/21/2018 R. Crawfis, Ohio State Univ.

163 Example: Segmentation
Digital Subtraction Angiogram F based on image gradient and contour curvature 11/21/2018 R. Crawfis, Ohio State Univ.

164 R. Crawfis, Ohio State Univ.
Example (cont.) Initial contour specified manually 11/21/2018 R. Crawfis, Ohio State Univ.

165 Result – segmentation using Fast marching
No level set tuning 11/21/2018 R. Crawfis, Ohio State Univ.

166 Results – vein segmentation
No level set tuning With level set tuning 11/21/2018 R. Crawfis, Ohio State Univ.

167 Results – vein segmentation continued
Original Our result Sethian’s result (Fast marching (Level set only) Level set tuning) 11/21/2018 R. Crawfis, Ohio State Univ.

168 Result – segmentation using Fast marching
No level set tuning 11/21/2018 R. Crawfis, Ohio State Univ.

169 Results – brain segmentation continued
No level set tuning With level set tuning 11/21/2018 R. Crawfis, Ohio State Univ.

170 Results – brain image segmentation
# of iterations = # of iterations = Fast marching only, no level set tuning 11/21/2018 R. Crawfis, Ohio State Univ.


Download ppt "Iso-Contouring and Level-Sets"

Similar presentations


Ads by Google