Editing
Vtk/SimpleCubeTutorial
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=WarpScalar= In an effort to figure out how to display the free-energy surface of self-gravitating fluid systems, I decided to see if I could combine what I had just learned about creating (and reading in) XML-formatted data structures with the capabilities of the ''vtkWarpScalar'' module. The capabilities of this "warping" module are illustrated by the VisTrails (and VTK) ''warpComb.vt'' example: <div align="center"> .../VisTrails/examples/vtk_examples/VisualizationAlgorithms/warpComb.vt </div> (See also the ''imageWarp.vt'' vistrail in the same vtk_examples directory.) <div align="left"> <pre> <?xml version="1.0"?> <VTKFile type="PolyData" version="0.1" byte_order="LittleEndian"> <PolyData> <Piece NumberOfPoints="36" NumberOfPolys="25"> <CellData Scalars="cell_scalars" Normals="cell_normals"> <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> <DataArray type="Float32" Name="cell_normals" NumberOfComponents="3" format="ascii"> 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 </DataArray> </CellData> <PointData Scalars="colorful" Normals="magnify"> <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> <DataArray type="Float32" Name="magnify" NumberOfComponents="3" format="ascii"> 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 </DataArray> </PointData> <Points> <DataArray type="Float32" NumberOfComponents="3" format="ascii"> 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 0 1 0 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 0 2 0 1 2 0 2 2 0 3 2 0 4 2 0 5 2 0 0 3 0 1 3 0 2 3 0 3 3 0 4 3 0 5 3 0 0 4 0 1 4 0 2 4 0 3 4 0 4 4 0 5 4 0 0 5 0 1 5 0 2 5 0 3 5 0 4 5 0 5 5 0 </DataArray> </Points> <Polys> <DataArray type="Int32" Name="connectivity" format="ascii"> 0 1 7 6 1 2 8 7 2 3 9 8 3 4 10 9 4 5 11 10 6 7 13 12 7 8 14 13 8 9 15 14 9 10 16 15 10 11 17 16 12 13 19 18 13 14 20 19 14 15 21 20 15 16 22 21 16 17 23 22 18 19 25 24 19 20 26 25 20 21 27 26 21 22 28 27 22 23 29 28 24 25 31 30 25 26 32 31 26 27 33 32 27 28 34 33 28 29 35 34 </DataArray> <DataArray type="Int32" Name="offsets" format="ascii"> 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 </DataArray> </Polys> </Piece> </PolyData> </VTKFile> </pre> </div> 1. First, I constructed the new, XML-formatted input data file shown immediately above. The configuration described by this data file has the following key features: * As is detailed in the "Points" DataArray, the configuration has a structured grid containing 6 x 6 = 36 vertices. The ''z'' coordinate of all 36 points is zero, which means that the configuration is a plane of zero thickness that is lying in the <math>x-y</math> plane. * The scalar values assigned to these 36 points/vertices are provided in the "PointData" DataArray named "colorful." * As is detailed in the pair of "Polys" DataArrays, the grid points are connected with one another, four at a time, to create 5 x 5 = 25 cells. * The scalar values assigned to these 25 cells are provided in the "CellData" DataArray named "cell_scalars." 2. Next, I read this XML_formatted data file into the VisTrails pipeline discussed above — specifically, the one displayed above as "Pipeline02" — to convince myself that the configuration would be rendered as a multicolored plane. 3. Finally, as is illustrated below in the figure labeled "Pipeline03," I inserted the "vtkWarpScalar" module into the VisTrails pipeline between the XMLPolyData reader and the PolyData Mapper, and activated its ''SetScaleFactor" method with a value of 2.0. Executing this pipeline generated the image in the upper-right whose caption reads, "Warp (Point Data) Image." 4. The image in the lower-right whose caption reads, "Warp (Cell Data) Image," was generated by activating the ''SetScalarModeToUseCellData'' method in the "vtkPolyDataMapper" module. <div align="center"> <table border="2" align="center"> <tr> <td align="center" rowspan="2"> [[Image:WarpScalarPipeline.png|right|thumb|500px|Pipeline03]] </td> <td align="center"> [[Image:WarpScalarImage.png|right|thumb|200px|Warp (Point Data) Image]] </td> </tr> <tr> <td align="center"> [[Image:WarpScalarCellDataImage.png|right|thumb|200px|Warp (Cell Data) Image]] </td> </tr> </table> </div> The following excerpt from §5.1 (specifically, p. 77) of the [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide''] explains why the two images shown on the right-hand side of the above figure have very different color patterns: <table border="0" cellpadding="8" align="center" width="80%"> <tr><td align="left"> "Another important feature of ''vtkMapper'' is controlling which attribute data (i.e., point or cell scalars, or a general data array) is used to color objects." "Note that [different methods within the ''vtkMapper'' module] give strikingly different results: point attribute data is interpolated across rendering primitives during the rendering process, whereas cell attribute data colors the cell a constant value." </td></tr> </table>
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information