Prev Up Next

Adding VTK Filters to ParaView

Describing Source and Filter Interfaces in Initialization Files

In ParaView, data processing is done by putting together pipelines which consist of VTK filters and sources. By default, ParaView features a handful of VTK filters or sources. The interface descriptions of these filters are hard coded into the ParaView executable. It is possible to add filters to ParaView by describing their interfaces using XML. At start-up, ParaView looks for interface files (with .xml extension) in the following directories:
  1. Config in the build tree (applicable only if you compiled ParaView from source),
  2. Config in the source tree (applicable only if you compiled ParaView from source),
  3. Config in the installation directory (by default /usr/local/share/ParaView/Config on Unix/Linux, c:\Program Files\ParaView\Config on Windows) (applicable only if you install ParaView with 'make install' or from a binary distribution),
  4. A directory given by the PV_INTERFACE_PATH environmental variable.
The source and filters described in XML files contained in these directories will appear in the VTK -> Sources or VTK -> Filters menus.

Interface File Format

Introduction

To add a filter, simply describe the interface for changing options and parameters which control the behavior of a filter. Here is an example (from standardSources.xml in ParaView/Config in the source distribution) :
<Interfaces>
 <!-- Define local system-wide source interfaces here. -->
 <Source class="vtkDiskSource" root="DiskSource" output="vtkPolyData">
   <Scalar name="InnerRadius" type="float" help="Set the inner radius of the disk"/>
   <Scalar name="OuterRadius" type="float" help="Set the outer radius of the disk"/>
   <Scalar name="RadialResolution" type="int" help="Set the number of edges in the radial direction"/>
   <Scalar name="CircumferentialResolution" type="int" help="Set the number of edges in the circumferential direction"/>
 </Source>
</Interfaces>
This file starts by describing the interface of vtkDiskSource which is vtkPolyDataSource. The instances of vtkDiskSource will be called DiskSource1, DiskSource2, etc. (from the tag DiskSource). The next three elements describe the interface for setting three scalar variables which control the behavior of the source: InnerRadius and OuterRadius which are real numbers, RadialResolution and CircumferentialResolution which are integers. The help tags allow the balloon help text to be set.

XML elements and tags

A Document Type Definition (DTD) for the ParaView configuration XML files can be found in the file dtdInterfaces.xml in the documentation directory of the distribution. Here is a summary of different elements and tags which can be used in describing the user interfaces:

Examples

<Interfaces>
  <Source class="vtkAxes" root="Axes" output="vtkPolyData">
    <Scalar name="Scale" set="SetScaleFactor" get="GetScaleFactor" 
            type="float" help="Set the size of the axes"/>
    <Vector name="Origin" type="float" length="3" 
            help="Set the x, y, z coordinates of the origin of the axes"/>
    <Boolean name="Symmetric" 
             help="Select whether to display the negative axes"/>
  </Source>
  <Source class="vtkPLOT3DReader" root="Plot3D" output="vtkStructuredGrid">
    <File name="XYZFileName" extension="bin" 
          help="Set the geometry file to read."/>
    <File name="QFileName" extension="bin" help="Set the data file to read."/>
    <Scalar name="ScalarFunctionNumber" type="int" 
            help="PLOT3D number for scalars"/>
    <Scalar name="VectorFunctionNumber" type="int" 
            help="PLOT3D number for vectors"/>
  </Source>
</Interfaces>


<Interfaces>
  <Filter class="vtkExtractGrid" root="ExtractGrid" input="vtkStructuredGrid" 
          output="vtkStructuredGrid">
    <Extent name="VOI" 
            help="Set the min/max values of the volume of interest (VOI)"/>
    <Vector name="SampleRate" type="int" length="3" 
            help="Set the sampling rate for each dimension"/>
    <Boolean name="IncludeBoundary" 
             help="Select whether to always include the boundary of the grid in the output"/>
  </Filter>
</Interfaces>

Prev Up Next
Last modified: Mon Dec 3 13:25:22 EST 2001