ReadVtk

Synopsis

Reads a VTK generated triangle geometry file into an AVS/Express Mesh.

Parameters

Name Type Description UI Control

filename string Name of VTK triangle file to be read. File Browser

Output Ports

Name Type Description

out_mesh Mesh Mesh data constructed from read Geometry.
out_obj GDobject Directly renderable output object.
out_fld Field Mesh data combined with appropriate node data.

Description

The read_vtk user macro is designed to be a simple interface between the VTK triangle file storage format and the AVS/Express triangle mesh structure. It reads the contents of the file and creates a triangle cell set as output. The internal low-level module, ReadVtkCore, is implemented in C++. The module is designed to only read a subset of the VTK file format, specifically files very similar to:

# vtk DataFile Version 2.0
ASCII
DATASET POLYDATA
POINTS 9 float
 -1.0     -1.0      0.0
  1.0     -1.0      0.0
  1.0      1.0      0.0
 -1.0      1.0      0.0
  1.0      1.0      0.0
  1.0      3.0      0.0
 -1.0      3.0      0.0
  1.0      3.0      0.0
  1.0      5.0      0.0
POLYGONS 3 12
3 0 1 2
3 3 4 5
3 6 7 8

The VTK file format is a generalised format that is able to store many different types of data. This includes node and cell data. This project does not contain the functionality necessary to read these other forms data from VTK files. However it should be possible to modify the low-level module code to read whatever data is required from your VTK files. To allow this data to be easily used the functionality necessary to merge node data with the read mesh data has been built into the Read_VTK functional macro. Currently the macro uses an array of automatically generated byte data to build node data. This array is called node_data_values. In a real application this array could easily be replaced by real node data read from the VTK file.

Inputs

filename

Name of the VTK triangle geometry file to be loaded. The parameter is of type string. The User Interface provided by the user macro contains a file browser so that this parameter can be easily changed.

Outputs

out_mesh

The output mesh containing nodes and triangle cells constructed from the data present in the VTK file. This output only contains geometry, it does not contain any node or cell data.

out_obj

The GDobject version of the output, suitable for direct connection to the viewer.

out_fld

A placeholder for field data generated by the macro. Currently the read_vtk macro outputs automatically generated node data. This data is unlikely to be useful. However it is possible to modify the read_vtk macro to output real data through this port. Please see above for further details.

Utility Macros

The low-level module, ReadVtkCore is used by the functional macro Read_VTK. This functional macro and the User Interface Macro, Read_VTK_UI are both used by the user macro, read_vtk. This project does not use a separate parameter block.

Example

The example application, ReadVtkEg, is provided. This application demonstrates how the read_vtk macro can be used to read a geometric representation of the inner ear. It also demonstrates how the field and mesh outputs can be visualised. Note that the rainbow effect on the viewed image is a result of the automatically generated node data. It is not part of the original data.

Files

iac_proj/rd_vtk/rvtkmods.v contains the V definition of the ReadVtkCore module.

iac_proj/rd_vtk/rvtkmacs.v contains the V definitions of the Read_VTK_UI UI macro, the Read_VTK functional macro, the read_vtk user macro and the ReadVtkEg example application.

Other Notes

The low-level ReadVtkMods library containing the module ReadVtkCore does not specify a process. By default the express process will be used.

Authors

Dave Goughnour, Ian Curington, Advanced Visual Systems, Inc.
Andrew Dodd, International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL