Scientific Visualization Using AVS

by Chris Bentley

What is Scientific Visualization?

Scientific Visualization has emerged in the past few years as an important crossroads between computer science and the other sciences. Visualization uses computer graphics techniques to take numerical data, collected or synthesized by scientists, and translate it into images. The hope is that the images will allow important features in the data to be discerned much more readily than from the raw data.

AVS (Advanced Visualization System), described by Craig Upson [UPSON89], is one of the dominant visualization packages available today. AVS provides "modules" which each perform some visualization technique, and a user interface which allows these modules to be connected together in the manner of a flow chart. Data that is input to the system, is processed by the modules in the sequence ("network"), and then usually an image is produced. AVS thus implements a data-flow paradigm of scientific visualization. The AVS interface provides a form of visual programming language, in which the user can manipulate icons for the modules to build a new "flow program".

The image below shows both the raw data for field density values around a hydrogen atom, as well as the visualization of this data. The rendering encorporates several display techniques: isosurface rendering, and arbitrary slicing, to allow a user to develop a more intuitive grasp of the data.

Numeric Data Images

000 000 000 001 000 000 000 000
000 000 000 000 000 000 000 000
000 000 000 001 002 003 005 007
011 013 016 021 023 026 031 033
034 036 036 036 036 034 033 031
026 023 021 016 013 011 007 005

Fig 1. Hydrogen atom data

What kinds of data?

There are essentially no limits on the kinds of data that can be handled by visualization system in general, since in theory these systems can always be extended to process a new data type. AVS in particular handles the following data formats, as part of its base functionality:

What kinds of Images from 3D data?

Two dimensional data, such as readings taken from some surface, can of course be displayed as images. However, much of the data that AVS accepts is 3 dimensional in nature. Researchers working in computer graphics and visulaization have developed a large repetoire of methods for rendering 2D and 3D data. Among these methods are:

iso-surfaces rendering: In this technique, points in the data which share the same value(s) are connected together into a 3D surface. This is exactly analogous to drawing the contour lines on a topographical map. This method is usually performed using the "Marching Cubes" volume rendering algorithm. By selecting a specific contour value and shading the generated surface, the user can graphically explore the 3D shape of the data.

ray traced volume rendering: If the data is organized into a 3D grid of "voxels" (volume elements - analogous to pixels in 2D), then this method allows the lattice to be ray traced. As a ray travels through the grid, voxels intersected by the ray contribute to color of a pixel in the final image. By associating an opacity value with each cell in the lattice, the ray can "accumulate" an opacity value as it traverses the voxels, eventually stopping when the opacity has reached some defined limit. Varying the opacity limit allows the user to control how deeply the rays penetrate into the data, so the user can generate views of the data with different "depths".

cross-section images: Viewing the 3D data as a lattice of cells, this method intersects the grid with an arbirtrarily oriented plane. Then data points in the grid close to the plane are interpolated to compute the data values on the plane itself. The 2D data represented by the plane, can now be displayed as an image of the slice through the 3D volume.

bubbles: in this technique spheres of some size are rendered at each 3D data point in the volume of data.

etc ...

What is Visualization process?

In AVS, visualization is sees as consisting of four essential steps. In the first step raw numeric data is filtered so that we select data that is of interest to us. In the second step, the selected data may be transformed in some way to make it more meaningful. For example data from a microscope may need to be enlarged (scaled) for it to make sense to the viewed, or such data might need to be thresholded to eliminate "noise" in the data. The third step involved "mapping" this transformed data to some 3D geometric data type that can have the rendering techniques listed above applied to it. Fianlly, the fourth step is to render the resulting geometry.

Raw Numeric Data

Selected Numeric Data

Process Numeric Data

Geometric Data


What is AVS?

Now, having discussed visualization systems in general, let us turn to some of the specific features of AVS. AVS is a visualization "Swiss Army Knife". It provides pre-written executable modules to perform all the steps of the visualization process described above, namely:


The image below shows the organization of AVS modules on the screen. There are four main columns corresponding to the four module types. The user can scroll up and down in each of the columns which are menus. Once a desired module has been located the user can click the mouse button on the module's icon and "drag" the module into a workspace area.

Fig 2. AVS module palette


Once it is instantiated, each module can have control "widgets" associated with it, such as dials and sliders. Turning a dial or pressing a push-button will cause the module to recompute its data. Thus the widgets give the user control over the visualization process.

Fig 3. AVS widget controls


Modules have small, color coded "ports" on their upper and lower sides indicating what types of data they accept, and what types they output. By connecting "pipes" from the output port on one module to the input port on another, the user can specify the sequence of processing to perform on the data. Thus, AVS provides a user interface for linking modules into "networks". The network specifies how data flows between the modules. In the example shown below, in Fig. 4, the read field module reads data in from a file in disk. The generate colormap module outputs a table associating colors with certain numeric values. The field data flows from read field through the blue "pipes" to two modules: arbitrary slicer and volume bounds. The data is converted by these modules into geometric primitives which can be passed on to the geometry viewer module for final rendering.

Fig 4. AVS flow network

Programming in AVS

There are over 100 AVS modules already written; many visualization tasks can be performed by combining these modules into flow networks. The number of possible network permutations is huge. However, AVS can also be extended, by adding new modules written by the user or by third parties. AVS provides a C programming interface for writing modules. The structure of a module is very simple. It consists of 3 functions: an init function, a description function, and a compute function:

        /* tell AVS name of description function */

static int description_function()
        /* set module name */

        /* setup input/output ports & any widgets */

        /* tell AVS name of compute function */

static int compute_function( input, output )
        /* operate on input and output */


Finally, AVS and other visualization programs provide a very powerful tool to scientists. These systems let researchers translate data to images, and have led in part to an explosion in recent years in the use of computers to perform basic scientific research and simulations of physical processes.

Example: Generating an Image in AVS format

#include < stdio.h >
#include < sys/types.h >
#include < sys/stat.h >
#include < fcntl.h >
#include < limits.h >

#define WIDTH   400
#define HEIGHT  400

unsigned int image[WIDTH][HEIGHT];


        int x, y;

        for( y = 0; y < HEIGHT; y++)
            for( x = 0; x < WIDTH; x++ )
                image[y][x] = (x+y)%256;

        int             fd, y;
        unsigned int    width = WIDTH;

        if( (fd = open( "image.x", O_WRONLY|O_CREAT, 0777 )) < 0  )
                fprintf( stderr, "Error opening file\n" );
                exit( 1 );

        if( write( fd, (char*)&width, sizeof(unsigned int) ) < 0  )
                fprintf( stderr, "write error - width\n" );

       if( write( fd, (char*)&width, sizeof(unsigned int) ) < 0  )
                fprintf( stderr, "write error - height\n" );

        for( y = 0; y < HEIGHT; y++)
            if( write( fd, (char*)image[y], width*sizeof(unsigned int) ) < 0  )
                fprintf( stderr, "write error\n" );

        close( fd );


Upson, Craig, et. al., "The Application Visualization System: a computational environment for scientific visualization," IEEE Computer Graphics and Applications, July, 1989.

[Return to CS563 '95 talks list]

Chris Lawson Bentley
Fri Apr 28 14:54:17 EDT 1995