Title: Scientific Visualization Ume University
1Scientific VisualizationUmeå University
Lecturers Roger Crawfis Ion Barason Bo
Kågström Eric Elmroth
The Ohio State University
2Introduction
- Getting acquainted - teams
- Current studies or major
- Hometown
- A interesting data problem
3Outline
- 1D and 2D Visualization Algorithms
- Data Topologies and Data Sources
- 2D Computer Graphics
- 3D Computer Graphics and Viewing
- Illumination and Shading
4Outline (cont)
- 3D Visualization techniques
- Iso-contour surfaces
- Volume Rendering
- Flow Visualization
- Volume Rendering - Optical Models
5Outline (cont)
- Transfer Functions
- Volume Rendering
- Drebin, Carpenter and Hanrahan
- Volume Rendering
- Projected Polyhedron
- Volume Rendering
- Splatting
6Outline (cont)
- Medical Visualization
- Flow Volumes
- Global Vector Field Visualization
- Virtual Environments
- The CAVE
71D Visualization
- y f(x)
- Line Charts
- Curve Fitting
- Smoothing or Approximation
81D Visualization
- Non-cartesion coordinate systems
9Basic 2D Visualizations
- Scalar Data on a Regular Grid
- Surface plots(2?D graphics)
102D Visualizations
- Contour Lines - f(x,y) constant
112D Visualizations
122D Computer Graphics
- Image formats and pixel limitations
- Color Tables
- grey-scale
- hot to cold
- perceptual
13Transfer Functions
- Besides the basics, most tools allow you to
define your own color mappings.
142D Visualization
- Vector Fields
- Hedgehogs
- Streamlines
151D Visualization
16Terrain Visualization
- Exaggerated surface height
- color-coded by
- height
- additional variable
17Working with 2D Regular data
- Reconstruction is critical
- Useful Image Processing operations
- Histogram
- Data mappers
- Region of interest selection
- Edge detection
- Noise removal or blurring
18Data Topologies - Structured
- Cartesian
- x j1 xi ?
- Regular or Uniform
- x j1 xi ?x
- Rectilinear or Perimeter
- x j1 x(i)
19Data Topologies - Structured
- Curvilinear
- x j1 x(i,j)
- y j1 y(i,j)
- Curves may intersect in i or j
- Curves may not cross in i or j
20Data Topologies - Unstructured
- Unstructured or cell data or finite-element data
- Tetrahedral
21Data Topologies - Unstructured
22Data Topologies - Unstructured
23New Data Topologies
- Improved data topologies offer huge potential for
savings in computational science - Hierarchical models are becoming more common
24New Data Topologies
- Hierarchical
- Multi-Block Curvilinear
- N-sided Polyhedron where ngt6
- Multi-Grid or Adaptive Mesh Refinement
25Data Sources
- Computational Science
- Data Acquisition / Imaging
- Historical Observation
- Survey, Census, etc.
26What is Computer Graphics?
- Given three points, what to draw
- The points
- A wire-frame triangle
- A solid triangle
272D Graphics - Rasterization
282D Graphics - Aliasing
292D Graphics - Line Drawing
- DDA Algorithm
- Midpoint (Breshenham) Algorithm
302D Graphics - Color limitations
- 8-bit color displays
- 24-bit
- Gamma correction
- Printing versus displaying
31Color Tables
- If we have 3 bit buffer we can turn on and off
each gun and display on the screen 8 different
color simultaneously. - But each of our guns have 256 intensities! What a
waste!
32Color Tables
332D Contouring
- Continuous f(x,y)
- Use steepest decent to find zero crossing (root)
of the function f(x,y)-c - Follow contour from this seed point until we
reach a boundary or loop back. - Direction close to ?f ? z
- Problems?
342D Contouring
- Discrete Data
- Assume the Mean Value Thereom
- Assume monoticity?
- 1D Analogy
- 5 Points
352D Contouring
- Given a quadrilateral
- f(x,y) 0.5
lt0.5
gt0.5
363D Graphics - Primitives
- Points
- Lines
- Triangles
- Polygons
- Surfaces (cones, spheres, etc.)
373D Viewing Transformations
- Coordinate Systems
- Object-centered to World-centered
- Projection to image plane
- Windowing Systems
38Illumination and Shading
- Light sources
- Flat shading
- Diffuse reflection (Gourand)
- Specular reflection (Phong)
39Hidden Surfaces
- Backface Removal
- Z-buffer
- Ray tracing
40Transparency
- Opacity
- A material property the prevents light from
passing through the object (a 1). - Transparency
- A material property that allows light to pass
through the object (a 0). - Translucency, semi-transparency
- Graded or blurred transp. (0 lt a lt 1).
41Compositing
42Visualization Algorithms
432D Slice Planes
- Orthogonal to a coordinate axis
- Uniform Grids gt image
- Arbitrary
- Specify the normal and a point
- Produces a 2D unstructured grid
442D Slice Planes
- Mesh with colors at vertices
- 128x128x128 volume can produce over 50,000
triangles. - Mesh with 2D texture coordinates
- Very slow if no hardware support
- More precise transitions
- Mesh with 3D texture coordinates
452D Flip book of slices
- Rather than view the 2D slice in 3D, rapidly play
a sequence of orthogonal slice planes in a movie
loop. - Sometimes difficult to build a complete mental
model.
463D Visualizations
- Point plots
- Animation can bring out the surface or pattern
(MacSpin) - Depth Cueing aids in the depth perception.
473D Visualizations
- Spheres or cubes dispersed throughout the volume
- color-coded
- optional shape-controlled.
483D Visualization
493D Visualization
- Can add information about an additional variable
- Here, two additional variables control the color.
503D Visualization
513D Visualization
523D Visualization
- Volume Rendering can mimic contouring.
- Use a transfer function with an impulse at the
contour level.
53Assignment
- Create the image on the right
- BubbleViz module
- crop to back-top
- downsize by 4
- semi-gloss refl.
- Orthogonal slice
- Iso-contour
- specular
- semi-transparent
- Bounding Box
54Contouring in 3D
- Treat volume as a set of 2D slices
- Apply 2D Contouring algorithm on each slice.
- Or given as a set of hand-drawn contours
- Stitch the slices together.
55Contour Stitching
- Problem
- Given 2 two-dimensional closed curves
- Curve 1 has m points
- Curve 2 has n points
- Which point(s) does vertex
- i on curve one correspond to
- on curve two?
i
56A Solution
- Fuchs, et. al.
- Optimization problem
- 1 stitch consists of
- 2 spans between curves
- 1 contour segment
- Triangles of Pi,Qj,Pi1 or Qj1,Pi,Qj
- Consistent normal directions
Qj
Pi
Pi1
57Fuchs, et. al.
- Left span
- PiQj gt go up
- Right span (either)
- Pi1Qj gt go down
- PiQj1 gt go down
58Fuchs, et. al.
- Constraints
- Each contour segment is used once and only once.
- If a span appears as a left span, then it must
also appear as a right span. - If a span appears as a right span, then it must
also appear as a left span.
59Fuchs, et. al.
- This produces an acceptable surface (from a
topological point of view) - No holes
- We would like an optimal one in some sense.
60Fuchs et. al.
- Graph problem
- Vertices Vij span between Pi and Qj
- Edges are constructed from a left span to a right
span. - Only two valid right spans for a left span.
Qj
Qj1
Pi
Pi1
61Fuchs, et. al.
- Organize these edges as a grid or matrix.
Q
j
i
P
QjPiQj1
PiQjPi1
62Fuchs, et. al.
- Acceptable graphs
- Exactly one vertical arc between Pi and Pi1
- Exactly one horiz. arc between Qj and Qj1
- Either
- indegree(Vij) outdegree(Vij) 0
- both gt 0
- (if a right, also has to be a left)
63Fuchs, et. al.
- Claim
- An acceptable graph, S, is weakly connected.
- Lemma 2
- Only 0 or 1 vertex of S has an indegree 2.
- E.g., Two cones touching in the center.
- All other vertices have indegree1
- (recall indegree outdegree)
64Fuchs, et. al.
- Thereom 1 S is an acceptable surface if and only
if - S has one and only one horizontal arc between
adjacent columns. - S has one and only one horizontal arc between
adjacent rows. - S is Eulerian (closed walk with every arc only
once).
65Fuchs, et. al.
- Number of arcs is thus mn.
- Many possible solutions still!!!
- Associate costs with each edge
- Area of resulting triangle
- Aspect ratio of resulting triangle
66Fuchs, et. al.
- Note that Vi0 is in S for some i.
- Note that V0j is in S for some j.
- With the weights (costs), we can compute the
minimum path from a starting node Vi0. - Since we do not know which Vi0, we compute the
paths for all of them and take the minimum. - Some cost saving are achievable.
67Marching Cubes
- Lorensen and Cline, SIGGRAPH 87
- Predominant method used today.
- Efficient and simple
68Marching Cubes
- Treat each cube individual
- No 2D contour curves
- Allow intersections only on the edges or at
vertices. - Pre-calculate all of the necessary information to
construct a surface.
69Marching Cubes
- Consider a single cube
- All vertices above the contour threshold
- All vertices below
- Mixed above and below
70Marching Cubes
- Binary label each node gt (above/below)
- Examine all possible cases of above or below for
each vertex. - 8 vertices implies 256 possible cases.
71Marching Cubes
- Only 15 distinct cases
- not really
- Order vertices into an 8-bit index
72Marching Cubes
- Animating the contour value
- Special functions for contouring
- Varying speeds and numbers of triangles
73Marching Cubes
- Data Structures/Tables
- static int const HexaEdges122 0,1,
1,2, 2,3, 3,0, - 4,5,
5,6, 6,7, 7,4, - 0,4,
1,5, 3,7, 2,6 - typedef struct
- EDGE_LIST HexaEdges16
- HEXA_TRIANGLE_CASES
- / Edges to intersect. Three at a time form a
triangle. / - static const HEXA_TRIANGLE_CASES HexaTriCases
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, / 0 / - 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, / 1 / - 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, / 2 / - 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, / 3 /
74Marching Cubes - How simple
- / Determine the marching cubes index /
- for ( i0, index 0 i lt 8 i)
- if (val1nodesi gt thresh) / If the
nodal value is above the / - index CASE_MASKi / threshold,
set the appropriate bit. / - triCase HexaTriCases index / triCase
indexes into the MC table. / - edge triCase-gtHexaEdges / edge points to
the list of intersected edges / - for ( edge0 gt -1 edge 3 )
-
- for (i0 ilt3 i) / Calculate and store
the three edge intersections / -
- vert HexaEdgesedgei
- n0 nodesvert0
- n1 nodesvert1
- t (thresh - val1n0) / (val1n1 -
val1n0) - tri_ptri add_intersection( n0, n1, t
) / Save an index to the pt. / -
- add_triangle( tri_ptr0, tri_ptr1,
tri_ptr2, zoneID ) / Store the triangle /
75Marching Cubes
- Topological inconsistencies in the 15 cases
- Turns out positive and negative are not symmetric.
-
-
-
-
-
-
-
76Ambiguities
77Efficient Searching
- With lt 10 of the voxels contributing to the
surface, it is a waste to look at every voxel. - A voxel can be specified in terms of its
interval, its minimum and maximum values.
78Span Space
Minimum
79Span Space - Representing
Minimum
80Assignment
- Use an AVS/Express network to create and test the
Marching cubes cases (guest4/MarchingCubes.v). - Answer the following question
- Does AVS/Expresss Isosurface module use the
modified contouring tables to avoid holes? - Give an example to (with two cubes), to prove
your point. - Show an instructor when completed
81Material Classification
- Drebin, Carpenter and Hanrahan
- Material Probabilities
- Levoy
- Contour surfaces
- MRI data
- Skin versus Brain
- Using Texture mapping
82Transfer Function
- Maps raw voxel value into presentable entities
color, intensity, opacity... - Raw-data ? material (R, G, B, a, Ka, Kd, Ks,...).
- Material ? shaded material.
- High gradient in the data values detects a
surface and is used as a measure of its
orientation.
83Shading and Gradients
- For surface properties and reflections, we need a
normal. - Gradient implies a normal.
84Drebin, et. al.
- Classify volume into material percentages
- several materials per voxel are possible
- Calculate colors and opacities for each voxel
- Calculate a density for each voxel.
- Determine the gradient from the density volume.
85Drebin, et. al.
- Determine a surface strength for each voxel from
the density volume - Using the color and opacity volume, the gradient
volume and the strength volume, compute a shaded
volume. - Transform and view this volume.
86Drebin, et. al.
Original CT Data
Fat
Tissue
Bone
Density
Color and Opacity
Strength
Gradient NX NY NZ
Transformed
Shaded
Final Image
87Drebin, et. al.
- Material Classification
- Use a probability, rather than a threshold.
- Bayesian estimate
- Zone centered
- We know the x-ray absorptions of the materials
(bone, ...)
88Drebin, et. al.
- Work backwards, given x-ray absorption, I, what
is the probability of it being air? Of bone?, - P(I) ??iPi(I)
- ?I gt percent of material (our goal)
- Pi(I) gt probability distribution that material
i has an intensity I. - The x-ray absorption of a homogenous material.
- Known a priori
89Drebin, et. al.
- Bayesian Estimate
- ?i(I) Pi(I) / ?Pj(I) for all n materials.
- ? ?I (I) 1
90Drebin, et. al.
- Matte volumes
- Cut-outs (world-space matte)
- Depth Cueing (image space matte)
91Drebin, et. al.
- Surface Extraction
- Each material has a density, both a real and an
artificial one for visualization. - D(x,y,z) ?Pi(I)(x,y,z) ?I
- N ?D, and normalize
- For noisy data, blur D.
92Drebin, et. al.
- Lighting
- absorption
- emitting
- surface scatteringand absorption
- Compositing
- Front over Surface over Back
93Levoy
- Contour Surfaces with Ray tracing
- If step is too large,will miss the surface.
- If step is too small,it is too slow.
94Contour Detection
- Control step, or iteratively search until you hit
the surface. - Similar to root finding
95Levoy
- Use a simple transfer function.
96Medical Visualization
- Data sources
- CAT
- PET
- MRI
- Ultrasound
- Electrical signals
- Computational Science
97Medical Visualization
- Uses
- Education / Biology
- Surgical Training / Simulation
- Pre-surgical planning
- Diagnosis
98Virtual Environments
- Immersive
- Interactive
- User Centered
VR
Stereo
Interactive
UserInterface
Graphics
99Virtual Environments
- Draw at 120Hz
- Track user position/orientation at 120Hz
- Provide Haptic feedback at gt 200Hz
100Virtual Environments
- Display Technologies
- HMDs - Head Mounted Displays
- Large theater - Imax, Omnimax
- Stereo displays
- HUDs - Heads Up Displays
- windshields
- goggles
- CAVE - Surround video projections
101Virtual Environments
- Interactive user navigation devices
- Head tracker
- Treadmill
- Bicycle
- Wheelchair
- Boom
- Video detection
102Virtual Environments
- Interactive user control devices
- Mouse
- 3D pointer - Polymeus, Microscribe,
- Spaceball
- Hand-held wand
- Gesture
- Custom
103Augmented Reality
- Merged real imagery and computer generated
imagery. - Video capture into visualization system
- See-thru glasses
University of North Carolina, Chapel Hill
104Augmented Reality
University of North Carolina, Chapel Hill
105Augmented Reality
University of North Carolina, Chapel Hill
106Augmented Reality
- Also useful for non-medical
- Mechanics drawing super-imposed over the actual
machinery. - Guided tours.
107Haptics
- Force feedback is needed at very fast rates.
- Gloves
- force resistant
- nerve stimulated
- Theme Park rides
108Stereo Lithography
- Build real models of the visualizations
- Example, molecular docking
109The CAVE Architecture
- Four projection screens
- Four graphics rendering engines
- Stereo displays
- Head-tracking of one user
110The CAVE Architecture
Floor
Right
Front
111The CAVE Architecture
- Several people can view at once
- The projections are only correct for one person.
- Lasers synch the stereo displays with Liquid
Crystal shutter glasses on each viewer.
112The CAVE Architecture
- Benefits
- Eye movement problems are avoided!!!
- Users orientation does not matter.
- Can see and examine real people and objects
within the room
113The CAVE Architecture
- Problems
- The light intensity on each projector varies
- Precise alignment of the projectors is necessary
for a smooth seam. - Viewing does not change for the other viewers.
- Expensive.
114Making VR Work
- To ensure latency, many of the visualization
techniques need to be streamlined or
pre-computed. - Examples, pre-computed iso-contours, precomputed
stream lines and particle traces.