Supercomputing Institute Technical User Support

 

IDL: Volume Visualization

  1. 3-D Transformations
  2. Visualizing an Iso-Surface
  3. The IDL Slicer
  4. Displaying a Surface with the Slicer

3-D Transformations

IDL can be used to visualize multi-dimensional volume datasets. Given a 3-D grid of density measurements, IDL can display a shaded surface representation of a constant-density surface (also called an iso-surface). For example, in medical imaging applications, a series of 2-D images can be created by computed tomography or magnetic resonance imaging. When stacked, these images create a grid of density measurements that can be contoured to display the surfaces of anatomical structures.
a=read_binary('/usr/local/rsi/idl_5.4/idl_5.4/examples/data/head.dat', $
data_dims=[80,100,57],data_type=1)
When creating 3-D plots (for example, surfaces, shaded surfaces, and volume visualizations), a three-dimensional transformation needs to be set up. The 3-D transformation applies the requested translation, rotation, and scaling to a 3-D plot before displaying it.  Three-dimensional transformations are especially important when using the POLYSHADE routine. Unless the transformation is set up such that the entire volume is visible, the volume will not be rendered correctly. Once a 3-D transformation has been established, most IDL plotting routines can be made to use it by including the T3D keyword.

There are a number of ways to set up a transformation matrix in IDL.  One way is that a transformation matrix can be entered explicitly into the system variable !P.T. This method is rather difficult, because you have to figure out the transformation yourself.

Another method, is the SURFACE and SHADE_SURF commands, which automatically create a 3-D transformation based on the datasets being visualized.

1. For example, specify a slice of the data:
slice=a[*,*,25]
2. Now surface the slice specified:
surface, slice

A number of different IDL procedures that simplify the creation of 3-D transformations can be used. Keyword arguments to some of these procedures allow you to set viewing angles and data ranges. The procedures then create the appropriate transformation matrix for you and store it in !P.T. These procedures include T3D, SCALE3, SCALE3D, and SURFR.

Visualizing an Iso-Surface

Two IDL commands, SHADE_VOLUME and POLYSHADE, are used together to visualize an iso-surface. SHADE_VOLUME generates a list of polygons that define a 3-D surface given a volume dataset and a contour (or density) level. The function POLYSHADE can then be used to create a shaded-surface representation of the iso-surface from those polygons.

Like many other IDL commands, POLYSHADE accepts the T3D keyword that makes POLYSHADE use a user-defined 3D transformation. Before you can use POLYSHADE to render the final image, you need to set up an appropriate three-dimensional transformation. The XRANGE, YRANGE, and ZRANGE keywords accept 2-element vectors, representing the minimum and maximum axis values, as arguments.The POLYSHADE function returns an image based upon the list of vertices, v, and list of polygons, p. The T3D keyword tells POLYSHADE to use the previously-defined 3D transformation. The TV procedure displays the shaded-surface image.  Enter the following lines:

1. Create the polygons and vertices that define the iso-surface with a value of 70.  Return the vertices in v and the polygons in p:
shade_volume,a,70,v,p,/low
2. Set appropriate limits for the X, Y, and Z axes with the SCALE3 procedure:
scale3,xrange=[0,80],yrange=[0,100],zrange=[0,57]
3. Display a shaded-surface representation of the previously generated arrays of vertices and polygons:
tv,polyshade(v,p,/t3d)

The IDL Slicer

Another useful volume visualization tool is IDLs SLICER3 procedure. The Slicer is a widget-based application that allows you to create iso-surfaces and pass cutting planes through 3-D datasets.

The IDL Slicer provides many other volume visualization techniques. As the name implies, the slicer allows you to look at slices through a volume dataset.

1. To use the slicer with dataset a, it is first required to pass in a pointer to the data set by entering the following at the IDL Command Line:
adata=ptr_new(a)
2. Then enter:
slicer3,adata
3. The IDL Slicer appears. The Slicer window will come up empty by default though the data is loaded. Be sure that the Mode pull-down menu is set to Slice which is the default. Position the pointer within the cube. Hold down the left mouse button and move the mouse.  An outline of the cutting plane appears.  This plane moves only in the direction indicated by the orientation display.
Move the cutting plane to the center of the volume and release the mouse button. A cross-section of the volume is displayed.

Note: These slices look smoothed because the slicer uses bilinear interpolation by default. Smoothing can be turned on and off by clicking on the Interpolation buttons.

4. To make slices in different orientations, move the cursor into the large drawing window and press the right mouse button.

5. Click the right button a second time to see the third possible orientation.

6. Make slices in these orientations by clicking on the mouse button and dragging the cutting plane outline to the desired location.

Displaying a Surface with the Slicer

To display a surface with the IDL Slicer, do the following:
1. To create a surface in Slicer similar to the one you created previously at the IDL command line, click on the Surface option on the Mode pull-down menu on the Slicer. A Surface Threshold window, a slider, and a number of new buttons should appear.

2. Click in the Surface Threshold and slide the determiner line to choose the Display button. A status window reports on the number of vertices and polygons generated and then the iso-surface appears.

When you are done experimenting with the Slicer, before continuing with other
sections in this tutorial, you should dismiss the Slicer window.

3. To exit the volume window, enter the following at the Command Line:
wdelete
4. To exit the IDL Slicer, choose the path File -> Quit.


 
This information is available in alternative formats upon request by individuals with disabilities. Please send email to alt-format@msi.umn.edu or call 612-624-0528.

HOME | QUESTIONS | FEEDBACK
Employment | Events | Links | People | Programs | Publications | Support | Welcome
 


URL: http://www.msi.umn.edu/software/fast/tutorial/fast-starting.html
This page last modified on Friday, 03 November, 2000,  09:10:02 CDT  
Please direct questions or problems to help@msi.umn.edu  
Website related questions or problems should be dirrected to webmaster@msi.umn.edu