+ All Categories
Home > Documents > CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

Date post: 14-Jan-2016
Category:
Upload: eileen-lester
View: 222 times
Download: 5 times
Share this document with a friend
Popular Tags:
40
CSE554 Contouring Slide 1 CSE 554 Lecture 4: Contouring Fall 2015
Transcript
Page 1: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 1

CSE 554

Lecture 4: Contouring

CSE 554

Lecture 4: Contouring

Fall 2015

Page 2: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 2

ReviewReview

• Binary pictures

– Pros: natural geometric form for bio-medical data; easy to operate on

– Cons:

• Blocky boundary

• Large memory footprint

Page 3: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 3

Geometric FormsGeometric Forms

• Continuous forms

– Defined by mathematical functions

– E.g.: parabolas, splines, subdivision surfaces

• Discrete forms

– Disjoint elements with connectivity relations

– E.g.: polylines, triangle surfaces, pixels and voxels

2xy ][][ ySinxSinz

Pixels

Triangle surfaces

Polyline

Voxels

Curves Surfaces

Page 4: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 4

Boundary RepresentationsBoundary Representations

• Polylines (2D) or meshes (3D) that tile the object boundary

– Smoother appearance

– Less storage (no interior elements)

Binary picture Boundary mesh

Page 5: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 5

Boundary RepresentationsBoundary Representations

• We will cover (in a sequence of lectures):

– Extracting a boundary from a grayscale image (volume)

– Denoising and simplification

– Alignment and deformation

Page 6: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 6

Thresholding - RevisitedThresholding - Revisited

• Creates a binary picture from a grayscale image

• How to define a smooth boundary at the threshold?

– Such boundary is known as an iso-contour (or iso-curve, iso-surface, etc.)

Grayscale image Thresholded binary picture Boundary curve

Page 7: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 7

DefinitionDefinition

• Given a continuous function f defined over the space,

• an iso-contour at iso-value c is the set of all points where f evaluates to be c

Page 8: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 8

ExamplesExamples

• Iso-curves: iso-contours of 2D functions

}),(|},{{ cyxfyx

22),( yxyxf

1),( yxf

Page 9: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 9

ExamplesExamples

• Iso-surfaces: iso-contours of 3D functions

}),,(|},,{{ czyxfzyx

222),,( zyxzyxf

1),,( zyxf

Page 10: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 10

Iso-contour PropertiesIso-contour Properties

• Closed

– With a well-defined inside and outside

• Inside: points above the iso-value

• Outside: points below the iso-value

• In general, a manifold

– A non-degenerate curve (surface) without branching or boundaries

• Except at critical points (local maxima, minima, saddle)

• Orthogonal to gradient directions

– Critical points: where gradient is zero

Black curves: iso-contoursGreen dots: critical pointsRed arrows: gradient directions

Page 11: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 11

Discrete Iso-contoursDiscrete Iso-contours

• Consider an image as a sampling of some continuous function f

– We seek discrete approximations of the continuous iso-contours of f

x

y f(x,y)

Page 12: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 12

“Good” Approximations“Good” Approximations

• Closed (with inside and outside)

– Polyline: a vertex is shared by even # of edges

– Mesh: an edge is shared by even # of polygons

• Manifold

– Polyline: a vertex is shared by 2 edges

– Mesh: an edge is shared by 2 polygons, and a vertex is contained in a ring of polygons

• Non-intersecting

ClosedManifoldNon-intersecting

OpenNon-manifoldNon-intersecting

ClosedNon-manifoldNon-intersecting

ClosedManifoldIntersecting

Page 13: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 13

“Good” Approximations“Good” Approximations

A closed, manifold, non-intersecting triangular mesh

• Closed (with inside and outside)

– Polyline: a vertex is shared by even # of edges

– Mesh: an edge is shared by even # of polygons

• Manifold

– Polyline: a vertex is shared by 2 edges

– Mesh: an edge is shared by 2 polygons, and a vertex is contained in a ring of polygons

• Non-intersecting

Page 14: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 14

“Good” Approximations“Good” Approximations

A closed, manifold, non-intersecting triangular mesh

• Closed (with inside and outside)

– Polyline: a vertex is shared by even # of edges

– Mesh: an edge is shared by even # of polygons

• Manifold

– Polyline: a vertex is shared by 2 edges

– Mesh: an edge is shared by 2 polygons, and a vertex is contained in a ring of polygons

• Non-intersecting

Page 15: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 15

Contouring (On A Grid)Contouring (On A Grid)

• Input

– A grid where each grid point (pixel or voxel) has a value (color)

– An iso-value (threshold)

• Output

– A closed, manifold, non-intersecting polyline (2D) or mesh (3D) that separates grid points above or below the iso-value

Iso-value =

Grid point (pixel)

Grid edge

Grid cell

Page 16: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 16

Contouring (On A Grid)Contouring (On A Grid)

Iso-value = 0

negative positive

• Input

– A grid where each grid point (pixel or voxel) has a value (color)

– An iso-value (threshold)

• Output

– Equivalently, we extract the zero-contour (separating negative from positive) after subtracting the iso-value from the grid points

Page 17: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 17

AlgorithmsAlgorithms

• Primal methods

– Marching Squares (2D), Marching Cubes (3D)

– Placing vertices on grid edges

• Dual methods

– Dual Contouring (2D,3D)

– Placing vertices in grid cells

Page 18: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 18

Marching Squares (2D)Marching Squares (2D)

• For each grid cell with a sign change

– Create one vertex on each grid edge with a sign change

– Connect vertices by lines

Page 19: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 19

Marching Squares (2D)Marching Squares (2D)

• For each grid cell with a sign change

– Create one vertex on each grid edge with a sign change

– Connect vertices by lines

Page 20: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 20

Marching Squares (2D)Marching Squares (2D)

• Creating vertices: linear interpolation

– Assuming the underlying, continuous function is linear on the grid edge

– Linearly interpolate the positions of the two grid points

{x0,y0}{x1,y1 }

{x,y} )(

)(

010

010

10

0

yytyy

xxtxx

ff

ft

t 1-tf

f0

f1

0

+

-

<0

>0

Page 21: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 21

Marching Squares (2D)Marching Squares (2D)

• For each grid cell with a sign change

– Create one vertex on each grid edge with a sign change

– Connect vertices by lines

Page 22: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 22

• Connecting vertices by lines

– Lines shouldn’t intersect

– Each vertex is used once

• So that it will be used exactly twice by the two cells incident on the edge

• Two approaches

– Do a walk around the grid cell

• Connect consecutive pair of vertices

– Or, using a pre-computed look-up table

• 2^4=16 sign configurations

• For each sign configuration, it stores the indices of the grid edges whose vertices make up the lines.

Marching Squares (2D)Marching Squares (2D)

1 2

3 4

1

34

2

Key: 0 0 0 1

Data: {{2,4}}

Key: 0 0 1 1

Data: {{3,4}}

Key: 1 0 0 1

Data: {{1,3}, {2,4}}

Page 23: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 23

Marching Cubes (3D)Marching Cubes (3D)

• For each grid cell with a sign change

– Create one vertex on each grid edge with a sign change (using linear interpolation)

– Connect vertices into triangles

Page 24: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 24

Marching Cubes (3D)Marching Cubes (3D)

• For each grid cell with a sign change

– Create one vertex on each grid edge with a sign change (using linear interpolation)

– Connect vertices into triangles

Page 25: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 25

Marching Cubes (3D)Marching Cubes (3D)

• Connecting vertices by triangles

– Triangles shouldn’t intersect

– To be a closed manifold:

• Each vertex used by a triangle “fan”

• Each mesh edge used by 2 triangles (if inside grid cell) or 1 triangle (if on a grid face)

Page 26: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 26

Marching Cubes (3D)Marching Cubes (3D)

• Connecting vertices by triangles

– Triangles shouldn’t intersect

– To be a closed manifold:

• Each vertex used by a triangle “fan”

• Each mesh edge used by 2 triangles (if inside grid cell) or 1 triangle (if on a grid face)

Page 27: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 27

Marching Cubes (3D)Marching Cubes (3D)

• Connecting vertices by triangles

– Triangles shouldn’t intersect

– To be a closed manifold:

• Each vertex used by a triangle “fan”

• Each mesh edge used by 2 triangles (if inside grid cell) or 1 triangle (if on a grid face)

Open mesh: each magenta edge is shared by one triangle

Page 28: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 28

Marching Cubes (3D)Marching Cubes (3D)

• Connecting vertices by triangles

– Triangles shouldn’t intersect

– To be a closed manifold:

• Each vertex used by a triangle “fan”

• Each mesh edge used by 2 triangles (if inside grid cell) or 1 triangle (if on a grid face)

• Each mesh edge on the grid face is shared between adjacent cells

Closed mesh: each edge is shared by two triangles

Page 29: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 29

Marching Cubes (3D)Marching Cubes (3D)

• Connecting vertices by triangles

– Triangles shouldn’t intersect

– To be a closed manifold:

• Each vertex used by a triangle “fan”

• Each mesh edge used by 2 triangles (if inside grid cell) or 1 triangle (if on a grid face)

• Each mesh edge on the grid face is shared between adjacent cells

• Look-up table

– 2^8=256 sign configurations

– For each sign configuration, it stores indices of the grid edges whose vertices make up the triangles

1

2

3

4

5

6

7

8

1

2

3

4

5

6

7

8

9

10

11

12

Sign: “0 0 0 1 0 1 0 0”Triangles: {{2,8,11},{4,7,10}}

Page 30: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 30

Implementation NotesImplementation Notes

• Avoid computing one vertex multiple times

– Compute the vertex location once, and store it in a hash table

• When the grid point’s value is same as the iso-value

– Treat it either as “above” or “below”, but be consistent.

Page 31: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 31

AlgorithmsAlgorithms

• Primal methods

– Marching Squares (2D), Marching Cubes (3D)

– Placing vertices on grid edges

• Dual methods

– Dual Contouring (2D,3D)

– Placing vertices in grid cells

Page 32: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 32

Dual Contouring (2D)Dual Contouring (2D)

• For each grid cell with a sign change

– Create one vertex

• For each grid edge with a sign change

– Connect the two vertices in the adjacent cells with a line segment

Page 33: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 33

Dual Contouring (2D)Dual Contouring (2D)

• For each grid cell with a sign change

– Create one vertex

• For each grid edge with a sign change

– Connect the two vertices in the adjacent cells with a line

Page 34: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 34

Dual Contouring (2D)Dual Contouring (2D)

• Creating the vertex within a cell

– Compute one point on each grid edge with a sign change (by linear interpolation)

• There could be more than two sign-changing edges, so >2 points possible

– Take the centroid of these points

Page 35: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 35

Dual Contouring (3D)Dual Contouring (3D)

• For each grid cell with a sign change

– Create one vertex (same way as 2D)

• For each grid edge with a sign change

– Create a quad (or two triangles) connecting the four vertices in the adjacent grid cubes

– No look-up table is needed!

Page 36: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 36

Dual Contouring: DiscussionDual Contouring: Discussion

• Result is closed, but possibly non-manifold

– Each mesh edge is shared by even number of quads

– An edge may be shared by 4 quads

– A vertex may be shared by 2 rings of quads

• Can be fixed

– But with more effort…

Red edge is shared by 2 quads

Red edge is shared by 4 quads (non-manifold)

Center vertex is non-manifold

Page 37: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 37

DualityDuality

• The two outputs have a dual structure

– Vertices and quads of Dual Contouring correspond (roughly) to un-triangulated polygons and vertices produced by Marching Cubes

Marching Cubes Dual Contouring

Page 38: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 38

Primal vs. DualPrimal vs. Dual

• Marching Cubes

– Always manifold

– Requires look-up table in 3D

– Often generates thin and tiny polygons

• Dual Contouring

– Can be non-manifold

– No look-up table needed

– Generates better-shaped polygons

Marching Cubes

Dual Contouring

Page 39: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 39

Primal vs. DualPrimal vs. Dual

• Marching Cubes

– Always manifold

– Requires look-up table in 3D

– Often generates thin and tiny polygons

– Restricted to uniform grids

• Dual Contouring

– Can be non-manifold

– No look-up table needed

– Generates better-shaped polygons

– Can be applied to any type of grid

DC on a Quadtree (2D)

DC on uniform grid

DC on octree (3D)

Page 40: CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.

CSE554 Contouring Slide 40

Further ReadingsFurther Readings

• Marching Cubes:

• “Marching cubes: A high resolution 3D surface construction algorithm”, by Lorensen and Cline (1987)

– >11000 citations on Google Scholar

• “A survey of the marching cubes algorithm”, by Newman and Yi (2006)

• Dual Contouring:

• “Dual contouring of hermite data”, by Ju et al. (2002)

– >500 citations on Google Scholar

• “Manifold dual contouring”, by Schaefer et al. (2007)


Recommended