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!
===Overview=== As is explained in §15.3 (see the bottom of p. 336) of the [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide,'' authored and published by Kitware, Inc.], VTK (and VisTrails) also supplies ''Readers'' that accept XML-formatted input data. An example XML-formatted data file is shown immediately following this paragraph; it also can be obtained at the following website: <div align="center"> [http://www.phys.lsu.edu/~tohline/vistrails/datafiles/XMLformattedSimpleCube.vtp http://www.phys.lsu.edu/~tohline/vistrails/datafiles/XMLformattedSimpleCube.vtp]</div> The information provided in this 34-line ASCII file describes exactly the same "Simple Cube" model that was presented above in ''Simple Legacy Format'' as Example G. It is also similar — but not identical — to the example XML-formatted data file presented on p. 346 of the [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide'']. <div align="left"> <pre> <?xml version="1.0"?> <VTKFile type="PolyData" version="0.1" byte_order="LittleEndian"> <PolyData> <Piece NumberOfPoints="8" NumberOfPolys="6"> <CellData Scalars="cell_scalars" Normals="cell_normals"> <DataArray type="Float32" Name="cell_scalars" format="ascii"> 0.14286 0.28571 0.42857 0.57143 0.71429 0.85714 </DataArray> <DataArray type="Float32" Name="cell_normals" NumberOfComponents="3" format="ascii"> 0 0 1 0 0 1 0 -1 0 0 1 0 -1 0 0 1 0 0 </DataArray> </CellData> <Points> <DataArray type="Float32" NumberOfComponents="3" format="ascii"> 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 </DataArray> </Points> <Polys> <DataArray type="Int32" Name="connectivity" format="ascii"> 0 1 2 3 4 5 6 7 0 1 5 4 2 3 7 6 0 4 7 3 1 2 6 5 </DataArray> <DataArray type="Int32" Name="offsets" format="ascii"> 4 8 12 16 20 24 </DataArray> </Polys> </Piece> </PolyData> </VTKFile> </pre> </div> <font color="blue">'''General Explanation:''' </font> * The "Piece" of the "PolyData" being described in this file contains 8 points and 6 polygons (polys). The substantive information is provided by "Data Arrays" located within three subsections of the file: ''CellData,'' ''Points,'' and ''Polys.'' * Points: This ''DataArray'' provides the same information as [[vtk/SimpleCubeTutorial/CubeDetails#Specifying_the_location_of_the_cube.27s_corners.2Fvertices|the ''POINTS'' subsection of a ''Simple Legacy Formatted'' data file]], that is, it specifies the <math>~(x, y, z)</math> coordinates of the eight points (vertices) of our simple cube. The header of this ''DataArray'' tells the VTK Reader that it should read 3 numbers (the coordinates) at a time, and that the (space-delimited) data should be read as 32-bit floating-point numbers. The Reader will expect this ''DataArray'' to contain <font face="Courier">(NumberOfPoints x NumberOfComponents =) 24</font> separate floating-point numbers. * Polys: In combination with one another, the two ''DataArrays'' found between the ''Polys'' metatags provide the same information as [[vtk/SimpleCubeTutorial/CubeDetails#Defining_the_cube.27s_six_quadrilateral_faces|the ''POLYGONS'' subsection of a ''Simple Legacy Formatted'' data file]]. The first ''DataArray,'' whose Name is "connectivity," identifies the group of POINTS that should be connected to define the complete perimeter of each face of the cube; the second ''DataArray,'' whose Name is "offsets," tells the Reader how many integers in the "connectivity" array should be skipped in order to begin defining each subsequent polygon. In other words, the number of POINTS that define the perimeter of each polygon — in this case, 4 for every polygon — is given by the ''difference'' between successive ''offsets.'' * CellData: The first ''DataArray,'' whose name is "cell_scalars," assigns a scalar value to each polygon, i.e., to each face of the cube; the Reader will expect this ''DataArray'' to contain <font face="Courier">(NumberOfPolys =) 6</font> separate 32-bit floating-point numbers. The second ''DataArray,'' whose name is "cell_normals," specifies the <math>~(x, y, z)</math> coordinates of the tip of the unit vector that defines the NORMAL to the surface of each polygon, as [[vtk/SimpleCubeTutorial#Assigning_NORMALS_to_POLYGONS|explained in the discussion, above]]; the Reader will expect this ''DataArray'' to contain <font face="Courier">(NumberOfPolys x NumberOfComponents =) 18</font> separate 32-bit floating-point numbers. [[Image:XMLreaderPipeline.png|right|thumb|250px|Pipeline02]]<font color="blue">'''XMLPolyDataReader:''' </font> The figure labeled [[vtk/SimpleCubeTutorial#Reading_Cube_Model_from_a_Web_Site|"Pipeline01" near the top of this page]], shows the VisTrails pipeline that we used to construct and render a ''simple cube'' based on a web-accessible input file that provides data in a ''Simple Legacy Format.'' That input data was fed into the VisTrails pipeline using the ''vtkPolyDataReader'' module. As is illustrated by the "Pipeline02" figure, shown here on the right, the equivalent XML-formatted data file — which, as noted immediately above, is accessible on the web as a file named ''XMLformattedSimpleCube.vtp'' — can be fed into the VisTrails pipeline using the ''vtkXMLPolyDataReader'' module. <font color="blue">'''No Color Table:''' </font> As far as I have been able to ascertain, XML-formatted data files cannot be used to define LOOKUP_TABLEs — that is, color tables. Hence, as illustrated in the "Pipeline02" figure shown here on the right, a ''vtkLookupTable'' module must be inserted into the VisTrails pipeline if the user wants to define the color 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