CSE 332 - Introduction to Visualization
Labs
Slides from recitation
session (5/13/09):
pdf files are available here: isoSurface,
fullVolumeRendering
Lab 6 demo and more datasets (4/28/09):
Here is the demo and here are
more datasets (carp, tooth, tree)
A few hints for lab5 (4/27/09):
Transferfunction: This
time the transfer function serves as a lookup table / mapping function
for the interpolated densities, d. They map the densities to RGBA.
Assume you would do nearest neighbor interpolation, you get:
sample.r=transfer_function[rint(d)].r, same for g,b,a. On the GPU the
transferfunction is a 1D texture (it has 4 color channels), so you can
interpolate them like any other texture, with tex1D(), and you use d as
the index.
Ray step size and dimensions for
volume texture maps: For the ray step size, it depends what
you choose for your texture extents. Choose this to create your 3D
texture:
glTexImage3D(GL_TEXTURE_3D_EXT, 0, GL_RGBA, vol_w, vol_h, vol_d, 0,
GL_RGBA, GL_UNSIGNED_BYTE, vox);
where vol_w, vol_h, vol_d are the volume extents. Now your ray step
size will be intuitive. Typically you want to sample at least once per
voxel cell, so you would choose step_size=1.0 or less.
X-ray min/max sliders:
Since X-ray sums densities, you can easily accumulate > 255 (just
imagine your ray goes through a very dense area with many voxels having
values of > 200, to give ray sums >> 255. Likewise you may also
have rays that go through areas of low density, so you get raysums <
255. In the end you have a range of ray sums [0. 10000] or something
like this, and this will get mapped to [0,255] at the display. You will
not see good contrast. The windowing [min, max] will give you control
over the density range where you will see good contrast, the rest will
be saturated to 0 (rays<min) and 255 (rays>max).
Lab 5 demo, some more insight, and hig resolution volumes (4/13/09)
Here is a demo program that
showcases MIP and X-ray rendering, but not the alpha-compositing (The
option DVR is shaded volume rendering, to be modified for a future lab 6
demo).
Here are some more data files,
they are hi-res versions of what you already have and will give you
nicer images (but will take longer to render, which may not matter for a
GPU implementation on a good machine).
Finally, here an updated lab5 GPU
instructions file (the update is a section added to the beginning)
Instructions for GPU
implementation of lab5 (4/8/09):
Here is a file that should
make things quite clear.
Sample midterm from 2004 (4/6):
Here is a midterm exam given in
2004 which was the last tiomne this course was taught for undergrad
students. It will closely resemble the style of the final exam. Please
note that the final exam will and has always been comprehensive in
scope.
FBO example (3/28/09):
Your class mate Zhiyuan Zhang was so kind and created a simple
example application (available here)
that shows how you write to an FBO and then copy the result to the
framebuffer for display. Please note that the example uses unsigned byte
as the data type. The FBO supports floats as well (but the display
framebuffer does not), which you want to use for computations using the
GPU. So you just change the FBO data type in this case.
Some links to helpful CG information on the web (3/21):
The official NVIDIA CG
tutorial (to get started -- advanced concepts such as FBOs are not
discussed)
The NVIDIA
developer site has many GL/CG
examples
Some other links: here andhere
The CG
Wiki page has also helpful links
Finally, here is a working program
that uses keyboard commands to control the output (have a look at the
source code)
Lab 3 (3/16/09)
Here is the added code, and
here are the volume data files.
Lab 3 (2/26/09)
Here is the demo. It uses the
graphics hardware. Make sure you have all libraries and files in the
executable directory.
Lab 2 notes (2/24/09)
1. Modifying the histogram is a secondary effect. You modify the
image with the transfer function and this modifies the histogram
(not the other way around). If the transfer function TF has for bin 23
(x=23) a value 50 (y=50) then this means that all image pixels with
current value = 23 now will get value = 50. You need to make this
change. The TF is an array [0..255] and has values [0...255]. Index it
with your current image value and you will get out the new value.
2. Tthere is no direct relationship between transfer function
and the histogram. In your program, they are only drawn into the same
window and share the x-axis (0..255) since the x-axis holds the possible
pixel values the input image can have. The y-axis for the transfer
function is 0..255.
FLTK help (2/23/09)
See here for as file
that shows how to add toggle and radio buttons and the functionality
associated with it.
Lab 2 (2/19/09)
The demo is here. This demo
uses the graphics hardware. Make sure you have all libraries and files
in the executable directory.
Lab1
The skeletion code is here. Build with
Visual Studio and you will get the basic functionality.
A FLTK user interface file, gui.fl, is also included to be used with
the FLTK GUI builder package, fluid.
Finally, the distribution also contains a demo of the desired
functionality, lab1.exe
A collection of images, but you are bery
much encouraged to try your favorite images, or images you find opn the
web, via google images or Flickr, etc (see further below for
conversion information).
New to C/C++?
All labs will use the C/C++ programming language.No worries, C/C++ is
quite similar to Java. Here is a Tutorial on C/C++ for Java programmers
Need MS Visual Studio?
Go this website:
https://www.dreamspark.com to get Visual Studio 2008 online. Must
validate via student ID.
Information on FLTK:
The following is for installation on MS Windows (2000, XP, Vista)
- download fltk 1.1.7 from http://www.fltk.org
- extract files
- pick an MS Visual Studio version appropriate to your computer and
go to that flk directory
- select fltk.sln
- Build Solution (set to Release Mode in Build-> Configuration
Manager)
The GUI builder, fluid, will be in the fluid folder .
Check out http://www.fltk.org for
useful information.
Be sure to also check out the FLTK cheat sheet page for a
great variety of FLTK code snippets to implement useful GUI
functions
Setup Visual Studio for use with
FLTK:
Go to Tools -> Options->
Projects and Solutions (double-click to expose submenu list) -> VC
Directories
Show directories: Include files (add the directory where the \FL folder
is located)
for example: C:\...\fltk
1.1.7\fltk-1.1.7\
Show directories: Library files (add the directory \lib in your FLTK
folder hierarchy)
for example: C:\...\fltk
1.1.7\fltk-1.1.7\lib
Now you are ready to select Build Solution to compile the executable
(function key F5 will immediately execute the program)
Image file format: PPM:
The provided source code only supports ppm files, No matter if
greylevel or color image, these images will always have an RGB triple
for each pixel. The file format is (ASCII header, binary data):
P6
#Created by (this line may
not be there)
Nx Ny (width and height of the image)
255
Binary pixel data (RGB, RGB,… ) 3 bytes per pixel, from
the image bottom left to top right
Converting jpg, bmp, etc
images to the PPM format:
Download and use Irfanview, a
powerful public domain software that can so much more: image display and
editing, screen and window capture, and much much more.