i
i
i
i
i
i
i
i
2 8
2 8
Spatial-Field Visualization
The topic of visualization was introduced in the previous chapter, together with
visual encodings appropriate for a wide range of types of data. For many visu-
alization applications, the main challenge lies in nding the appropriate spatial
mapping of the data, but in other cases the data comes with a natural mapping.
For instance, a photograph is a set of measured data that has an obvious visual-
ization: simply display it on the screen. However, other ways of displaying the
data may be useful as well, depending on what the user is trying to learn from it.
An X-ray radiograph used to diagnose a broken bone is another example of a 2D
image that is normally displayed directly.
An X-ray is a 2D scalar field: a dataset that describes a function R
2
R,
in this case representing a projection of the density of a patient’s body onto a
plane. Other kinds of medical images, such as computed tomagraphy (CT) images
or magnetic resonance images (MRIs), are 2D scalar elds that describe slices
through a patient’s body rather than projections. If many closely-spaced slices
are measured, then the resulting dataset is a 3D scalar field,orvolume dataset,
representing a function R
3
R. This type of data can be displayed one slice
at a time, but it also invites perspective or orthographic views that can provide
additional insight into 3D shape.
The importance of scalar elds has led to a number of special techniques and
algorithms, particularly for rendering 3D views of volume data. As with other
kinds of visualization, the primary goal is to map the relevant features of the data
into visual features that play to the strengths of the human visual system.
709
i
i
i
i
i
i
i
i
710 28. Spatial-Field Visualization
28.1 2D Scalar Fields
Figure 28.1. A contour
plot for four levels of the
function 1 - x
2
-y
2
.
For simplicity, assume that our 2D scalar data is dened as
f(x, y)=
1 x
2
y
2
, if x
2
+ y
2
< 1,
0 otherwise,
(28.1)
over the square (x, y) [1, 1]
2
. In practice, we often have a sampled represen-
tation on a rectilinear grid that we interpolate to get a continuous eld. We will
ignore that issue in 2D for simplicity.
One way to visualize a 2D eld is to draw lines at a nite set of values
f(x, y)=f
i
(shown for the function in Equation 28.1 in Figure 28.1). This
is done on many topographic maps to indicate elevation. Isocontours are excel-
lent at communicating slope, but are hard to read “globally” to understand large
trends and extrema in the data.
Another common way to visualize 2D data is to use small pseudorandom dots
whose density is proportional to the value of the function. This is shown for our
test function in Figure 28.2. Such random density plots are useful for display on
black-and-white media, but are otherwise usually not a good choice for visualiza-
tion. Random density plots look smoother and smoother as more and smaller dots
are used maintaining overall density. As the dot size shrinks below human visual
Figure 28.2. A random
density plot for four levels of
the function 1 - x
2
-y
2
.
acuity, the image looks smooth. This results in a grayscale continuous tone plot
of the function. It is hard for humans to read such plots, because our ability to
detect absolute intensity levels is poor. For this reason, color or thresholding is
often used. This is shown in grayscale in Figure 28.3. Formally, we can specify
such a mapping with just a function g that maps scalar values to colors:
g : R → [0, 1]
3
.
Here [0, 1]
3
refers to the RGB cube. A common strategy is to specify a set of
colors to which specic values map and linearly interpolate colors between them.
A set of colors that increases in intensity and cycles in hue is often used. Such a
set of colors for the domain [0, 1] is
Figure 28.3. A grayscale
density plot of the function
1-x
2
-y
2
.
g(0.00) = (0.0, 0.0, 0.0)
g(0.25) = (0.0, 0.0, 1.0)
g(0.50) = (1.0, 0.0, 0.0)
g(0.75) = (1.0, 1.0, 0.0)
g(1.00) = (1.0, 1.0, 1.0)
i
i
i
i
i
i
i
i
28.2. 3D Scalar Fields 711
These plots are often called pseudocolor displays. We can also display the func-
tion as a height plot as shown in Figure 28.4. This type of plot is good for showing
the shape of a function. Note that this plot makes it more obvious that the function
is spherical.
Figure 28.4. A height plot
of the function.
Often, more than one of these methods are used together in a single image,
such as a colored or contoured height plot. Another hybrid technique that is often
used is to shade the height plot and view it orthogonally from above. This is a
shaded relief map, often used for geographical applications.
28.2 3D Scalar Fields
In 3D we can use some of the same techniques as in 2D. We can make a con-
tour plot, where each contour is a 3D surface called an isosurface. We can also
generalize a random density plot to 3D by scattering particles in 3D. If we take
the limit, as we did in 2D to get a pseudocolor display, then we get direct volume
rendering. These two methods are covered here. It is not clear how to generalize
height plots, because we have run out of dimensions.
28.2.1 Isosurfaces
Given a 3D scalar eld f(x, y, z) we can create an isosurface for f(x, y, z)=f
0
.
In practice, we will have f dened in a 3D rectilinear table that we interpolate for
Figure 28.5. An isosur-
face from the NIH/NIM Visi-
ble Female data set.
intermediate values. An example image is shown in Figure 28.5
There are two basic approaches to creating images of isosurfaces. The rst is
to explicitly create a polygonal representation of the isosurface and then render
that representation using standard rendering techniques. The second is to use ray
tracing to create an image by direct intersection calculation. In ray tracing, no
explicit surface is computed. The explicit approach is better when we have small
datasets, or we need the isosurface itself rather than just an image of it. The ray
tracing approach is better for large datasets where we just need the image of the
isosurface.
Creating Polygonal Isosurfaces
The basic idea of creating polygonal isosurfaces treats every rectilinear cell as a
separate problem (Wyvill et al., 1986; W. E. Lorensen & Cline, 1987). Given an
i
i
i
i
i
i
i
i
712 28. Spatial-Field Visualization
isovalue f
0
, there is a surface in the cell if the minimum and maximum of the
eight vertex values surround f
0
. What surfaces occur depend on the arrangement
of values above and below f
0
. This is shown for three cases in Figure 28.6.
Figure 28.6. Three cases
for polygonal isosurfacing.
The black vertices are on
one side of the isovalue,
and the white on the other.
There are a total of 2
8
= 256 cases for vertices above and below the isovalue.
We can just enumerate all the cases in a table, and do a look-up. We can also
take advantage of some symmetries to reduce the table size. For example, if we
reverse above/below vertices, we can halve the table size. If we are willing to do
ips and rotations, we can reduce the table to size 16, where only 15 of the cases
have polygons.
Ray Tracing
Although the above algorithm, usually called marching cubes is elegant and sim-
ple, some care must be taken to ensure accurate results (Nielson, 2003).
The algorithm for intersecting a ray with an isosurface has three phases: tra-
versing a ray through cells which do not contain an isosurface, analytically com-
puting the isosurface when intersecting a voxel containing the isosurface, shading
the resulting intersection point (Lin & Ching, 1996; Parker, Parker, et al., 1999).
This process is repeated for each pixel on the screen.
To nd an intersection, the ray a + tb traverses cells in the volume checking
each cell to see if its data range bounds an isovalue. If it does, an analytic com-
putation is performed to solve for the ray parameter t at the intersection with the
isosurface:
ρ(x
a
+ tx
b
,y
a
+ ty
b
,z
a
+ tz
b
) ρ
iso
=0.
When approximating ρ with a trilinear interpolation between discrete grid points,
this equation will expand to a cubic polynomial in t. This cubic can then be
solved in closed form to nd the intersections of the ray with the isosurface in
that cell. Only the roots of the polynomial which are contained in the cell are
examined. There may be multiple roots corresponding to multiple intersection
points. In this case, the smallest t (closest to the eye) is used. There may also
be no roots of the polynomial, in which case the ray misses the isosurface in the
cell.
A rectilinear volume is composed of a three-dimensional array of point sam-
ples that are aligned to the Cartesian axes and are equally spaced in a given dimen-
sion. A single cell from such a volume is shown in Figure 28.7. Other cells can
be generated by exchanging indices (i, j, k) for the zeros and ones in the gure.
i
i
i
i
i
i
i
i
28.2. 3D Scalar Fields 713
Figure 28.7. The geometry for a cell. A “nice” uvw coordinate system is used to make
interpolation math cleaner.
The density at a point within the cell is found using trilinear interpolation:
ρ(u, v, w)= (1 u)(1 v)(1 w)ρ
000
(28.2)
+(1u)(1 v)( w)ρ
001
+(1u)( v)(1 w)ρ
010
+( u)(1 v)(1 w)ρ
100
+( u)(1 v)( w)ρ
101
+(1u)( v)( w)ρ
011
+( u)( v)(1 w)ρ
110
+( u)( v)( w)ρ
111
,
where
u =
x x
0
x
1
x
0
, (28.3)
v =
y y
0
y
1
y
0
,
w =
z z
0
z
1
z
0
.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.174.132