Iso-contour/surface Extractions Iso-Contouring and Level-Sets Roger Crawfis Contributors: Roger Crawfis, Han-Wei Shen, Raghu Machiraju, Torsten Moeller, Fan Ding, Charles Dyer, and Huang Zhiyong 3D Iso-surface 2D Iso-contour 4/17/2003 R. Crawfis, Ohio State Univ. 2 Contouring - The Problem More Formally � A scalar visualization technique that � Extracting an iso- surface from an implicit creates curves (in 2D) or surfaces (in 3D) function, that is, representing a constant scalar value � Extracting a surface from volume data across a scalar field. (discrete implicit function), f (x ,y ,z ) = T � Contour lines are called isovalue lines or isolines . � Contour surfaces are called isovalue surfaces or isosurfaces 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 3 4 Contouring a 2D structured grid with 2D Contouring – Not so easy contour line value = 5 � Annotations 1. Using interpolation to generate points along edges with the constant � Smooth Curves 0 1 1 3 2 value Topographic Map of Jerusalem (Contour interval 10 meters) 1 3 6 6 3 North is at the top of the map. The Mount of Olives is on the far right, Mount Zion on 2. Connect these points into contours the left. Mount Moriah rises as a long ridge at the south end of the City of using a few different approaches. One 3 7 9 7 3 David and continues on past the present Temple Mount, and reaches its highest of the approaches: point outside the Northern walls of the Old City, at the top of the map. 2 7 8 6 2 . Detects edge intersection . Tracks this contour as it moves across 1 2 3 4 3 http://www.skullandcrossbones.org/articles/solomontemple /solomontemple2.htm cell boundary . Repeat for all contours 4/17/2003 R. Crawfis, Ohio State Univ. 5 4/17/2003 R. Crawfis, Ohio State Univ. 6 1
Quantitative and Qualitative Divide and Conquer � In this figure, we can � Partition space into rectangular sub- actually read off any value to about three regions. 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 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 7 8 Dividing Cubes/Squares Dividing Cubes 0 1 1 3 2 � Generates Points and 1. Create a cell renders them 2. Determine if the cell is a surface cell 1 3 6 6 3 � Rendering points is 3. Subdivide surface cells to image resolution faster than polygons 4. Determine intensity or color of refined cell 3 7 9 7 3 � Principle - Divide a 5. Output a point for each remaining surface cell square until contour passes thru the cell 2 7 8 6 2 1 2 3 4 3 Iso-value=5 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 9 10 Step 3: Subdivide Surface Tracking 0 1 1 3 2 � Given function � Subdivide each cell such that the resolution is higher S(t,x,y,z) that returns than the image resolution. For example, when a 128 2 1 3 6 6 3 volume is rendered to a 512 2 image, cells containing 1 if (x,y,z) is on the surface t and 0 the contour will be divided to 4x4x4 smaller cubes. otherwise 3 7 9 7 3 � Needed: a seed voxel p that is on the surface. 2 7 8 6 2 1 2 3 4 3 Seed cell classify subdivide output points Iso-value=5 4/17/2003 R. Crawfis, Ohio State Univ. 11 4/17/2003 R. Crawfis, Ohio State Univ. 12 2
Tracking and Smooth Curves Surface Tracking Let Q be a queue of voxels. � Recall that the gradient to a scalar field is Push p onto Q normal to the isolines. Flag p as “visited” � Therefore, the curve will be towards the While Q is not empty do Pop q from Q and output it. direction perpendicular to the gradient. For each voxel v in the neighborhood of q do � Can also use the gradient to calculate If S(t, v) = 1 then If v was not visited then tangents for each point on the curve to Push v onto Q generate smooth curves. Flag it as “visited” end {while} 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 13 14 Restricted Topological Cases Not Allowed •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 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 15 16 Linear Topology Using Symmetry to Reduce to 5 � 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. Contour ambiguity: either solid or dash lines look OK 4/17/2003 R. Crawfis, Ohio State Univ. 17 4/17/2003 R. Crawfis, Ohio State Univ. 18 3
2D Iso-contour (0) 2D Iso-contour (1) Consider a simple case: one cell data set Remember bi-linear interpolation The problem of extracting an iso-contour is an inverse of value interpolation. That is: p2 p3 To know the value of P, we can first compute p4 and P =? p2 p5 p3 Given f(p0)=v0, f(p1)=v1, f(p2)=v2, f(p3)=v3 p4 P5 and then linearly interpolate P Find the point(s) P within the cell that have values p1 p0 F( p ) = C p1 p0 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 19 20 2D Iso-contour (2) 2D Iso-contouring – Step 1 We can solve the problem based on linear interpolation (1) Identify edges that contain points P that have value f(P) = C p2 (1) Identify edges that contain points P that have p3 value f(P) = C (2) Calculate the positions of P If v1 < C < v2 then the edge contains such a point v1 v2 (3) Connect the points with lines p1 p0 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 21 22 2D Iso-contouring – Step 2 2D Iso-contouring – Step 3 (2) Calculate the position of P p2 p3 Connect the points with line(s) Use linear interpolation: p1 P p2 Based on the principle of linear variation, all P = P1 + (C-v1)/(v2-v1) * (P2 – P1) the points on the line have values equal C v1 C v2 p1 p0 4/17/2003 R. Crawfis, Ohio State Univ. 23 4/17/2003 R. Crawfis, Ohio State Univ. 24 4
Inside or Outside? Contouring in 3D � Treat volume as a set of 2D slices Just a naming convention � Apply 2D Contouring algorithm on each slice. 1. If a value is smaller than the iso-value, we call it “Outside” � Or given as a set of hand-drawn contours 2. If a value is greater than the iso-value, we call it “Inside” � Stitch the slices together. p2 p3 p2 p3 - - + p1 p0 p1 p0 inside cell outside cell 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 25 26 Contour Stitching A Solution •Problem: Problem: • Given: 2 two- Given: 2 two -dimensional dimensional closed closed curves curves � Fuchs, et. al. Curve #1 has Curve #1 has m m points points � Optimization problem Curve #2 has n Curve #2 has n points points Q j � 1 stitch consists of: ⌧ 2 spans between curves Which point(s) does vertex i Which point(s) does vertex P i P i+1 ⌧ 1 contour segment i on curve one correspond to i on curve one correspond to ? � Triangles of {P i ,Q j ,P i+1 } or {Q j+1 ,P i ,Q j } on curve two? on curve two? ? ⌧ Consistent normal directions 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 27 28 Fuchs, et. al. Fuchs, et. al. � Left span � Constraints � P i Q j => go up � Each contour segment is used once and only once. � Right span (either) � If a span appears as a left span, then it must � P i+1 Q j => go down also appear as a right span. � P i Q j+1 => go down � If a span appears as a right span, then it must also appear as a left span. 4/17/2003 R. Crawfis, Ohio State Univ. 29 4/17/2003 R. Crawfis, Ohio State Univ. 30 5
Fuchs, et. al. Fuchs et. al. � This produces an acceptable surface � Graph problem (from a topological point of view) � Vertices Vij = span between Pi and Qj � No holes � Edges are constructed from a left span to � We would like an optimal one in some a right span. sense. Q j Q Q j+1 Q j j+1 � Only two valid right spans for a left span. P i P i P P i+1 i+1 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 31 32 Fuchs, et. al. Fuchs, et. al. � Organize these edges as a grid or matrix. � Acceptable graphs � Exactly one vertical arc between P i and P i+1 Q Q j � Exactly one horiz. arc between Q j and Q j+1 � Either i ⌧ indegree( V ij ) = outdegree( V ij ) = 0 P P ⌧ both > 0 • (if a right, also has to be a left) Q j P i Q j+1 P i Q j P i+1 4/17/2003 R. Crawfis, Ohio State Univ. 4/17/2003 R. Crawfis, Ohio State Univ. 33 34 Fuchs, et. al. Fuchs, et. al. � Claim: � Thereom 1: S is an acceptable surface if and only if: � An acceptable graph, S , is weakly connected. � S has one and only one horizontal arc � Lemma 2 between adjacent columns. � Only 0 or 1 vertex of S has an indegree = 2. � S has one and only one vertical arc between ⌧ E.g., Two cones touching in the center. adjacent rows. � All other vertices have indegree=1 � S is Eulerian (closed walk with every arc only � (recall indegree = outdegree) once). 4/17/2003 R. Crawfis, Ohio State Univ. 35 4/17/2003 R. Crawfis, Ohio State Univ. 36 6
Recommend
More recommend