gate-540 1 reconstruction from voxels (gate-540) dr.Çağatay ÜndeĞer instructor middle east...

28
1 GATE-540 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT Inc. e-mail : [email protected] Game Technologies Program – Middle East Technical University – Spring 2010 Reference: William E. Lorensen and Harvey E. Cline

Upload: nayeli-alberts

Post on 31-Mar-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

1GATE-540

Reconstruction from Voxels

(GATE-540)

Dr.Çağatay ÜNDEĞER

InstructorMiddle East Technical University, GameTechnologies

&

General ManagerSimBT Inc.

e-mail : [email protected]

Game Technologies Program – Middle East Technical University – Spring 2010

Reference: William E. Lorensen and Harvey E. Cline

Page 2: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

2GATE-540

Outline

• Reconstruction

Page 3: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

3GATE-540

Goals• Develop 3D Analysis Algorithms:

– Reconstruction– Segmentation– Feature Detection– Labeling– Matching – Classification– Retrielval– Recognition– Clustering

Page 4: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

4GATE-540

Voxel

• A voxel (volumetric pixel)– A volume element, representing a value on

a regular grid in three dimensional space. • Analogous to a pixel, which represents 2D

image data in a bitmap

Page 5: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

5GATE-540

Voxel Data

• Do not typically have their position (their coordinates) explicitly encoded along with their values.

• Stores:– Binary data:

• empty / full– Float data:

• density / color / distance to surface

Page 6: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

6GATE-540

Voxel vs Polygon

• Polygons:– Often explicitly represented by the

coordinates of their vertices. – Able to efficiently represent simple 3D

structures with lots of empty or homogeneously-filled space.

• Voxels:– Good at representing regularly-sampled

spaces that are non-homogeneously filled.– Have a limited resolution, as precise data

is only available at the center of each cell.

Page 7: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

7GATE-540

Usage of Voxel• Frequently used in the visualization and

analysis of medical and scientific data. • Some volumetric displays use voxels to

visualize models and describe their resolution in 3D dimension (512×512×256 voxels).

Page 8: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

8GATE-540

Usage of Voxel• In games and simulations,

– Used for representation of terrain containing overhangs and caves.

– Concave features cannot be represented by heightmaps.

Page 9: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

9GATE-540

Visualizing Voxels

• Visualization:– Direct volume rendering– Extraction of polygon iso-surfaces which

follow the contours of given threshold values.

• The marching cubes algorithm is often used for iso-surface extraction.

Page 10: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

10GATE-540

Iso-Surface

• A three-dimensional analog of an iso-contour.• A surface that represents points of a constant

value (e.g. pressure, temperature, velocity, density) within a volume of space.

İso-surface

Page 11: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

11GATE-540

Marching Cubes

• Marching Cubes is an algorithm which “creates triangle models of constant density surfaces (iso-surfaces) from 3D medical data.”

Page 12: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

12GATE-540

Medical Data Acquisition

• Computed Tomography (CT)• Magnetic Resonance (MR) Imagining (MRI)• Single-Photon Emission Computed Tomography

(SPECT)

• Each scanning process results in two dimensional “slices” of data.

Page 13: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

13GATE-540

Data Slices

Page 14: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

14GATE-540

Marching Cubes Extraction

• Extracts surfaces from adjacent pairs of data slices using cubes.

• Cubes “march” through the pair of slices until the entire surface of both slices has been examined.

Page 15: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

15GATE-540

Marching Cubes Overview

• Load slices.• Create a cube from pixels on adjacent slices.• Find vertices on the surfaces.• Determine the intersection edges.• Interpolate the edge intersections.• Calculate vertex normals.• Output triangles and normals.

Page 16: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

16GATE-540

How Are Cubes Constructed

• Uses identical squares of four pixels connected between adjacent slices.

• Each cube vertex is examined to see if it lies “on” or “off” the surface.

Page 17: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

17GATE-540

How Are The Cubes Used

• Pixels on the slice surfaces determine 3D surfaces.

• 256 surface permutations, but only 15 unique patterns.

• A normal is calculated for each triangle vertex for rendering.

Page 18: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

18GATE-540

15 Unique Patterns

Page 19: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

19GATE-540

Triangle Creation

• Determine triangles contained by a cube.• Determine which cube edges are intersected.• Interpolate intersection point using pixel

density.• Calculate unit normals for each triangle vertex

using the gradient vector.

Page 20: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

20GATE-540

Determining Triangles

• An index to a pre-calculated array of 256 possible polygon configurations (28 = 256) within the cube

• Treat each of the 8 scalar values (cube corners) as a bit in an 8-bit integer.

• 8 scalars (8 bits) determine the actual index to the polygon configuration array.

Page 21: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

21GATE-540

Determining Inside/Outside

• Select a iso-value that the surface will pass through.

• If the scalar's value is higher than the iso-value then – The appropriate bit is set to one (inside)

• If it is lower then– The appropriate bit is set to zero (outside)

iso-value = 0.3

0.1 0.8

0.5 0.0

Page 22: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

22GATE-540

Determining Intersections

• Determine intersection points to iso-suface by interpolation.

0.1 0.8

0.5

0.3

0.3

0.00.3

0.3iso-value = 0.3

Page 23: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

23GATE-540

Determining Intersections

• Gradient of the scalar field at each grid point is also the normal vector of a hypothetical iso-surface passing from that point.

Page 24: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

24GATE-540

Determining Intersections

• Interpolate these normals along the edges of each cube to find the normals of the generated vertices.

N

N

Page 25: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

25GATE-540

Grid Resolution

• Variations can increase/decrease surface density.

Page 26: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

26GATE-540

Examples

Page 27: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

27GATE-540

Marching Squares

• 2D version of Marching Cubes• Aims at drawing lines between interpolated

values along the edges of a square considering given weights of the corners and a reference value.

Page 28: GATE-540 1 Reconstruction from Voxels (GATE-540) Dr.Çağatay ÜNDEĞER Instructor Middle East Technical University, GameTechnologies & General Manager SimBT

28GATE-540

Conclusion

• Marching Squires / Marching Cubes provides a simple algorithm to translate a series of 2D medical scans into 2D / 3D objects.