User:Tohline/vtk/Examples/XMLRectilinearGrid

From VistrailsWiki
< User:Tohline
Revision as of 21:54, 19 April 2014 by Tohline (talk | contribs) (→‎Example Input Files & VisTrails Pipelines: Clean up introductory paragraph)
Jump to navigation Jump to search

Example Input Files & VisTrails Pipelines

Whitworth's (1981) Isothermal Free-Energy Surface
|   Tiled Menu   |   Tables of Content   |  Banner Video   |  Tohline Home Page   |

Here we present two examples of input data files that we have successfully used to generate useful interactive renderings within VisTrails. The files illustrate the (structured) RectilinearGrid file type within the context of VTK's XML File Format.

In the first "Warped Quilt" example, which uses 5 x 5 grid cells (6 x 6 grid points), we present the full ascii dataset, two resulting rendered images, and a screen shot of the VisTrails pipeline that was used to generate the image. Note that the image captioned "Point Data" was generated, by default, while the image captioned "Cell Data" was generated after activating the SetScalarModeToUseCellData method within the vtkDataSetMapper module. Note, further, that the vertical "warping" of the configuration can be excluded — with the result being the rendering of a flat plane — by either:

  • Removing the vtkWarpScalar module from the VisTrails pipeline and connecting the vtkXMLRectilinearGridReader module directly to the vtkDataSetMapper module; or
  • Changing the floating-point value associated with the SetScaleFactor method inside the vtkWarpScalar method from 2.0 to 0.0.

Because the second, "Mexican Hat," example uses 49 x 49 grid cells (50 x 50 grid points), it made more sense to simply provide a pointer to the website where the input data file can be accessed. In accordance, an HTTPFile module was inserted into the VisTrails pipeline, but otherwise the pipeline is identical to the one used in the "Warped Quilt" example.

A list of other example input data files is provided near the end of our accompanying "Simple Cube" tutorial.

Important Note: By trial and error, I have discovered that the numerical values specified for "WholeExtent" and "Extent" inside the RectilinearGrid and Piece XML tags, respectively, must be provided in integer format!

XML (RectilinearGrid) Warped Quilt Example

<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian">
  <RectilinearGrid WholeExtent="0 5 0 5 0 0">
    <Piece Extent="0 5 0 5 0 0">
      <CellData Scalars="cell_scalars">
        <DataArray type="Float32" Name="cell_scalars" format="ascii">
          0.2 0.2 0.2 0.2 0.2
          0.2 0.4 0.6 0.4 0.2
          0.2 0.6 0.8 0.6 0.2
          0.2 0.4 0.6 0.4 0.2
          0.2 0.2 0.2 0.2 0.2
        </DataArray>
      </CellData>
      <PointData Scalars="colorful">
        <DataArray type="Float32" Name="colorful" format="ascii">
          0.2 0.2 0.2 0.2 0.2 0.2
          0.2 0.4 0.6 0.6 0.4 0.2
          0.2 0.6 0.8 0.8 0.6 0.2
          0.2 0.6 0.8 0.8 0.6 0.2
          0.2 0.4 0.6 0.6 0.4 0.2
          0.2 0.2 0.2 0.2 0.2 0.2
        </DataArray>
      </PointData>
      <Coordinates>
        <DataArray type="Float32" format="ascii" RangeMin="0" RangeMax="5">
          0.0 1.0 2.0 3.0 4.0 5.0
        </DataArray>
        <DataArray type="Float32" format="ascii" RangeMin="0" RangeMax="5">
          0.0 1.0 2.0 3.0 4.0 5.0
        </DataArray>
        <DataArray type="Float32" format="ascii">
          0.0
        </DataArray>
      </Coordinates>
    </Piece>
  </RectilinearGrid>
</VTKFile>


VisTrails Pipeline
Warp (Point Data) Image
Warp (Cell Data) Image


XML (RectilinearGrid) Mexican Hat Example

The relevant XML-formatted "Mexican Hat" input data file can be accessed at the following URL:

Note that this "mexicanHat.vtr" ascii file was generated via a sequence of "write" statements inside a Fortran90 code. This was done to demonstrate that even Fortran programmers can generate data files that are properly formatted for input into VisTrails.

VisTrails Pipeline
Mexican Hat Image

Related Discussions