advanced iso-surfacing algorithms

57
Advanced Iso- Surfacing Algorithms Mengxia Zhu, Fall 2007

Upload: brenden-duncan

Post on 02-Jan-2016

43 views

Category:

Documents


1 download

DESCRIPTION

Advanced Iso-Surfacing Algorithms. Mengxia Zhu, Fall 2007. 2D Contour Display. Common method for displaying a result across a surface Contour lines: represent a constant value across the surface. 9000 ft. 10000 ft. 8000 ft. Topographic Map. Weather Map. 2D Contour Lines. p5. p4. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Advanced Iso-Surfacing Algorithms

Advanced Iso-Surfacing Algorithms

Mengxia Zhu,

Fall 2007

Page 2: Advanced Iso-Surfacing Algorithms

2D Contour Display Common method for displaying a result across a

surface Contour lines: represent a constant value across

the surface

10000 ft 9000 ft

8000 ft

Topographic Map Weather Map

2D Contour Lines

Page 3: Advanced Iso-Surfacing Algorithms

2D 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

Page 4: Advanced Iso-Surfacing Algorithms

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

Page 5: Advanced Iso-Surfacing Algorithms

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

Page 6: Advanced Iso-Surfacing Algorithms

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

Page 7: Advanced Iso-Surfacing Algorithms

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

Page 8: Advanced Iso-Surfacing Algorithms

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

Page 9: Advanced Iso-Surfacing Algorithms

Cases of 2D Cells (Squares)

case 0 case 1 case 2 case 3 case 4 case 5 case 6 case 7

case 8 case 9 case 10 case 11 case 12 case 13 case 14 case 15

By complementary and rotational symmetries, the number of the basic cases is reduced to 4

Page 10: Advanced Iso-Surfacing Algorithms

Inside or Outside?

Just a naming convention

1. If a value is smaller than the iso-value, we call it “Inside”2. If a value is greater than the iso-value, we call it “Outside”

p2 p3

p0 p1- +

outside cell

p2 p3

p0 p1-

inside cell

Page 11: Advanced Iso-Surfacing Algorithms

3D Iso-surface Example

Page 12: Advanced Iso-Surfacing Algorithms

How many cases for 3D?

Now we have 8 vertices

So it is: 2 = 2568

How many unique topological cases?

Page 13: Advanced Iso-Surfacing Algorithms

Case Reduction (1)

Value Symmetry

+

+

_ _

_

__

_

+

+

_

_

+

+

+

+

Page 14: Advanced Iso-Surfacing Algorithms

Case Reduction (2)

Rotation Symmetry

+

+

_ _

_

__

__

_

+

+

_ _

__

By inspection, we can reduce 256 14

Page 15: Advanced Iso-Surfacing Algorithms

Iso-surface Cases

Total number of cases: 14 + 1

Page 16: Advanced Iso-Surfacing Algorithms

Marching Cubes Algorithm(1)

A Divide-and-Conquer Algorithm

v1 v2

v3v4

v5v6

v7v8 Vi is ‘1’ or ‘0’ (one bit) 1: > C; 0: <C (C= iso-value)

Each cell has an index mapped to a value ranged [0,255]

Index = v8 v7 v6 v5 v4 v3 v2 v1

Page 17: Advanced Iso-Surfacing Algorithms

Marching Cubes (2)Given the index for each cell, a table lookup is performedto identify the edges that has intersections with the iso-surface

0

1

2

3

14

e1, e3, e5…

Index intersection edges

e1

e2

e3

e4

e5

e6

e7

e8

e9 e10

e11 e12

Pre-defined look-up table enumerates a) how many triangles will make up the isosurface segment passing through the cubeb) which edges of the cubes contain vertices of triangles, and in what order

Page 18: Advanced Iso-Surfacing Algorithms

Marching Cubes (3)

+

+

+

+ _

_

_

_• Perform linear interpolations at the edges to calculate the intersection points

• Connect the points

Page 19: Advanced Iso-Surfacing Algorithms

Interpolation of Triangle Vertices For each triangle, find an vertex location along the edge using

linear interpolation of the values at the edge’s two end points

x x(i) fac xy y(i) fac yzz(i) fac z

where( )

( 1) ( )isoS S i

facS i S i

10

40

0

30

30

10 20

20

(x(i) a /2,y(i),z(i))

(x(i),y(i) a /4,z(i))

(x(i),y(i),z(i) a /4)

t3 =

t8 =

t4 =t3

t4

t8

Vertices of triangle

a

Page 20: Advanced Iso-Surfacing Algorithms

Why is it called marching cubes?

Linear search through cells •Row by row, layer by layer•Reuse the interpolated points for adjacent cells

Page 21: Advanced Iso-Surfacing Algorithms

Steps in Marching Cubes

Select a cell

Classify the inside/outside state of each vertex

Create an index

Get edge list from table

Interpolate the edge location

Go to the next cell

Page 22: Advanced Iso-Surfacing Algorithms

Marching Cubes at various Isovalues

www.erc.msstate.edu

Page 23: Advanced Iso-Surfacing Algorithms

Dividing Cubes Algorithm Generate isosurface using dense cloud points Use point primitive instead of triangles in MC Conditions:

Large number of points Density of points>= screen resolution Lighting and shading calculation

H. Cline, W. Lorensen, S. Ludke, C. Crawford, and B. Teeter, “Two algorithms for the three-dimesnional reconstruction of tomographs” Medical Physics, vol. 15, no. 3, May 1988

Page 24: Advanced Iso-Surfacing Algorithms

Find Intersecting Voxel Select a voxel (cell) and determine

whether the isosurface passes through it Whether there are scalar values at vertices

both above and below the iso-value

Inside isosurface

Page 25: Advanced Iso-Surfacing Algorithms

Subdivide Voxel The voxel is subdivided into a regular grid of n1 n2

n3 subvoxels ni = wi /R, where R is screen resolution and wi is width of the

voxel

zy

x n2

n3

n1

Page 26: Advanced Iso-Surfacing Algorithms

Generate Points Scalar values at the subpoints

are generated using the interpolation function

Find whether the isosurface passes through each sub-voxel

If it does, generate a point at the center of the subvoxel and compute its normal

Collection of all such points compose the Dividing Cubes’ isosurface

Page 27: Advanced Iso-Surfacing Algorithms

Recursive Implementation Recursively divide the voxel as in

octree decomposition

Scalar values at the new points are interpolated

Process repeats for each sub-voxel if the isosurface passes through it

This process continues until the size of the subvoxel =< R

A point is generated at the center of the sub-voxel

Hierarchy of spatial subdivisions to form an octree

Page 28: Advanced Iso-Surfacing Algorithms

Dividing Squares’ Contour

Page 29: Advanced Iso-Surfacing Algorithms

Dividing Cubes’ Image

Image of human head Image with voxel subdivision into 4x4x4 cubeswww.cs.umbc.edu

Page 30: Advanced Iso-Surfacing Algorithms

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

Page 31: Advanced Iso-Surfacing Algorithms

Iso-surface Cells

For a given iso-value, only a smaller portion of cells are iso-surface cell.

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

Page 32: Advanced Iso-Surfacing Algorithms

Efficient iso-surface cell search

Problem statement:

Given a scalar field with N cells, c1, c2, …,

cn, with min-max ranges (a1,b1), (a2,b2), …,

(an, bn)

Find {Ck | ak < C < bk; C=iso-value}

Page 33: Advanced Iso-Surfacing Algorithms

Efficient search methods

1. Spatial subdivision (domain search)

2. Value subdivision (range search)

3. Contour propagation

Page 34: Advanced Iso-Surfacing Algorithms

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(Klog(n/k))

Page 35: Advanced Iso-Surfacing Algorithms

Range Search (1)

Subdivide the cells based on their min/max ranges

Global minimum Global maximum

Isovalue

Hierarchically subdivide the cells based on their min/max ranges

Page 36: Advanced Iso-Surfacing Algorithms

Range Search (2)

Within each subinterval, there are more than one cellsTo further improve the search speed, we sort them.

Sort by what ? Min and Max values

Max

Min

M5 M2 M6 M4 M1 M3 M7 M8 M11 M10 M9

m5 m1 m6 m3 m8 m7 m2 m9 m11 m4 m10

G1

G2

Isosurface cells = G1 G2

Page 37: Advanced Iso-Surfacing Algorithms

Range Search (3)

?

A clean range subdivision is difficult …

Difficult to get an optimal speed

Page 38: Advanced Iso-Surfacing Algorithms

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 >

… …

Page 39: Advanced Iso-Surfacing Algorithms

Interval Tree

I

I left I right

… … Icells that have min < max

I left: cells that have max < I right: cells that have min >

Now, given an isovalue C

1) If C < 2) If C > 3) If C =

Complexity = O(log(n)+k)

Optimal!!

Page 40: Advanced Iso-Surfacing Algorithms

Range Search Methods

In general, range search methods all are super fast –

two orders of magnitude faster than the marching cubesalgorithm in terms of cell search

But they all suffer a common problem …

Excessive extra memory requirement!!!

Page 41: Advanced Iso-Surfacing Algorithms

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 Queue

A

B C

C

C D

….

Breadth-First Search

Page 42: Advanced Iso-Surfacing Algorithms

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 …

Page 43: Advanced Iso-Surfacing Algorithms

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.

Page 44: Advanced Iso-Surfacing Algorithms

Ambiguity !

Page 45: Advanced Iso-Surfacing Algorithms

2D Ambiguous Cases Ambiguous cases:

5, 10

Contour ambiguity arises when adjacent vertices in different states but diagonal vertices in the same state

Break contour Join contour

Both are valid

or

Break contour(two loops)

Join contour(single loop)

Page 46: Advanced Iso-Surfacing Algorithms

3D Ambiguity Problem

Certain Marching Cube cases have more than onepossible triangulation

Case 6 Case 3

Mismatch!!!

+

+

+

+

Hole!

Page 47: Advanced Iso-Surfacing Algorithms

3D Ambiguous Cases

Ambiguous cases: 3, 6, 7, 10, 12,

13 Adjacent vertices in different

states, but diagonal vertices in the same state

Ambiguity cases may cause holes

hole

case 3 case 6c

Isosurface polygons are disjoint across the common element surface

Page 48: Advanced Iso-Surfacing Algorithms

The Problem

Ambiguous Face: a face that has two diagonally opposingpoints with the same sign

+

+

Connecting either way is possible

Page 49: Advanced Iso-Surfacing Algorithms

To fix it …

Case 6 Case 3 B

Match!!!

+

+

+

+

The goal is to come up with a consistent triangulation

Page 50: Advanced Iso-Surfacing Algorithms

Solutions

There are many solutions available – we present a method called:

Asymptotic Decider by Nielson and Hamann (IEEE Vis’91)

Page 51: Advanced Iso-Surfacing Algorithms

Asymptotic Decider

Based on bilinear interpolation over faces

B01

B00 B10

B11

(s,t)B(s,t) = (1-s, s)

B00 B01B10 B11

1-t t

The contour curves of B:

{(s,t) | B(s,t) = } are hyperbolas

Page 52: Advanced Iso-Surfacing Algorithms

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

Page 53: Advanced Iso-Surfacing Algorithms

Asymptotic Decider (3)

(0,0)

(1,1)

Asymptote

(ST

If B(ST

Page 54: Advanced Iso-Surfacing Algorithms

Asymptotic Decider (4)

(1,1)

Asymptote

(ST

(0,0)

If B(ST

Page 55: Advanced Iso-Surfacing Algorithms

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

Page 56: Advanced Iso-Surfacing Algorithms

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 ambiguious faces).

Page 57: Advanced Iso-Surfacing Algorithms

References

This set of slides are developed from the lecture slides used by Prof. Han-Wei Shen at Ohio State University,

Also from Prof. Karki at Louisiana State University