Applications               
AVS Manager : Simon Cunnington                Visualization                AVS Location : /vol/cvssp/avs/avs
               System               


This document is divided into two sections. The first section giving an overview of what AVS is and how to get it up and running on your system. It also provides information about inhouse developed modules for AVS. The second section provides information on how to develop modules for AVS.

Last Updated : 16th December 1997


Table Of Contents

    General Reference

  1. What is AVS?
  2. Modifications Required To Your System To Use Avs
  3. Running AVS
  4. Production Code Modules

    Developers Reference

  5. Gold System And Structure Of Modules
  6. Sample Modules
  7. Standards & Things To Watch Out For When Developing A Module
  8. Contributing An AVS Module


What is AVS?

The AVS software package is a large well-established commercial product for visualization. This runs only on the Suns, and has one site license per machine.

The following list gives you an idea of what AVS provides.

  1. Rendering : If you have a three dimensional surface made of flat polhedral facets, then you can visualize it as a `rendered' scene [ synthetic illumination of arbitrary colour, lighting, orientation ].
  2. Volumetric : Data can be visualized in a variety of ways.
  3. Modules : Avs allows the user to develop a module, where data flows along pipes connecting modules. This allows the possibility for several people to develop modules and integrate them into a system.
  4. Image Processing : Avs has a number of standard image processing modules, e.g. fft, threshold, etc.


Modifications Required To Your System To Use Avs

Before you use AVS you need to modify your .cshrc file in your home directory. Add the following to your .cshrc file.

set path=( $path /vol/vssp/avs/avs/bin )
setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/vol/vssp/avs/avs/runtime/sparc/SunOS5:/usr/ucblib"
setenv AVS_PATH /vol/vssp/packages/avs

Next create yourself an avs directory. In that directory create a .avsrc file containing something similar to the following. Just change the paths to reflect your home directory.

ModuleDirectory  /user/eevsspg2/eep2sc/Avs/modules
DataDirectory    /user/eevsspg2/eep2sc/Avs/modules
NetworkDirectory /user/eevsspg2/eep2sc/Avs/networks
Hosts            /user/eevsspg2/eep2sc/Avs/hosts

Of course you will also have to create the directories, modules and networks.

Next create yourself a softlink, so you can easily go and access the Production Code Modules , by doing the following.

ln -s /vol/vssp/avs/avs/local/modules/bin PublicAvsBins


Running AVS

To run AVS, first logon to a sun machine (such as smaug, kelvar, moria, naugrim) . Then change into your avs diretory. Then type "avs". Providing nobody else is using AVS on that machine, AVS will load. Otherwise the site license lock will be engaged and you will have to use another machine.

Site License Problem

There is a known problem that if somebody was running AVS, and it terminated abnormally, that there may still be processes forked off by AVS still running, meaning that the site license is still locked even though AVS itself is nolonger running. In this case you will have to ask that user to kill of that process(s). After thats been done, you will be able to run AVS.

For further information on how to use AVS refer to the following manuals :

which are located in 30AB22.


Production Code Modules

These modules are intended for general use.

ReadPolyh

ReadPolyh is the standard file loader using the AMMA library. It offers a Fast Load facility, a direct C-like read for speed when reading .tri files only and all other formats are automatically loaded via Polops.

DSlime

DSlime allows you to do Dynamic Slime.

ReadPgm

ReadPgm allows you to read a .pgm file and can be passed to the AVS Image Viewer via an AVS Network.

ReadCom

ReadCom allows you to read a .com file which allows you to easily do animations. From the geometry viewer you can connect the image viewer and store the frames. Then its just a case of using the any2mpg script.

Snake

Snake allows you to fit a spline curve to either a specified loaded image (i.e. a pgm file) or to a synthetic image (i.e. a square or arrow, these are hardcoded into the application). It provides the facilities to change various parameters controlling the fitting process dynamically.

VoxView

VoxView allows you to view any slice of a 3d object but shows this in a 2d representation.

ReadSlime

ReadSlime allows you to view a slime control mesh and change the mesh density dynamically.

SimpleVTR

This module takes a tri file as input (Infile), taking either a mesh comprising of 3 sided faces only or 4 sided faces only (NumSides), not a combination of 3 and 4 sided faces. It takes a variable Decimate which is used to decimate or refine the mesh.

Decimate > 0 is used for refining the mesh, while Decimate < 0 is used for decimating the mesh.

These variables are passed to the SimpleWrap module where they use the VTRingC class to do refining and decimation.


Gold System And Structure Of Modules

When an AVS module is created it consists of a file constructed by the module generator, e.g. ReadPolyh.c, DSlime.c. For the module to work addtional code must be added.

The Gold System provides modules with the abilities to import the surface and convert it to the AVS GEOM datatype. Hence this saves other module writers having to write the additional code to do these routines. If a module requires more additional code, then the module writer will have to write these routines which are strongly recommended to be stored in a separate file, from the one generated by the module generator.

The idea of the Gold system is to be able to reuse highly robust software. The module writer just has to create the soft links to the files that are required from the Gold system.

File descriptions :

ApolDefs.h

Provides standard data structure defintions required by the files below.

ApolAvs.h & ApolAvs.c

These provide the fast load read (.tri files only) function apol_cons_read(), and the function apol_dest_to_avs(), which creates a Geometry edit list (from the intermediate structure t_avs_polyh) for use by AVS. It also provides a function apol_cons_dummy() for aiding in debugging.

AmmaApol.cc & AmmaApol.hh

These provide a load routine apol_cons_read2(), which uses the Amma library (specifically PolopsC). It also provides a function apol_cons_polopsC(), which takes a PolopsC object and creates an itermediate data structure for Avs.

WARNING

If you are including the file AmmaApol.hh in the file generated by the module generator, then do the following.

   #define INSIDE_AVSMODULE 1
   #include "AmmaApol.hh"

The Sample Modules do not use the Gold System, but they do use similiar but basic code and these can be found in the Skel* files. The input routines differ, but apol_dest_to_avs() should be identical everytime.

The Gold System is located in /vol/vssp/avs/avs/local/modules/Gold


Sample Modules

Below are descriptions of sample modules. None of these modules use the Gold System.

Polyh

This is the simplest possible avs module exporting a geometry. A simple surface is hardcoded in the source.

SlimPolyh

A simple fast read of .tri file. If it loads in a 1 indexed file, problems will occur with AVS, the 3d model will look strange and the module will likely be terminated by Avs, or Avs will just bomb. This is because its a simple file read, and the standard for .tri files is to be 0 indexed; files that break this standard will very likely cause problems.

DynPolyh

A simple animation.

These are located in /vol/vssp/avs/avs/local/modules/

To look at more complex examples, of which some of them use the Gold System refer to the Production Code Modules .


Standards & Things To Watch Out For When Developing A Module

  1. Compile the module on the Suns only.

  2. If you are including the file AmmaApol.hh in the file generated by the module generator, then do the following.

        #define INSIDE_AVSMODULE 1
        #include "AmmaApol.hh"
           
  3. If your code (C wrapper, functions using C++ code or code that is compiled by a C++ compiler) is going to be used by an AVS module, then adhere to the following.

    Make sure that the function names are not renamed to C++ standards in the object file associated with that module and so therefore not causing linking errors when a C compiler/linker is looking for that function name.

        #ifdef __cplusplus
        extern "C"
        {
        #endif
    
    
          function1(......);
    
    
          function2(......);
    
    
        #ifdef __cplusplus
        };
        #endif
           

    Naming Conventions

    If the header file is associated with a .cc file then it should be a .hh file; and if the header file is associated with a .c file then it should be a .h file. This should be kept to even if the header file is included in a .c file; it automatically indicates to another programmer that the code related to the header file is either C or C++.

  4. Make sure that all AMMA / PERSONAL_AMMA code is compiled consistently, i.e. all compiled with debug/O2/ etc.

  5. The module generated stuff must not be compiled with O2.

  6. Always reload the module from scratch!


For further more detailed information about programming for AVS refer to the following manuals :

which are located in 30AB22.


Contributing An AVS Module

To contribute an AVS module, you need to see Simon who will install the module into the AVS system for you.


Maintainer : S.Cunnington@ee.surrey.ac.uk