CSE 554 Lecture 5: Contouring (faster)

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements

Nearest Neighbor Search
Advanced Iso-Surfacing Algorithms Jian Huang, CS594, Spring 2002 This set of slides are developed and used by Prof. Han-Wei Shen at Ohio State University.
INTERVAL TREE & SEGMENTATION TREE
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Lecture 3: Parallel Algorithm Design
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
Searching on Multi-Dimensional Data
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
Quadtrees Raster and vector.
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2013.
Contour Tree and Small Seed Sets for Isosurface Traversal Marc van Kreveld Rene van Oostrum Chandrajit Bajaj Valerio Pascucci Daniel R. Schikore.
Advanced Topics in Algorithms and Data Structures 1 Rooting a tree For doing any tree computation, we need to know the parent p ( v ) for each node v.
2-dimensional indexing structure
lecture 4 : Isosurface Extraction
Octree-Based Decimation of Marching Cubes Surface (1996) Raj Shekhar Elias Fayyad Roni Yagel J. Fredrick Cornhill.
I/O-Algorithms Lars Arge Spring 2009 March 3, 2009.
Fast Isocontouring For Improved Interactivity Chandrajit L. Bajaj Valerio Pascucci Daniel R. Schikore.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
Fractional Cascading and Its Applications G. S. Lueker. A data structure for orthogonal range queries. In Proc. 19 th annu. IEEE Sympos. Found. Comput.
AALG, lecture 11, © Simonas Šaltenis, Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees and.
Binary Trees Chapter 6.
Contour Trees CSE Han-Wei Shen. Level Sets Level set: Level sets is also called Isolines for n=2, isosurface for n=3, or isocontours in general.
Orthogonal Range Searching I Range Trees. Range Searching S = set of geometric objects Q = query object Report/Count objects in S that intersect Q Query.
Isosurface Extractions 2D Isocontour 3D Isosurface.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
2IL50 Data Structures Fall 2015 Lecture 9: Range Searching.
Orthogonal Range Search
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.
CSE554FairingSlide 1 CSE 554 Lecture 6: Fairing Fall 2015.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
Hierarchical Volume Rendering
AQUASUN - GLSVLSI '02April 19, AQUASUN: an adaptable 2D range index for CAD applications Michiel De Wilde Ghent University, Belgium.
DATA STRUCTURE BS(IT)3rd. Tree An Introduction By Yasir Mustafa Roll No. BS(IT) Bahauddin Zakariya University, Multan.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2015.
CSE554Contouring IISlide 1 CSE 554 Lecture 3: Contouring II Fall 2011.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2013.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
Ray Tracing Optimizations
Trees By JJ Shepherd. Introduction Last time we discussed searching and sorting in a more efficient way Divide and Conquer – Binary Search – Merge Sort.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
School of Computing Clemson University Fall, 2012
CSCE 210 Data Structures and Algorithms
Data Mining Soongsil University
Geometric Data Structures
Isosurface Extractions (II)
Data Structures & Algorithm Design
Real-Time Ray Tracing Stefan Popov.
Mean Shift Segmentation
Tonga Institute of Higher Education
Binary and Ternary Search
KD Tree A binary search tree where every node is a
Binary Trees, Binary Search Trees
CSE373: Data Structures & Algorithms Lecture 23: Applications
TREES General trees Binary trees Binary search trees AVL trees
Orthogonal Range Searching and Kd-Trees
Data Structures: Segment Trees, Fenwick Trees
Quadtrees 1.
Shmuel Wimer Bar Ilan Univ., School of Engineering
Data Structure and Algorithms
Trees.
An O(n log n)-Time Algorithm for the k-Center Problem in Trees
Continuous Density Queries for Moving Objects
Binary Trees.
Non-Linear data structures
Efficient Aggregation over Objects with Extent
Presentation transcript:

CSE 554 Lecture 5: Contouring (faster) Fall 2016

Review Iso-contours Contouring methods Points where a function evaluates to be a given value (iso-value) Smooth thresholded boundaries Contouring methods Primal methods Marching Squares (2D) and Cubes (3D) Placing vertices on grid edges Dual methods Dual Contouring (2D,3D) Placing vertices in grid cells Primal Dual

Efficiency Iso-contours are often used for visualizing (3D) medical images The data can be large (e.g, 512^3) The user often wants to change iso-values and see the result in real-time An efficient contouring algorithm is needed Optimized for viewing one volume at multiple iso-values

Marching Squares - Revisited Active cell/edge A grid cell/edge where {min, max} of its corner/end values encloses the iso- value Algorithm Visit each cell. If active, create vertices on active edges and connect them by lines Time complexity? n: the number of all grid cells k: the number of active cells 1 2 3 2 1 2 3 4 3 2 3 4 5 4 3 O(n) O(k) 2 3 4 3 2 1 2 3 2 1 O(n+k) Iso-value = 3.5

Marching Squares - Revisited Marching Squares O(n+k) Running time (seconds) Only visiting each square and checking if it is active (without creating vertices and edges) O(n) Iso-value

Speeding Up Contouring Data structures that allow faster query of active cells Quadtrees (2D), Octrees (3D) Hierarchical spatial structures for quickly pruning large areas of inactive cells Complexity: O(k*Log(n/k)) Interval trees An optimal data structure for range finding Complexity: O(k+Log(n))

Interval Trees Running time (seconds) Iso-value Marching Squares O(k+n) Running time (seconds) Quadtree O(k*Log(n/k)) Interval tree O(k+Log(n)) Iso-value

Speeding Up Contouring Data structures that allow faster query of active cells Quadtrees (2D), Octrees (3D) Hierarchical spatial structures for quickly pruning large areas of inactive cells Complexity: O(k*Log(n)) Interval trees An optimal data structure for range finding Complexity: O(k+Log(n))

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell.

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell. Iso-value not in {min,max} Iso-value in {min,max}

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell. Iso-value not in {min,max} Iso-value in {min,max}

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell. Iso-value not in {min,max} Iso-value in {min,max}

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell. Iso-value not in {min,max} Iso-value in {min,max}

Quadtrees (2D) Basic idea: coarse-to-fine search Start with the entire grid: If the {min, max} of all grid values does not enclose the iso-value, stop. Otherwise, divide the grid into four sub-grids and repeat the check within each sub-grid. If the sub-grid is a unit cell, it’s an active cell. Iso-value not in {min,max} Iso-value in {min,max}

Quadtrees (2D) A degree-4 tree Root node represents the entire image Each node represents a square part of the image: {min, max} in the square (in a non-leaf node) one child node for each quadrant of the square {1,5} Root node 1 2 3 2 3 4 Grid {1,3} {2,4} {2,4} {3,5} Level-1 nodes (leaves) Quadtree 3 4 5

Quadtrees (2D) Tree building: bottom-up {1,5} Tree building: bottom-up Each grid cell becomes a leaf node Assign a parent node to every group of 4 nodes Compute the {min, max} of the parent node from {min, max} of the children nodes Padding dummy leaf nodes (e.g., {∞,∞}) if the dimension of grid is not power of 2 Root node {1,3} {2,4} Leaf nodes {2,4} {3,5} 1 2 3 2 3 4 Grid 3 4 5

Quadtrees (2D) Tree building: a recursive algorithm // A recursive function to build a single quadtree node // for a sub-grid at corner (lowX, lowY) and with length len buildSubTree (lowX, lowY, len) If (lowX, lowY) is out of range: Return a leaf node with {∞,∞} If len = 1: Return a leaf node with {min, max} of corner values Else c1 = buildSubTree (lowX, lowY, len/2) c2 = buildSubTree (lowX + len/2, lowY, len/2) c3 = buildSubTree (lowX, lowY + len/2, len/2) c4 = buildSubTree (lowX + len/2, lowY + len/2, len/2) Return a node with children {c1,…,c4} and {min, max} of all {min, max} of these children // Building a quadtree for a grid whose longest dimension is len Return buildSubTree (1, 1, 2^Ceiling[Log[2,len]])

Quadtrees (2D) Tree-building: time complexity? Pre-computation O(n) We only need to do this once (after that, the tree can be used to speed up contouring at any iso-value)

Quadtrees (2D) Contouring with a quadtree: top-down {1,5} Contouring with a quadtree: top-down Starting from the root node If {min, max} of the node encloses the iso-value If it is not a leaf, continue onto its children If the node is a leaf, contour in that grid cell Root node iso-value = 2.5 {1,3} {2,4} {3,5} Leaf nodes 1 2 3 4 5 Grid

Quadtrees (2D) Contouring with a quadtree: a recursive algorithm // A recursive function to contour in a quadtree node // for a sub-grid at corner (lowX, lowY) and with length len ctSubTree (node, iso, lowX, lowY, len) If iso is within {min, max} of node If len = 1: do Marching Squares in this grid square Else (let the 4 children be c1,…,c4) ctSubTree (c1, iso, lowX, lowY, len/2) ctSubTree (c2, iso, lowX + len/2, lowY, len/2) ctSubTree (c3, iso, lowX, lowY + len/2, len/2) ctSubTree (c4, iso, lowX + len/2, lowY + len/2, len/2) // Contouring using a quadtree whose root node is Root // for a grid whose longest dimension is len ctSubTree (Root, iso, 1, 1, 2^Ceiling[Log[2,len]])

Quadtrees (2D) Contouring with a quadtree: time complexity? O(k*Log(n/k)) Faster than O(k+n) (Marching Squares) if k<<n But not efficient when k is large (can be as slow as O(n))

Quadtrees (2D) Running time (seconds) Iso-value Marching Squares O(n+k) Running time (seconds) Quadtree O(k*Log(n/k)) Iso-value

Quadtrees (2D): Summary Preprocessing: building the tree bottom-up Independent of iso-values Contouring: traversing the tree top-down For a specific iso-value Both are recursive algorithms

Octrees (3D) Each tree node has 8 children nodes Similar algorithms and same complexity as quadtrees

Speeding Up Contouring Data structures that allow faster query of active cells Quadtrees (2D), Octrees (3D) Hierarchical spatial structures for quickly pruning large areas of inactive cells Complexity: O(k*Log(n/k)) Interval trees An optimal data structure for range finding Complexity: O(k+Log(n))

Interval Trees Basic idea Each grid cell occupies an interval of values {min, max} An active cell’s interval intersects the iso-value Stores all intervals in a search tree for efficient intersection queries 255 Iso-value

Interval Trees A binary tree Root node: all intervals in the grid Each node maintains: δ: Median of end values of all intervals (used to split the children intervals) (in a non-leaf node) Two child nodes Left child: intervals < δ Right child: intervals > δ Two sorted lists of intervals intersecting δ Left list (AL): ascending order of min-end of each interval Right list (DR): descending order of max-end of each interval

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 δ=12 AL: d,e,f,g,h,i DR: i,e,g,h,d,f AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: AL: m DR: m δ=4 δ=10 δ=12 Intervals:

Interval Trees Intersection queries: top-down Starting with the root node If the iso-value is smaller than median δ Scan through AL: output all intervals whose min-end <= iso-value. Go to the left child. If the iso-value is larger than δ Scan through DR: output all intervals whose max-end >= iso-value. Go to the right child. If iso-value equals δ Output AL (or DR).

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 δ=12 AL: d,e,f,g,h,i DR: i,e,g,h,d,f iso-value = 9 AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: AL: m DR: m δ=4 δ=10 δ=12 Intervals:

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 δ=12 AL: d,e,f,g,h,i DR: i,e,g,h,d,f iso-value = 9 AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: AL: m DR: m δ=4 δ=10 δ=12 Intervals:

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 δ=12 AL: d,e,f,g,h,i DR: i,e,g,h,d,f iso-value = 9 AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: AL: m DR: m δ=4 δ=10 δ=12 Intervals:

Interval Trees Intersection queries: time complexity? O(k + Log(n)) Much faster than O(k+n) (Marching squares/cubes)

Interval Trees Running time (seconds) Iso-value Marching Squares O(n+k) Running time (seconds) Quadtree O(k*Log(n/k)) Interval tree O(k+Log(n)) Iso-value

Interval Trees Tree building: top-down Starting with the root node (which includes all intervals) To create a node from a set of intervals, Find δ (the median of all ends of the intervals). Sort all intervals intersecting with δ into the AL, DR Construct the left (right) child from intervals strictly below (above) δ A recursive algorithm

Interval Trees Interval tree: Intervals:

Interval Trees Interval tree: Intervals: δ=7 AL: d,e,f,g,h,i DR: i,e,g,h,d,f δ=7 Interval tree: Intervals:

Interval Trees Interval tree: Intervals: δ=7 δ=4 AL: d,e,f,g,h,i DR: i,e,g,h,d,f AL: a,b,c DR: c,a,b δ=7 Interval tree: δ=4 Intervals:

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 AL: d,e,f,g,h,i DR: i,e,g,h,d,f AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: δ=4 δ=10 Intervals:

Interval Trees Interval tree: Intervals: δ=7 δ=4 δ=10 δ=12 AL: d,e,f,g,h,i DR: i,e,g,h,d,f AL: a,b,c DR: c,a,b AL: j,k,l DR: l,j,k δ=7 Interval tree: AL: m DR: m δ=4 δ=10 δ=12 Intervals:

Interval Trees Tree building: time complexity? O(n*Log(n)) O(n) at each level of the tree (after pre-sorting all intervals in O(n*Log(n))) Depth of the tree is O(Log(n))

Interval Trees: Summary Preprocessing: building the tree top-down Independent of iso-values Contouring: traversing the tree top-down For a specific iso-value Both are recursive algorithms

Further Readings Quadtree/Octrees: Interval trees: “Octrees for Faster Isosurface Generation”, Wilhelms and van Gelder (1992) Interval trees: “Dynamic Data Structures for Orthogonal Intersection Queries”, by Edelsbrunner (1980) “Speeding Up Isosurface Extraction Using Interval Trees”, by Cignoni et al. (1997)

Further Readings Other acceleration techniques: “Fast Iso-contouring for Improved Interactivity”, by Bajaj et al. (1996) Growing connected component of active cells from pre-computed seed locations “View Dependent Isosurface Extraction”, by Livnat and Hansen (1998) Culling invisible mesh parts “Interactive View-Dependent Rendering Of Large Isosurfaces”, by Gregorski et al. (2002) Level-of-detail: decreasing mesh resolution based on distance from the viewer Livnat and Hansen Gregorski et al.