AVSLabs(2)
-
Upload
monica-castro -
Category
Documents
-
view
215 -
download
0
Transcript of AVSLabs(2)
-
8/12/2019 AVSLabs(2)
1/88
1
Exercises for Scientific Visualization with
AVS/ExpressScience & Technology Support Group
High Performance ComputingOhio Supercomputer Center
1224 Kinnear RoadColumbus, OH 43212
-
8/12/2019 AVSLabs(2)
2/88
2
Contents
Project Creation and Download The Network Editor & Data Viewers I The Network Editor & Data Viewers II The Network Editor & Data Viewers III Importing Data I Importing Data II Images and Animations
-
8/12/2019 AVSLabs(2)
3/88
3
Project Creation and Download
In this lab you will download and install the workshop projectfiles
This should only be done once after installation you will haveeverything you need to complete all the other exercises
After this lab you should be familiar with
Starting AVS/Express Saving an AVS/Express project The avsenv file
-
8/12/2019 AVSLabs(2)
4/88
4
Running AVS/Express under Unix
AVS/Express requires that certain environment variables be setbefore it can be run. The most important of these are
LM_LICENSE_FILE Must point to the FLEXlm license file
XP_FEATURE Must be EXPRESS (for the Developers Edition) or VIZ_EXPRESS (for
the Visualization Edition) MACHINE
AVS/Express machine architecture specification ( sgi , sgN32 , ...) LD_LIBRARY_PATH
Should point to the directory lib in the AVS/Express installationdirectory
Ideally this is done automatically by a script (here we usevxp ), which sets these variables and then runs the program
-
8/12/2019 AVSLabs(2)
5/88
5
Running AVS/Express under Windows
For Win9x/NT, the most important environment variables are LM_LICENSE_FILE
Name of the FLEXlm license file (e.g. C:\flexlm\license.dat ) XP_FEATURE
Must be EXPRESS (for the Developers Edition) or VIZ_EXPRESS (forthe Visualization Edition)
MACHINE Should be set to pc
Ideally this is done automatically by a script which sets thesevariables and then runs the program
If you obtain AVS/Express through OSC, a basic script
run_xp.bat is provided
-
8/12/2019 AVSLabs(2)
6/88
6
Creating a Project for this Workshop
Type vxp to run AVS/Express Delete the MultiWindowApp that is created upon startup Note that the current project (visible in the VCP and the top
window bar) is the default project, something like/usr/local/express
Select Project > Save As... Choose a directory name for your project, for example
/home/wrk001/XPtrain AVS/Express will create the directory for you if it doesnt already
exist
Exit AVS/Express (using File > Exit) Change to the project directory Restart AVS/Express to verify that you are in the new project
-
8/12/2019 AVSLabs(2)
7/88
7
The avsenv File
The file avsenv in the project directory indicates the projectsderivation hierarchy
This indicates that the project /tmp/XPtrain is derived fromthe default (read-only) project /usr/local/express64
It is often necessary to modify this file when installing a projectfrom another user, as the directories are not necessarily correct
on your machine This should be the only thing you have to do, assuming all file
references in modules are relative (to the project directory)
gromit$ more avsenv# WARNING: this file is program generated.# Remove these two lines to protect the file from overwrites.XP_PATH=/tmp/XPtrain /usr/local/express64
-
8/12/2019 AVSLabs(2)
8/88
8
Download Class Project Files
The workshop project files are available at
Be sure to unpack the files in the project directory you created Check the avsenv file to see if it is correct; edit if necessary
Restart AVS/Express in the project and verify that the workshoplibraries are visible. There should be three new ones: IAC ,Lectures and Labs
System Format Unpacking command
Unix tar.Z zcat class-prj.tar.Z | tar xvf -
Unix tar.gz gzip -cd class-prj.tar.gz | tar xvf -
Windows zip Use WinZip or unzip class-prj.zip
-
8/12/2019 AVSLabs(2)
9/88
9
The Network Editor & Data Viewers I
In this exercise well load some sample networks and becomefamiliar with the basic data viewer and user interface controls
After this lab you should be familiar with Loading applications Using the module user interfaces Transforming the view
-
8/12/2019 AVSLabs(2)
10/88
10
Start up AVS/Express
Start AVS/Express Find and delete the Multi-window application
A MultiWindowApp comes up by default. This consists of onewindow with many colored user interface icons on its left side, andthe main AVS/Express window which should say AVS/Express aspart of its title bar. In the lower part of the AVS/Express window,also known as the the Application Workspace, you should see asub-window titled MultiWindowApp .
Delete this MultiWindowApp application by right-clicking on its sub-window's title border in the Network Editor, then selecting Deletefrom its pop-up menu.
-
8/12/2019 AVSLabs(2)
11/88
11
Load an Application
Next, read in a sample application Select the Examples library Find the Advect module under the Visualization sub-library. You
may need to first double click the Visualization sub-library in orderto open it.
Left-click on Advect , then drag it down into the applicationworkspace
Advect is a MultiWindowApp , so you will see the network thatcreates this image, the image itself, and the editor panel thatcontains the module UIs in separate windows
-
8/12/2019 AVSLabs(2)
12/88
12
Explore the User Interfaces
Locate the UI for the advector module and experiment withchanging parameters Look in the module stack for the advector module
At the bottom of the UI there is a Run toggle that produces ananimation of the fluid flow
You can also vary the size of the arrows using the Glyph Scaleslider
Examine the UIs for the other modules in the network
-
8/12/2019 AVSLabs(2)
13/88
13
Transformations
Next, experiment with the transformation buttons Rotate, scale, and translate the object Note the behavior of Reset, Normalize and Center Set the object spinning and then toggle between Hardware and
Software rendering. See if there is any difference in renderingspeed.
To spin the object, rotate it and release the mouse button while themouse is still moving
Try turning on perspective Explore other sample visualizations, for example
Surf_plot PolarGraph (in the Graph_Macros sub-library)
Orthoslice TextGlyph
-
8/12/2019 AVSLabs(2)
14/88
-
8/12/2019 AVSLabs(2)
15/88
15
Create a New Sing l eWindowApp
Start AVS/Express Delete the MultiWindowApp that starts by default Create a new SingleWindowApp
Select File > New Application... Choose a Single-window data viewer with a 3D viewer type If you wish, set the Single-window application with 3D viewer as
the projects default application
The new application begins with a single object instanced theviewer
Study the object libraries. Most of the useful modules are inMain , Accessories and Standard Objects
-
8/12/2019 AVSLabs(2)
16/88
16
Using the Object Finder
In the example network we will build here, we wish to visualizethe electron density in a particular hydrogen atom orbital. Wewill take a slice through the atom and observe differing electrondensities throughout the atom. This and the next few slides willcover the steps needed to find appropriate modules, connectthem together to form a complete network, and save thenetwork to disk.
When selecting modules for a network, you can either scrollthrough the sub-libraries until you locate the correct one, oralternatively you can use the Object Finder to search for aspecific module.
-
8/12/2019 AVSLabs(2)
17/88
17
Using the Object Finder
To use the Object Finder, chooseObject > Find in All Libraries The finder dialog box appears Type the name of the object you
are looking for in the search boxand click on Find
Use the wildcard * to match anycharacters
surf_ matches only this string surf_* matches anything that
begins with surf_
To highlight the location of themodule in the network editorlibrary, click on Show
-
8/12/2019 AVSLabs(2)
18/88
18
Instantiate Modules
Find the Read_Volume module, which is located in the Data_IOlibrary. This module reads a volume format file and converts it toa 3D AVS/Express field.
Instantiate a Read_Volume object by dragging it into theapplication workspace
Instantiate a slice_plane object (located in the Mappers sub-library). This module extracts a 2D slice from a 3D field with anarbitrarily positioned slice plane.
Instantiate a bounds object (located in Mappers as well). Thisgenerates a bounding box around a 3D field.
-
8/12/2019 AVSLabs(2)
19/88
19
Create Data References (Connections)
Connect the modules together as shown:
Check the object Info (use the pop-up menu on each object) tosee what sorts of data the various ports refer to Practice disconnecting modules too
-
8/12/2019 AVSLabs(2)
20/88
20
Read in a Data File
The user interface for Read_Volume contains a file browser To access the UIs, select Editors > Modules and then use the pulldown list (the module stack) to select the module of interest
Click on Browse Navigate to the AVS/Express install directory
Probably /usr/local/express under Unix Often C:\Express under Windows
Continue down to the subdirectory data/volume Select the file hydrogen.dat Click on Okay
-
8/12/2019 AVSLabs(2)
21/88
21
View Completed Application
-
8/12/2019 AVSLabs(2)
22/88
22
The Network Editor & Data Viewers III
In this exercise you will explore additional techniques of the AVS/Express Network Editor and Data Viewer, including Modifying Data Viewer Object Properties Using Multiple Scenes Manipulating Objects Individually Alternate Object Rendering
-
8/12/2019 AVSLabs(2)
23/88
23
Modifying Object Properties Load the application CubeCyl.v
Use File > Load Application... The V file is located in the data subdirectory of the class project
Experiment with transforming the display Make the cube copper colored
The color of the object is one of its properties. Go into the Data
Viewer's Object Editor to access it The user interface for the object's color is under Properties (still in
the Object Editor), General Type Values that approximate copper for the three color dials are:
Hue 0.06, Saturation 0.80, Value 0.60
Note that the option menu in the upper-left corner of the panelshould indicate Object, not Alternate
-
8/12/2019 AVSLabs(2)
24/88
24
Modifying Object Properties
Next, make the cube surface look like real copper by adjustingits surface properties Select Type > Surface in the Object Editor Experiment with different values for Metal, Diffuse, Specular and
other sliders
Next change the background color This is a property of the view , not an object, so invoke the View
Editor , General . See if you can set the color dials to producepurple.
-
8/12/2019 AVSLabs(2)
25/88
25
Using Multiple Scenes
To add a 2D scene, go to the Scene page of the View Editor Specify "2D" as the camera type and "New objects" as the
Object Mode, then click on the Create button. This creates anew scene in the SingleWindowApp . Once the scene is created,look at the Uviewer3D object in the Network Editor. A secondinput port has been added. This is the port for the 2D camera.
Next, add a glyph to the new scene Instance Main.Geometries.Arrow2 and connect it into the new 2D
input port of the Uviewer3D.
Now you can switch scenes between the cube and the arrow Use the radio buttons in the Windows pull-down menu (of the Data
Viewer) to switch between scenes.
-
8/12/2019 AVSLabs(2)
26/88
-
8/12/2019 AVSLabs(2)
27/88
27
Alternate Object Rendering
Taking advantage of the alternate object capabilities of AVS/Express is a powerful technique for speeding up itsrendering performance during object transformations, especiallyif you have a scene with a huge number of polygonal objects.
Load the application CubeCyl.v
Make sure the cube is the selected object Enable alternate object rendering
Check Alternate Object Enable in the Editors/Object/General panel
Now you can modify the alternate objects properties
-
8/12/2019 AVSLabs(2)
28/88
28
Alternate Object Rendering For example, to make it a wire frame mesh:
Select Modes (under Editors/Object) Use the Edit option menu at the top of this panel to specify
Alternate This indicates that the values you set on this Modes panel apply to the
alternate object for the cube (since it is the selected object), not to thecube itself.
Set Line Rendering to Regular Set Bounds Rendering to None
To make the wire frame mesh green: Specify Alternate using the option menu in the upper-left of the
Editors/Object/Properties panel. Make sure the Type menu is set to General, then adjust the color
dials. To produce green, set: Hue = 0.33, Saturation = 1.00, Value = 1.00
Try rotating the cube. Do you see the green wire frame?
-
8/12/2019 AVSLabs(2)
29/88
29
Interact with the Application
Experiment with the view transformations Access the UI for slice_plane and try changing the parameters
there Clicking on Plane Transform Editor brings up a panel with sliders
that allow you to change the plane position and orientation The distance slider moves the plane in a direction normal to itself
Try opening the slice_plane module directly in the NetworkEditor Edit the parameters directly by opening sub-objects and entering
the new value(s)
-
8/12/2019 AVSLabs(2)
30/88
30
Save the Application
Networks can be saved as an application that can be read backin at a later time, perhaps in a subsequent AVS/Expresssession. The files are stored in ASCII format, and use the Vlanguage.
To save the application Highlight the title bar of your network's application workspace by
left-clicking on it. This selects the network to be saved. Select File > Save Application Its convenient (but not necessary) to save the file in the v
subdirectory of the project Give the file a name (should end in .v )
Examine the resulting V file with your favorite text editor
-
8/12/2019 AVSLabs(2)
31/88
31
Delete and Load the Application
To delete the application from the Network Editor, highlight thetitle bar of your network's application workspace by left-clickingon it. This selects the network to be deleted. Then either Select File > Delete Application... Right-click on the title bar of the application and choose Delete
from the pop-up menu
To re-load the application, select File > Load Application Use the file browser to select the V file you saved previously
-
8/12/2019 AVSLabs(2)
32/88
32
Additional Things to Try
Delete individual objects in the application workspace using thepop-up menu Rename some objects Access object Info and Help
Note that Info shows the object template (i.e. its type) even afterit has been renamed
Note that in Info/Help the ports are listed with the leftmost port atthe top and the rightmost at the bottom
-
8/12/2019 AVSLabs(2)
33/88
33
Another Application
In this exercise you will build a network to read and displayimage files Begin by creating a new application (either Single- or Multi-
window) with a 2D viewer Build the network:
-
8/12/2019 AVSLabs(2)
34/88
34
View Image Files
Use the Read_Image UI to load several image files Set the image format to avs.x With the file browser, navigate to
/Express_install_dir/data/image Select an image file to read
Can you figure out what downsize and crop are doing? Try
changing some of the parameters in their UIs to find out. (Youcan also consult Help for these modules, of course!)
Save the application, delete it from the Network Editor, and readit back in
-
8/12/2019 AVSLabs(2)
35/88
35
Importing Data I
In this lab you will practice some techniques for importing datainto AVS/Express. Topics include: Basic mesh creation Using a saved object to read data Using the Add File Import Module tool
-
8/12/2019 AVSLabs(2)
36/88
36
Non-Cartesian Field
Well begin by creating a 2D field expressed in cylindricalcoordinates: Instance an Accessories.Field_Schema.Field_Cyl_Unif object in
an application with a 3D Data Viewer The Field_Schema modules are basically pre-packaged Field objects
of various kinds
Using the pop-up menu (accessed by right-clicking on the object),open the Object Editor Set nspace = 3 Set ndim = 2
We thus create a 2D mesh that lives in 3 space dimensions Set dims = {5, 16}
This is a uniform mesh, so we need only specify the number of pointsin each dimension and the low and high values of each. This specifies5 points in radius and 16 points in theta.
-
8/12/2019 AVSLabs(2)
37/88
37
Non-Cartesian Field
Set points = { {1, 0, 0}, {5, 3.14159, 0} } The ( radius , theta , z ) values for the endpoints of the mesh Set nnode_data = 1
The number of node_data items at each node Set node_data[0].veclen = 1
The vector length of the node_data item. A value of 1 indicates a
scalar value. Note that you must open the node_data sub-object toaccess this and the following variable Set node_data[0].values = 1.0
Note that AVS/Express fills out the array of values for youautomatically
Note also that the reference operator is used implicitly here when youenter 1.0, i.e. the Object Editor sets the value in the field to => 1.rather than = 1.. Using the reference, the array will automaticallyadjust its size if the dimension (here 5*16 = 80) were to change.Using the assignment, its size would forever be fixed to 80.
-
8/12/2019 AVSLabs(2)
38/88
38
Non-Cartesian Field
Add an output port to theField_Cyl_Unif object Either use the Object Editor,
or select Add Output Port inthe pop-up menu
Finally, render the field Create the network shown
Using the View Editor, see ifyou can make your image looklike this Hint: See the previous lab in
which we set up a wire framealternate object
-
8/12/2019 AVSLabs(2)
39/88
39
Non-Cartesian Field
Next we will create a 3D field expressed in cylindricalcoordinates Instance a new Field_Cyl_Unif and set these values:
nspace = 3 ndim = 3 dims = {5, 16, 10}
points = { {1, 0, 0}, {5, 3.14159, 10} } // {radius, theta, z} nnode_data = 1 node_data[0].veclen = 1 node_data[0] values = 1.0 (Base type: float)
Render the field as before
You might experiment with both external_faces and Accessories.Graphics.Modules.DataObject
-
8/12/2019 AVSLabs(2)
40/88
40
Non-Cartesian Field
Try to make your image look something like this:
For extra credit, create a 3D field expressed in sphericalcoordinates (see Accessories.Field_Schema.Field_Spher_Unif )
-
8/12/2019 AVSLabs(2)
41/88
41
Using a Saved Object to Read Data
In this part of the lab, you'll use an object already designed andsaved to a V file on disk. You can read this object into a libraryworkspace, then use it to read a data file into an AVS/Expressnetwork.
Begin by selecting an editable library Select Library Workspaces from the Libraries pull down menu,
then highlight Workspace 1 by single left-clicking on its title bar.Newly created module templates will be placed into this highlightedlibrary.
Next, select Object > Load Objects and load the Read_Dataobject. It is defined in the file Read_Data.v which is in the
data subdirectory The object template is now available in this library and you cancreate instances of it in the usual way
-
8/12/2019 AVSLabs(2)
42/88
42
Using a Saved Object to Read Data
Next, construct the following network (create an application witha 3D viewer). Read in the file DataFile.dat which is also inthe project data directory.
-
8/12/2019 AVSLabs(2)
43/88
43
Using a Saved Object to Read Data
The image should look something like this:
-
8/12/2019 AVSLabs(2)
44/88
44
Using a Saved Object to Read Data
Open the Read_Data module using the Object Editor. Examinethe objects defined within the module and make sure youunderstand what it is doing. Refer to the layout of the data file.
Remove the leading space character before the first "2" in thefile. Save the file and re-read it. What happens? Make thenecessary corrections in the Read_Data module to keep theapplication working correctly. Try making some other changes.
-
8/12/2019 AVSLabs(2)
45/88
45
Using a Saved Object to Read Data
Change the data: Create a data_math object and insert it into the network as shown.Be sure to connect the combine_mesh_data output to the first twoports of data_math :
-
8/12/2019 AVSLabs(2)
46/88
46
Using a Saved Object to Read Data
The data_math module allows you to perform mathematicaloperations on the data in a field. Check Help for this object tosee how it works.
Set some expression, for example sin(#2*#1)*(#1*#2) , inthe data_math module and observe its effect
Finally, add some glyphs (geometric shapes) at the nodes of themesh Instance a glyph object and a Box object
glyph attaches a shape to each node in a field; Box is the actualgeometric object
Note that glyph takes two inputs: a field and a glyph (a shape).Connect the field output of data_math and the output of Box to theappropriate glyph input ports. The red output port contains therenderable image of the boxes; connect this to the viewer.
-
8/12/2019 AVSLabs(2)
47/88
47
Using a Saved Object to Read Data
Experiment with the Box objects transformation editorto set its scale, as well as theglyph objects scale parameter(see the UIs for these objects)
-
8/12/2019 AVSLabs(2)
48/88
48
Using Add File Import Module
In this exercise you will build a module to read the filesplash.asc located in the data directory of your class project.This is a an ASCII file consisting of 100x100 floating pointnumbers with the following layout:
The file begins with the number of elements in the X and Ydirections, nx and ny, followed by nx*ny rows, each with threecolumns: i j data .
100 100
1 1 -69.011552 1 -66.26960: : :: : :100 100 -49.37508
-
8/12/2019 AVSLabs(2)
49/88
49
Using Add File Import Module Generally, before you invoke the Add File Import Module tool to
describe your file format, you select module(s) appropriate forprocessing the data later on in the network. In this case, wewant to create a 2D (computational space is 2 dimensional) 2-space (2 physical dimensions) uniform scalar field. Then we'llmap it into three dimensions by scaling it in the Z direction
according to the data values. An good module to create the fieldis Accessories.Field_Mappers.uniform_scalar_field , which takesas input a dimensions array and a data array. From there, theresult can be sent to Main.mappers.surf_plot , which will map itinto three dimensions, and then to a viewer. Here your maintask with the Add File Import Module will be to create thedimensions and data arrays for use by the uniform_scalar_field module.
-
8/12/2019 AVSLabs(2)
50/88
50
Using Add File Import Module Select an editable library to hold the new module, for example
Library_Workspaces.Workspace_1 Select Library Workspaces from the Libraries pull down menu,
then highlight one of those workspaces (such as Workspace 1 ) bysingle left-clicking on its title bar.
Select Object > Add File Import Module
Note that if this option is grayed out it most likely means you havenot selected an editable library to hold the module
You will be presented with a dialog sequence to describe thedata layout to AVS/Express. Look again at the structure of thedata file splash.asc
-
8/12/2019 AVSLabs(2)
51/88
51
Using Add File Import Module We will need two File Variables:
dims[2] An array of ints to hold the X and Y dimensions
data[prod(dims)] An array of floats to hold the data values
Note that we do not need to read the coordinate values (i j);
since we are using a uniform field AVS/Express will constructthese for us
We could use an offset variable to skip the first line whenreading the data values, but in this case it is easy to determinethe offset by hand. There are 8 characters from the start of the
file to the first line of data, so the offset is 8 (bytes). Dont forget the (invisible) newline at the end of the first line!
-
8/12/2019 AVSLabs(2)
52/88
52
Using Add File Import Module For dims[] , set
base type int , Object is an array, dimensions [2], variablestored as ASCII, data type int , offset 0 (since the dims start atbeginning of file), number columns in file 2, and check Column #0and Column #1.
For data[] , set
base type float , Object is an array, dimensions [prod(dims)],variable stored as ASCII, data type float , offset 8 (since the dataarray columns start after 8 characters of the file), number columnsin file 3, and check Column #2.
Note the ability to use built-in functions [e.g. prod(dims) ] in Vcommands
When you are finished, the template for the new moduleappears in the library you selected
-
8/12/2019 AVSLabs(2)
53/88
53
Using Add File Import Module You can use the VCP to verify that the reader is working
correctly Create a new application Instance a Splash_Reader Use the file browser in the module UI to load splash.asc In the VCP, drill down to the reader object Use the V commands $list , $get_array and $sub_array to
check the contents of the arrays
-
8/12/2019 AVSLabs(2)
54/88
54
Using Add File Import Module
Now use the new reader. Create a new application with a 3Dviewer, and construct the following network. Read insplash.asc using the file browser in the Read_Splash UI.
-
8/12/2019 AVSLabs(2)
55/88
55
Using Add File Import Module
Before leaving this lab, save the reader you have built. You cando this in two different ways: Select Project > Save . This saves the current project environment
including the new module you have added. When you restart AVS/Express in this project, Splash_Reader will be immediatelyavailable in the library.
Highlight Splash_Reader in the library workspace and selectObject > Save Objects.... This saves the object template in a Vfile. In this case, when you re-start AVS/Express in the currentproject the module will not appear immediately; it must be re-loaded into an editable library before it can be used.
-
8/12/2019 AVSLabs(2)
56/88
56
Using Add File Import Module In this exercise, you will visualize scattered (unstructured) data
representing concentration. There is one data value per gridpoint, with a 1D array of data points which are randomlyscattered in 3D space.
The data is stored in the ASCII file conc.dat (again in theworkshop data subdirectory) which has a simple columnformat:
The first entry is the number of data points; the subsequentcolumns contain the x, y, z coordinates of a node and the datavalue at that point
100018.37 5.00 10.00 .0618.94 5.00 10.00 .07: : : :
-
8/12/2019 AVSLabs(2)
57/88
57
Using Add File Import Module Here you can use point_mesh to create the unstructured mesh.
This requires as input an array coords[nnodes][nspace]containing the node coordinates.
To create scalar node data you can use the node_scalar module, which takes as input a single array data[nnodes] .
You should then combine the mesh and data into a field usingcombine_mesh_data
A convenient way to attach a sphere to each node, with radiusand/or color set according to the data value at that point is touse the module BubbleViz
-
8/12/2019 AVSLabs(2)
58/88
-
8/12/2019 AVSLabs(2)
59/88
59
Importing Data II In this lab you will practice some further techniques for importing
data into AVS/Express. Topics include: Using AVS/Express Field Files Using the Read_Column_File module
-
8/12/2019 AVSLabs(2)
60/88
60
Using AVS Field Files The AVS Field file format is useful when you have binary or
ASCII data in a file that can be described by a simple header. AVS/Express provides a module called Read_Field that readsfiles stored in this format.
Examine some sample field files, for example helens1.fld (a 2D, 2-space uniform field)
hydrogen.fld (a 3D uniform field with data in byte format)both of which are in /AVS_install_dir/data/field
-
8/12/2019 AVSLabs(2)
61/88
61
Using AVS Field Files Create a field file to describe the data in splash.asc:
This data consists of the number of elements in the X and Ydirections, nx and ny, followed by nx*ny rows, each with threecolumns: i j data .
It corresponds to a 2D, 2-space uniform scalar (one data itemper node) field
100 1001 1 -69.011552 1 -66.26960: : :: : :100 100 -49.37508
-
8/12/2019 AVSLabs(2)
62/88
62
Using AVS Field Files Once the header file is created, build an application that reads
the file and displays a surface plot based on the data values
If you are having trouble with the header, check the solutionsplash.fld in the data sub-directory
-
8/12/2019 AVSLabs(2)
63/88
63
3D Field File Lobster X-Ray Data In this part of the lab you'll create a field file to look at a volume
data set representing uniformly spaced 3D imaging data The data is located in the file lobster.dat in the class project
data directory It is a binary data file (byte format) The mesh is uniform with ndim=3 and nspace=3
The mesh dimensions are dim1=120 x dim2=120 x dim3=34 It is a scalar (veclen=1) field The first three bytes of the file are the dimensions, the rest is the
data
Create a suitable field header lobster.fld for this data file Use the Read_Field , bounds and isovolume modules to
visualize the data
-
8/12/2019 AVSLabs(2)
64/88
64
3D Field File Lobster X-Ray Data
If you have trouble creating the field file, see the solutionlobster.fld in the workshop data directory
-
8/12/2019 AVSLabs(2)
65/88
65
Read_Column_Fi le
In this lab you will use the Read_Column_File module to readdata in a simple columnar format
We will be working with the files AIR_Quality.data anddata1 in the training data directory
Begin by creating a new application (with a 3D viewer) andinstancing a Read_Column_File object
Examine the data in the file data1 There are 32 rows and 4 columns. The first three integers of each
row are the coordinates of the data value. The last value on eachrow is the data value.
The data is uniform, so we will use table_to_uniform_field to
create the field object
-
8/12/2019 AVSLabs(2)
66/88
66
Read_Column_Fi le
Construct the following network:
In the Read_Column_File UI, set up the columns. When youare finished, click the Read File button at the bottom of the UI.
-
8/12/2019 AVSLabs(2)
67/88
67
Read_Column_Fi le
Before proceeding, disable execution by clicking on the interruptexecution button in the SingleWindowApp This button controls whether the modules in your network
(including the data viewer window's contents) are active. When it isred, none of the modules in your network will execute. Also, allviewer window operations are turned off you can not rotate,transform, or otherwise manipulate the image interactively.
Execution toggle
-
8/12/2019 AVSLabs(2)
68/88
68
Read_Column_Fi le
Set up the parameters fortable_to_uniform_field Columns 0, 1 and 2 are the
axes X, Y and Z,respectively. Column 3 isthe data.
Click on the execution toggleto re-enable execution Adjust parameters in the
other modules, in particularisosurface , solid_contour ,and orthoslice
-
8/12/2019 AVSLabs(2)
69/88
-
8/12/2019 AVSLabs(2)
70/88
70
Images and Animations In this lab you will explore techniques for creating and exporting
AVS/Express visualizations in several image and animationformats. Topics include: Exporting Images Exporting PostScript Exporting VRML The Loop Module Keyframe Animation with animator Saving Movies with Image_Capture Time Series Field Files Particle Animation
-
8/12/2019 AVSLabs(2)
71/88
71
Exporting Images It is easy to generate 2D images for collaborations and web
pages using AVS/Express. Here you'll experiment with theOutputImage module
Create the network
-
8/12/2019 AVSLabs(2)
72/88
72
Exporting Images Read the file hydrogen.fld (in
/AVS_install_dir/data/field )
Save the view to an image file From the OutputImage UI, select a
file format (GIF or JPEG is good)
Use the file browser to set afilename
Check that the flip toggle is not set(this will flip the image upsidedown)
Click on Write File to output the
image Verify the image file using a vieweror web browser
-
8/12/2019 AVSLabs(2)
73/88
73
PostScript Output It's also easy to generate high-quality vector PostScript images
of your AVS/Express visualizations. Here you'll experiment withthe OutputVPS module, using a network almost identical to theone you have already built.
In the previous network, substitute the OutputVPS module forOutputImage
Check the OutputVPS UI for useful options Save the output to a PostScript file Verify the postscript using xpsview (SGI). How is the image
quality?
-
8/12/2019 AVSLabs(2)
74/88
74
Exporting VRML Virtual Reality Modeling Language , or VRML, is
a way to share 3D content on the web. In thispart of the exercise, you'll experiment withexporting an AVS/Express visualization in theVRML file format. In general, VRML filesgenerated from AVS/Express tend to be very
large. However, if you can keep yourvisualization content reasonably small, you canachieve acceptable performance within a VRMLbrowser.
Build the network shown, and read in the file
water.fld (in /AVS_install_dir/data/field )
-
8/12/2019 AVSLabs(2)
75/88
75
Exporting VRML Set the isosurface parameter to a
low value like 0.01 Export the view to a VRML file
Using the OutputVRML UI, outputexpress.wrl to a temporarydirectory
Use the VRML 1 protocol If your web browser supports VRML,
use it to open express.wrl . Howdoes the performance and imagequality compare to the rendering in
AVS/Express?
-
8/12/2019 AVSLabs(2)
76/88
76
The L o o p Module The Loop module outputs a sequence of integers/floats to drive
downstream modules, such as slicers, isosurface, data filereaders, and image writer modules. By looping over a sequenceof values, an animation is created.
Build the network
-
8/12/2019 AVSLabs(2)
77/88
77
The L o o p Module Read in hydrogen.fld (in
/AVS_install_dir/data/field/ ) Add an input port for the iso_level
parameter, a sub-object of isosurface Open the isosurface module Right-click on the input port for iso_level (on
the left side of the object) Select Export Port from the pop-up menu
Clear the current value for iso_level Open the iso_level object Backspace over its contents Close iso_level and isosurface
-
8/12/2019 AVSLabs(2)
78/88
78
The L o o p Module Connect the Loop module to isosurface as shown:
Set the Loop parameters. For this application choose Start Value = 0 End Value = 255 Increment = 10
Click on Run to see the application cycle through a set ofiso_level values
-
8/12/2019 AVSLabs(2)
79/88
79
Keyframe Animation AVS/Express supports keyframe animation with its animator
module. To create a keyframe animation, you create a series ofviews, the "keyframes" that define known points in the animationyou want to produce. The animator then adds frames betweenthe keyframes to produce an animated sequence. These newframes are created by interpolating parameters of the view, such
as size, position, or color, from one keyframe to the next. Whenyou run the animation, the animator creates frames between thekeyframes by interpolating parameter values to produce thenumber of frames per second you specify for the animation. Theinterpolated frames provide a smooth animation between thefixed points in the animation sequence defined by keyframes.
-
8/12/2019 AVSLabs(2)
80/88
80
Keyframe Animation Build the network:
Note that the animator module is not (visually) connected to any
other module Read in /AVS_install_dir/data/geom/face-sm.geo Reset the view (use the Reset/Normalize/Center button) and
turn off Auto-Normalize If you change a parameter that affects the extents of the data or
the position of the camera, the camera automatically performs areset/normalize/center operation. Making these changes avoidsunexpected shifts in the position of objects in the view as your animation runs.
-
8/12/2019 AVSLabs(2)
81/88
81
Keyframe Animation It is usually convenient to put the animator UI in a separate
window (click the Separate Window toggle) Create some keyframes
First, re-initialize the animation parameters. Click the Reinitializebutton to reset the values of animation parameters in yournetwork to the current values of the parameters in the view. Thisallows you to capture a predictable first keyframe. Note that youcan only use this button before you begin to add keyframes.
Click the Add keyframe button to make the currently displayedview a keyframe. The first keyframe is added at time step 0, and a0 appears in the list of Frame Times in the keyframe control panel.
To add additional keyframes, make the changes needed in theviewing image, then click on the Add keyframe button again. Trychanging different values between keyframes for example,change the color of the face, its position, its size or its surfaceproperties. Add several more frames.
-
8/12/2019 AVSLabs(2)
82/88
82
Keyframe Animation If you are creating a cyclic animation, that is one that ends with the
same image it begins with, you can use the Complete button .When you click on this, animator adds a keyframe that is a copy ofthe first keyframe to the animation sequence.
To delete individual keyframes, select the time of the frame in theFrame Times list and click the Delete Keyframe button . Todelete all the currently defined keyframes, click the Clear button
You can play the animation back using the playback controls:
These controls are similar to VCR buttons.
-
8/12/2019 AVSLabs(2)
83/88
83
Creating Movies with Image_Capture However you choose to generate the sequence of images for
animation, the image_capture module can be used to capturethe frames and assemble the movie. You can save the imageframes to memory or to disk, play them back to any
AVS/Express view or frame buffer, and generate AVI or MPEG-1 movies from them.
Add an i mage_capture object to the previous network:
-
8/12/2019 AVSLabs(2)
84/88
84
Creating Movies with Image_Capture The image_capture UI provides the controls for capturing
images and generating movies To begin capturing images, set the Mode to Capture from View .
Note that as soon as you set the mode to something other thanInactive , the module begins recording an image each time it isre-rendered (i.e. each time the view updates).
You can set the Capture Mode option to specify how the imagesare saved Memory saves the images to your computer's memory (be careful
if there are many frames!) Disk saves the images to temporary files in the directory specified
in the Movie Name box
-
8/12/2019 AVSLabs(2)
85/88
85
Creating Movies with Image_Capture Go back to the animator module and replay your keyframe
animation. As the view is updated, the frames are saved byimage_capture Make sure that nothing occludes the viewer window during this
process! Other windows, the mouse pointer, etc., will appear inthe captured frames if they overlay the viewer window at all.
Play back the frames Set Mode to Playback to View Use the VCR buttons to review the animation
Finally, create the movie file Set Mode to Inactive Select MPEG-1 or AVI format
Choose a movie file name Click on Generate Movie
Check the movie file by viewing it in a browser
-
8/12/2019 AVSLabs(2)
86/88
86
Time Series Field Files The AVS/Express Read_Field module supports time series field
files. These are field files that have information about multipletime steps or frames
Examine /AVS_installation_dir/data/field/m1.fld Field file structure is familiar Note the nstep keyword, indicating the number of time steps
contained in the file Each time step begins with time value = ... and ends with EOT
Construct the network
-
8/12/2019 AVSLabs(2)
87/88
87
Time Series Field Files Read in /AVS_installation_dir/
data/field/m1.fld Note that the Read_Field UI now
contains some additional controlsrelating to time information
Experiment with StepForward /Backward , One-time ,Continuous and Bounce
-
8/12/2019 AVSLabs(2)
88/88
88
Particle Animation Given a vector field, the module Particle_Advector can be used
to animate massless particle flow along the field Useful for visualizing e.g. fluid flows, but can be used with any
vector field
Instantiate Examples.Viz Macros.Particle_Advector Animate the particles
Use the Run toggle at the bottom of the Particle_Advector UI Experiment with the various parameters to see their effects on the
visualization