[vtkusers] XML format help

Jean M. Favre jfavre at cscs.ch
Thu Mar 20 11:53:12 EST 2003


Randy Heiland wrote:
> 
> While I go off to look at the code, perhaps a VTK/XML guru could answer my
> question...
> 
> Trying to follow the XML format described in the VTK file format .pdf, I've
> created a simple RectGrid XML file (below) and when I try to read it using:
> 
> reader = vtkXMLRectilinearGridReader()
> reader.DebugOn()
> reader.SetFileName("test1.vtr")
> #reader.UpdateWholeExtent()
> reader.Update()
> 
> I get the error:
> 
> ERROR: In /home/heiland/vtk_Dec17.02/VTK/IO/vtkXMLStructuredDataReader.cxx,
> line 71
> vtkXMLRectilinearGridReader (0x824f4b0): RectilinearGrid element has no
> WholeExtent.

Far from being a guru, here is a solution that works:

vtkXMLRectilinearGridReader reader
reader SetFileName test1.vtr
reader DebugOn
reader Update

Debug: In /local/apps/VTK/IO/vtkXMLStructuredDataReader.cxx, line 179
vtkXMLRectilinearGridReader (0x80c7808): Updating extent 0 2 0 2 0 1

Debug: In /local/apps/VTK/IO/vtkXMLStructuredDataReader.cxx, line 203
vtkXMLRectilinearGridReader (0x80c7808): Reading extent 0 2 0 2 0 1 from
piece 0

Debug: In /local/apps/VTK/Common/vtkSource.h, line 126
vtkXMLRectilinearGridReader (0x80c7808): vtkXMLRectilinearGridReader
(0x80c7808): returning ErrorCode of 0

Debug: In /local/apps/VTK/Common/vtkSource.h, line 167
vtkXMLRectilinearGridReader (0x80c7808): vtkXMLRectilinearGridReader
(0x80c7808): setting ErrorCode to 0

I have modified your file by using Grid coordinates (instead of Physical
coordinates) to specify the extents.

----
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian">
  <RectilinearGrid WholeExtent="0 2 0 2 0 1">
    <Piece Extent="0 2 0 2 0 1">
      <Coordinates>
        <DataArray type="Float32">
          0 10 30
        </DataArray>
        <DataArray type="Float32">
          0 10 30
        </DataArray>
        <DataArray type="Float32">
          0 10
        </DataArray>
      </Coordinates>
      <PointData Scalars="Water">
        <DataArray Name="water" type="Float32" NumberOfComponents="1"
                   format="ascii">
        0 10 30 0 10 30 0 10 30
        5 15 35 5 15 35 5 15 35
        </DataArray>
      </PointData>
    </Piece>
  </RectilinearGrid>
</VTKFile>
-- --------------
Dr. Jean M. Favre,                            email:favre at cscs.ch
http://www.cscs.ch/people/Favre.html
CSCS, Swiss Center for Scientific Computing | Tel:  +41 (91) 610.82.40
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82



More information about the vtkusers mailing list