Queen's University of Belfast

Parallel Computer Centre
AVS
An Introduction course
Acknowledgement
The original document was compiled and typeset by Steve Larkin and Andy Grant, Computer Graphics Unit, Manchester Computing Centre. Additional exercises and improvements to the original text were supplied by Naomi Hill.
On site modifications have been completed by L. Geoghegan
Overview
- Introduction to AVS
- AVS Modules
- AVS components
- The network editors
- Geometry viewer
- Importing Data into AVS
- MRI data type
- Command Line Interpreter
- UCD
Intro to AVS
- Application Visualisation System is produced by Advanced Visual Systems
- Visualization is a method of computing that has emerged from advances in visualization techniques, graphics s/w, networking and HPC
- AVS provides a large number of techniques for visualization
- AVS users can construct their own visualization applications by combining software components into executable flow networks
- The components called modules implement specific functions in the visualization cycle
- The flow networks are built from a menu of modules using a direct-manipulation, visual programming interface call the AVS Network Editor
- Can visualise different forms of scientific data, e.g., 2D images, volumes of data
- The geometry Viewer displays 3D geometrical objects. The image viewer displays 2D images
- AVS is extensible by allowing users to write modules in C or FORTRAN and integrate them into the system
- AVS is easily tailored, and applicable to a wide range of applications.
- can be used in various academic fields e.g medical to engineering
- An advanced course will cover module writing
Modules
- Modules are the "software building" blocks with well-defined interfaces
- The connections between the modules represent the flow of data among the modules
- A module is general in its functionality
- Modules take typed data as inputs and produce typed data as outputs
- The basic data types in the system are:
- 1D, 2D and 3D grids of numbers
- unstructured cell data
- geometric data
- images
- In addition to input and output data, modules also have parameters that control the modules's computation
- When AVS executes the network users are allowed to interact with the application
Application Building
in the network editor
- The Network Editor is a powerful, easy-to-use tool for quickly developing complex visualization processing networks
- The AVS network editor supports rapid prototyping of visualization applications
- The network editor allows the user to connect modules together to achieve a certain task
- These tasks include:
- Data input
- Filter + processing data
- Visualisation techniques
- Displaying graphical results
Network Editor

Network of Modules

Ex1 - Network editor
Geometry Viewer
- A geometry is a collection of points in 3D
space, along with additional information
- The geometries can enter the Geometry Viewer from two sources:-
- Can read.geom format files directly in to Geometry Viewer through the Read Object button on the Objects submenu
- Geometries can flow into the geometry viewer module from an AVS network.
- The geometry viewer displays 3D geometric objects by creating a 3D stage called a scene within which you view geometries
- It reads/saves objects & scenes (
.geom
)
- Can create multiple views of an object
- The geometry viewer allows manipulation of objects
- One can change the properties of an object
- Allows one to alter the lights
- Handles composite objects
- One can switch between rendering techniques
Geometry viewer panel
Geom Objects
- Objects are read into world space with the
Geometry Viewer's Read Object function
- Objects are organized into a hierarchy
- Each object has:
- its own object coordinate system
- Its own extents
- its own centre
- its own name
- its own surface properties
Manipulation of Objects
- You can transform the objects themselves (move, rotate, scale)
- left mouse button selects the object
- middle mouse button rotates the object
- right mouse button translates the object
- middle mouse button + SHIFT key scales the object
- more precise transformations can be specified by type-in widgets
Alterations of the Lights
- The original window of every scene is created with a uniformed, non-directional ambient white light.
- In AVS you can control the way the graphical images are rendered (lighting and shading).
- The "lights'' panel must be selected
- "Show Lights" provides a vector representation of the light direction
- The light colour, type and direction can be changed
Composite objects
- many scenes from AVS modules are composite objects e.g., isosurface, slice and volume bounds
- clicking the left button in an empty space selects the whole scene
- clicking on an object part selects it
- clicking in the small window cycles through the objects and scene
A composite scene

Software renderer
- All machine ranges support the software renderer
- The s/w renderer can produce many rendering capabilities e.g., transparency and texture mapping
- Software rendering implements its own graphics model (lighting, shading, texture mapping, clipping planes etc.)
- The software renderer allows AVS to display on an 8-bit remote display
Hardware Renderers
- The hardware renderer only provides a capability if the underlying graphics system supports it
- The hardware renderer provides the highest performance
- The user can switch between h/w and s/w renderers
- AVS attempts to use all of the graphics functionality present on a platform

Geometry Viewer
Ex2 - Geometry Viewer
Importing data into AVS
- The overall view
- Description of the data
- mapping methods
- describing data elements
- reading the data
- operators
- formats
- Some examples
AVS Data Types
- Primitive Data
- Byte, integer, single-precision floating point, double-precision floating point, text strings
- Aggregate Date
- Aggregate data is used by AVS to represent the data types for scientific and engineering data visualization
Field Data
- The AVS field datatype is used to represent arrays of data in AVS
- Each element of an array has a single data value or can a list of data values
- Field data is an n-dimensional array with an m-dimensional vector of values at each array location
- The data is described by an ASCII header file that defines the structure of the AVS field
- The header file can optionally contain data or reference the data file(s)
- Referencing the file(s) is a better way of working
Overall View

read_field
module
- The
read_field
module is used to import data into an AVS network.
- The
read_field
module has a file browser to select the header file.
- The read field module has two input modes:-
- native field input
- data-parsing input
Description of data
dimensions
- you must specify the dimensions of the data
- e.g., 1D: list of scattered data, 3D: volume of data
- these specify the computational space
- you must specify the dimensions of the data as it is passed to AVS
- these specify the coordinate space
Mapping methods
UNIFORM
- The data is not transformed as it is imported (direct & implicit)
- The dimensions of the computational and coordinate space should be the same
- A uniform field has no computational-to-
physical space mapping between data element.
- used to import regular arrays of data
- A field with no coordinates data for each of the data values is said to have the field type uniform
Uniform mapping
Mapping methods
RECTILINEAR
- Each dimension in the data has an explicit coordinate mapping
- The spacing along the coordinate axes can be non-uniform
- The dimensions of the computational and coordinate space should be the same.
Rectilinear mapping
Mapping methods
IRREGULAR
- For irregular there is no restriction on the correspondence between computational space and physical space
- Each data element is mapped to a point in the coordinate space.
- The dimensions of the computational and coordinate space can be different
- e.g., 1D scattered data into 3D space
Irregular mapping
Format of the header file
- the file should have an extension of
.fld
- the first line should be:
# AVS field file
- the rest of the file contains a number of keywords and values
Format
- all the format keywords must be on a single line
- in each of the examples a "-'' indicates that the line is continued below e.g.,
This is a very very very very very -
very long line.
- N.B., you cannot do this in the real header files though!
- the format keywords are also optional
Description of the data elements
- Specify the dimensions of the data
ndim
= number of dimensions in computational space
dim1
= specify the size of dimension 1, which can be thought of as the x dimension
- Example:-
ndim=3 #number of computational dimensions
dim1=40 #dim of axis 1
dim2=32 # dim of axis 2
dim3=32 # dim of axis 3
- Specify number of physical coordinates per point
nspace
= number of dimensions in coordinate space E.g
nspace=3 number of coordinates per point
- Specify number of components at each point
veclen
= number of data components per element
veclen=3 number of components at each point
- also the datatype e.g., byte,integer,float,double
- Other keywords
data
= type of the data components
field
= mapping method
label
= label for each data component
unit
= units for each data component
veclen = 2
label = pressure temperature
unit = kg/m**2 K
Reading the data
- once the data structure has been defined you specify the location and format of the data file(s).
- the data file(s) can be binary or ASCII
- there are three operators available to read the data.
Operators to read data
skip
: specifies the number of lines to skip before starting to read the data
offset
: number of columns to jump over before the data is read
stride
:
how many steps forward before the next item is reached. Assumes you are standing on the "data value" just read
Specifying the format
of the data
- each data component needs a line:
variable N < number of format keywords >
- each item of coordinate information needs a line:
coord N < number of format keywords >
- each line can reference different files
Format Keywords
file
= location of data file
filetype
= format of the data file, binary
or ascii
skip
=, offset
= and stride
= to read the data
- some examples will follow
Example 1: Image data
- The data set is a 2D image (512x256) consisting of greyscale values 0 - 255
- The data
0 10 0 15 200 255...
...
...
Solution for example 1
# AVS field file
#
ndim = 2
dim1 = 512
dim2 = 256
nspace = 2
veclen = 1
data = integer
field = uniform
variable 1 file=image.dat -
filetype=ascii skip=0 stride=1
Example 2: Volume data
- The data consists of a 3D array of density comps in a regular volume, 1283
- The file has a line of header info
- The data
Patient: Steve 10/11/93
0 255 2 1 7.
5 6.........
...
Solution for example 2
# AVS field file
#
ndim = 3
dim1 = 128
dim2 = 128
dim3 = 128
nspace = 3
veclen = 1
data = integer
field = uniform
variable 1 file=volume.dat filetype=
ascii skip=1 offset=0 stride=1
Example 3: Irregular data
The complete header file
# AVS field file
#
ndim = 2
dim1 = 5
dim2 = 10
nspace = 2
veclen = 2
data = float
field = irregular
label = temp press
variable 1 file=flow.dat filetype=ascii -
skip=0 offset=0 stride=2
variable 2 file=flow.dat filetype=ascii -
skip=0 offset=1 stride=2
coord 1 file=coord.dat filetype=ascii -
skip=0 offset=0 stride=2
coord 2 file=coord.dat filetype=ascii -
skip=0 offset=1 stride=2
Debugging
- A useful module to include in your networks is
print_field
- The module will display information on the header and data elements
The MRI Exercise
- This data file represents a MRI scan of the brain
- The dataset is 2D binary, containing 512x512 single scalar byes for each data value
- Has regular arrays of data
- i.e the data file is binary and the data is arranged contiguously with no header information
- the exercise is to examine each dataset
Importing the MRI data
Importing the MRI data
generate_colourmap
: provides a colourmap definition for other modules
downsize
: samples the data to decrease its overall size
color_range
: maps the colourmap to the extent of the data it receives
colorizer:
produces an image using the data values as an index to the colormap
Example of colorizer

Temperature profile Exercise
- Temperature profile is a series of float point values (ascii) containing data on a regular 31 x 31 grid
- This data represents temperatures taken from a cross section of an injection moulding system
- The data components at each element is a single floating point value and the first two numbers in the file indicate the X and Y dimensions of the grid respectively
- The exercise is to examine each dataset
Temperature profile

Modules
- generate_colourmap
- downsize
- color_range
field_to_mesh
: produces a 3D surface from a 2D array where the heights are produced from the data elements
geometry_viewer
: renders the output from field_to_mesh
Example of field_to_mesh
2D field exercise
3D Arrays Exercise
- importing a file of data showing the flow of air over a fin
- The data file is an ASCII file which represents an 10x8x8 irregular grid.
- Each element has five floating points data components
- Each element has some associated coordinate data to position it in 3D space
- The data format is as follows:-
density x-mom y-mom z-mom stag x y z
Field descriptor
ndim=
dim1=
dim2=
dim3=
nspace=
veclen=
data=
field=
variable 1 file=
variable 2 file=
variable 3 file=
variable 4 file=
variable 5 file=
coord 1 file=
coord 2 file=
coord 3 file=
Visualising scalar components
Visualising vector components
volume_bounds
module
- constructs a boundary around a 3D array of data
- it is useful to indicate your location in the array of data
- it allows you to switch on/off planes orthogonal to the axes
hedgehog
module
- displays velocity data by drawing vectors which indicate the direction and magnitude of the velocity
- you can add arrow heads to the vectors
- the scale and number of samples can be altered
- various probes can be selected e.g., point, circle, line, plane, space
Example of hedgehog
3D field exercise
AVS command line options
-version
which version are you running
-network
file start AVS to use the network specified
-nohw
use the software renderer (essential if running remotely via X)
-usage
what are the other options ?
-mod_time
unsupported feature for timing a network
AVS Command Line Interpreter (CLI)
- CLI Description
- The Image viewer, Geometry Viewer, Graph Viewer and Network viewer can also be driven through a Command language Interpreter(CLI).
- You can type CLI commands in response to a prompt and interactively view the results
- you can create a command script file that executes automatically.
- to record a session use
avs> script -open myscript
- to stop recording use
avs> script -close
- to playback use
avs> script -p myscript
A sample CLI script
net_clear
module "read image.user.0" -xy 230,73 -ex $Path/avs_library/mongo
module contrast.user.1 -xy 230,129 -ex $Path/avs_library/mongo
module "display image.user.2" -xy 230,185
port_connect "read image.user.0":0 contrast.user.1:0
port_connect contrast.user.1:0 "display image.user.2":0
parm_set "read image.user.0":"Read Image Browser"
usr/avs/data/image/avs.x
parm_set contrast.user.1:cont_in_max 178.171722412
parm_set contrast.user.1:cont_out_min 78.480216980
script -close
Obtaining hard copy from AVS
- connect the module
image_to_postscript
to the geometry_viewer
module
- you can specify landscape or portrait
- you can alter the size in inches
Practical uses
Customising AVS
- when AVS starts up it looks for the file
.avsrc
in your home directory
- if this file does not exist it uses the file
/usr/avs/runtime/avsrc
- this file sets certain default attributes in AVS
The .avsrc file
Path /usr/local/avs
NetworkDirectory /usr/avs/networks
DataDirectory /usr/avs/data
NoHW 1
Bounding Box off
What is unstructured cell data?
How does AVS provide support?
- Unstructured Cell Data (UCD)
- NODES: contain data and position
- CELLS: have a geometric shape and reference nodes
- STRUCTURE: a collection of cells
A closer look at UCD
- data at each node can be a collection of scalar and vector quantities
- the data can have labels and units
- each cell has a shape, material and cell data associated with it
Importing UCD data
- you can write a reader using the
UCD
routines to parse your data file and create the appropriate UCD structure
- this is the preferred method but is not covered in this course
- AVS has a module
read_ucd
which imports ASCII files (.inp
)
- you can change your data to match this format
An example of a .inp
file
8 1 1 0 0
1 0.0 0.0 1.0
2 0.0 1.0 0.0
...
8 0.0 1.0 0.0
1 1 hex 1 2 3 4 5 6 7 8
1 1
stress, lb/in**2
1 499.999
2 567.888
...
8 5000.00
A sample UCD network
Other modules
- cropping and slicing (
ucd_crop
& ucd_rslice
)
- vector data (
ucd_hedgehog
& ucd_streamlines
)
- debugging (
ucd_print
)
- isosurfaces (
ucd_iso
)
Closing Comments
We have covered!
- Modules
- AVS subsystem
- Network system
- Geometry viewer
- Read and defining data files
- Command lIne operations
- Unstructured Cell Types
- Not - Writing modules in C and FORTRAN
All documents are the responsibility of, and copyright, © their authors and do not represent the views of The Parallel Computer Centre, nor of The Queen's University of Belfast.
Maintained by Alan Rea, email A.Rea@qub.ac.uk