Difference between revisions of "User:Tohline/vtk/Examples/XMLRectilinearGrid"

From VistrailsWiki
Jump to navigation Jump to search
(→‎Example Input Files & VisTrails Pipelines: Clean up introductory paragraph)
(→‎XML (RectilinearGrid) Mexican Hat Example: Insert ascii input file that includes weird normals)
Line 79: Line 79:


==XML (RectilinearGrid) Mexican Hat Example==
==XML (RectilinearGrid) Mexican Hat Example==
===(A) Medium Resolution Grid and No Specified Normals===


<div align="center">
<div align="center">
Line 100: Line 102:
</tr>
</tr>
</table>
</table>
</div>
===(B) Low Resolution Grid with Normals Specified===
<div align="left">
<pre>
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian">
  <RectilinearGrid WholeExtent="  0  9  0  9  0  0">
    <Piece Extent="  0  9  0  9  0  0">
      <CellData Scalars="cell_scalars" Normals="magnify">
        <DataArray type="Float32" Name="cell_scalars" format="ascii">
  1.00000  0.88388  0.79057  0.72887  0.70711  0.72887  0.79057  0.88388  1.00000
  0.88388  0.75000  0.63738  0.55902  0.53033  0.55902  0.63738  0.75000  0.88388
  0.79057  0.63738  0.50000  0.39528  0.35355  0.39528  0.50000  0.63738  0.79057
  0.72887  0.55902  0.39528  0.25000  0.17678  0.25000  0.39528  0.55902  0.72887
  0.70711  0.53033  0.35355  0.17678  0.00000  0.17678  0.35355  0.53033  0.70711
  0.72887  0.55902  0.39528  0.25000  0.17678  0.25000  0.39528  0.55902  0.72887
  0.79057  0.63738  0.50000  0.39528  0.35355  0.39528  0.50000  0.63738  0.79057
  0.88388  0.75000  0.63738  0.55902  0.53033  0.55902  0.63738  0.75000  0.88388
  1.00000  0.88388  0.79057  0.72887  0.70711  0.72887  0.79057  0.88388  1.00000
        </DataArray>
        <DataArray type="Float32" Name="magnify" NumberOfComponents="3" format="ascii">
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
        </DataArray>
      </CellData>
      <PointData Scalars="colorful" Normals="direction">
        <DataArray type="Float32" Name="colorful" format="ascii">
  0.00674  0.04358  0.14832  0.29999  0.40890  0.40890  0.29999  0.14832  0.04358  0.00674
  0.04358  0.21369  0.53872  0.82410  0.94014  0.94014  0.82410  0.53872  0.21369  0.04358
  0.14832  0.53872  0.94014  0.96553  0.82075  0.82075  0.96553  0.94014  0.53872  0.14832
  0.29999  0.82410  0.96553  0.57375  0.28209  0.28209  0.57375  0.96553  0.82410  0.29999
  0.40890  0.94014  0.82075  0.28209  0.04857  0.04857  0.28209  0.82075  0.94014  0.40890
  0.40890  0.94014  0.82075  0.28209  0.04857  0.04857  0.28209  0.82075  0.94014  0.40890
  0.29999  0.82410  0.96553  0.57375  0.28209  0.28209  0.57375  0.96553  0.82410  0.29999
  0.14832  0.53872  0.94014  0.96553  0.82075  0.82075  0.96553  0.94014  0.53872  0.14832
  0.04358  0.21369  0.53872  0.82410  0.94014  0.94014  0.82410  0.53872  0.21369  0.04358
  0.00674  0.04358  0.14832  0.29999  0.40890  0.40890  0.29999  0.14832  0.04358  0.00674
        </DataArray>
        <DataArray type="Float32" Name="direction" NumberOfComponents="3" format="ascii">
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
      1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
        </DataArray>
      </PointData>
      <Coordinates>
        <DataArray type="Float32" format="ascii">
-0.50000 -0.38889 -0.27778 -0.16667 -0.05556  0.05556  0.16667  0.27778  0.38889  0.50000
        </DataArray>
        <DataArray type="Float32" format="ascii">
-0.50000 -0.38889 -0.27778 -0.16667 -0.05556  0.05556  0.16667  0.27778  0.38889  0.50000
        </DataArray>
        <DataArray type="Float32" format="ascii">
  0.00000
        </DataArray>
      </Coordinates>
    </Piece>
  </RectilinearGrid>
</VTKFile>
</pre>
</div>
</div>



Revision as of 22:32, 19 April 2014

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

(A) Medium Resolution Grid and No Specified Normals

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


(B) Low Resolution Grid with Normals Specified

<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian">
  <RectilinearGrid WholeExtent="  0  9  0  9  0  0">
    <Piece Extent="  0  9  0  9  0  0">
      <CellData Scalars="cell_scalars" Normals="magnify">
        <DataArray type="Float32" Name="cell_scalars" format="ascii">
  1.00000  0.88388  0.79057  0.72887  0.70711  0.72887  0.79057  0.88388  1.00000
  0.88388  0.75000  0.63738  0.55902  0.53033  0.55902  0.63738  0.75000  0.88388
  0.79057  0.63738  0.50000  0.39528  0.35355  0.39528  0.50000  0.63738  0.79057
  0.72887  0.55902  0.39528  0.25000  0.17678  0.25000  0.39528  0.55902  0.72887
  0.70711  0.53033  0.35355  0.17678  0.00000  0.17678  0.35355  0.53033  0.70711
  0.72887  0.55902  0.39528  0.25000  0.17678  0.25000  0.39528  0.55902  0.72887
  0.79057  0.63738  0.50000  0.39528  0.35355  0.39528  0.50000  0.63738  0.79057
  0.88388  0.75000  0.63738  0.55902  0.53033  0.55902  0.63738  0.75000  0.88388
  1.00000  0.88388  0.79057  0.72887  0.70711  0.72887  0.79057  0.88388  1.00000
        </DataArray>
        <DataArray type="Float32" Name="magnify" NumberOfComponents="3" format="ascii">
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
        </DataArray>
      </CellData>
      <PointData Scalars="colorful" Normals="direction">
        <DataArray type="Float32" Name="colorful" format="ascii">
  0.00674  0.04358  0.14832  0.29999  0.40890  0.40890  0.29999  0.14832  0.04358  0.00674
  0.04358  0.21369  0.53872  0.82410  0.94014  0.94014  0.82410  0.53872  0.21369  0.04358
  0.14832  0.53872  0.94014  0.96553  0.82075  0.82075  0.96553  0.94014  0.53872  0.14832
  0.29999  0.82410  0.96553  0.57375  0.28209  0.28209  0.57375  0.96553  0.82410  0.29999
  0.40890  0.94014  0.82075  0.28209  0.04857  0.04857  0.28209  0.82075  0.94014  0.40890
  0.40890  0.94014  0.82075  0.28209  0.04857  0.04857  0.28209  0.82075  0.94014  0.40890
  0.29999  0.82410  0.96553  0.57375  0.28209  0.28209  0.57375  0.96553  0.82410  0.29999
  0.14832  0.53872  0.94014  0.96553  0.82075  0.82075  0.96553  0.94014  0.53872  0.14832
  0.04358  0.21369  0.53872  0.82410  0.94014  0.94014  0.82410  0.53872  0.21369  0.04358
  0.00674  0.04358  0.14832  0.29999  0.40890  0.40890  0.29999  0.14832  0.04358  0.00674
        </DataArray>
        <DataArray type="Float32" Name="direction" NumberOfComponents="3" format="ascii">
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
       1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0  1 0 0
        </DataArray>
      </PointData>
      <Coordinates>
        <DataArray type="Float32" format="ascii">
 -0.50000 -0.38889 -0.27778 -0.16667 -0.05556  0.05556  0.16667  0.27778  0.38889  0.50000
        </DataArray>
        <DataArray type="Float32" format="ascii">
 -0.50000 -0.38889 -0.27778 -0.16667 -0.05556  0.05556  0.16667  0.27778  0.38889  0.50000
        </DataArray>
        <DataArray type="Float32" format="ascii">
  0.00000
        </DataArray>
      </Coordinates>
    </Piece>
  </RectilinearGrid>
</VTKFile>

Related Discussions