[vtkusers] Python + legacy VTK reader, multiple SCALARS fields

Nico Schlömer nico.schloemer at gmail.com
Sat Jan 16 04:32:38 EST 2010


Hi,

I'm trying to read a regular legacy VTK file with the structure

============================================ *snip*
============================================
# vtk DataFile Version 2.0
foobaar
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 65 65 1
ORIGIN 0 0 0
SPACING 7.812576686292641e-02 7.812576686292641e-02 0.000000000000000e+00
POINT_DATA 4225
SCALARS x0 float
LOOKUP_TABLE default
4.706019103136933e-01
4.698415308734816e-01
[...]
SCALARS x1 float
LOOKUP_TABLE default
-1.978262906781735e+00
-1.901501675888420e+00
[...]
============================================ *snap*
============================================

-- that is, *two* SCALARS lists x0 and x1. I'm using the VTK Python
interface, more precisely

============================================ *snip*
============================================
import vtk
from vtk import *
reader = vtkDataSetReader()
reader.SetFileName( filepath )
reader.Update()
x1Array = reader.GetOutput()
============================================ *snap*
============================================

The output of this is *almost* okay, namely

============================================ *snip*
============================================
vtkStructuredPoints (0x3588660)
 Debug: Off
 Modified Time: 36397
 Reference Count: 2
 Registered Events: (none)
 Source: (none)
 Information: 0x35c3190
 Data Released: False
 Global Release Data: Off
 UpdateTime: 36419
 Release Data: Off
 UpdateExtent: Not Initialized
 UpdateExtent: 0, 64, 0, 64, 0, 0
 WholeExtent: 0, 64, 0, 64, 0, 0
 ExtentTranslator: (0x35d2c20)
 RequestExactExtent: Off
  Field Data:
   Debug: Off
   Modified Time: 36148
   Reference Count: 1
   Registered Events: (none)
   Number Of Arrays: 0
   Number Of Components: 0
   Number Of Tuples: 0
 Number Of Points: 4225
 Number Of Cells: 4096
 Cell Data:
   Debug: Off
   Modified Time: 36393
   Reference Count: 1
   Registered Events: (none)
   Number Of Arrays: 0
   Number Of Components: 0
   Number Of Tuples: 0
   Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
   Interpolate Flags: ( 1 1 1 1 1 0 0 )
   Pass Through Flags: ( 1 1 1 1 1 1 1 )
   Scalars: (none)
   Vectors: (none)
   Normals: (none)
   TCoords: (none)
   Tensors: (none)
   GlobalIds: (none)
   PedigreeIds: (none)
 Point Data:
   Debug: Off
   Modified Time: 36397
   Reference Count: 1
   Registered Events: (none)
   Number Of Arrays: 1
   Array 0 name = x0
   Number Of Components: 1
   Number Of Tuples: 4225
   Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
   Interpolate Flags: ( 1 1 1 1 1 0 0 )
   Pass Through Flags: ( 1 1 1 1 1 1 1 )
   Scalars:
     Debug: Off
     Modified Time: 36371
     Reference Count: 2
     Registered Events: (none)
     Name: x0
     Data type: float
     Size: 4225
     MaxId: 4224
     NumberOfComponents: 1
     Information: 0
     Name: x0
     Number Of Components: 1
     Number Of Tuples: 4225
     Size: 4225
     MaxId: 4224
     LookupTable: (none)
     Array: 0x356a860
   Vectors: (none)
   Normals: (none)
   TCoords: (none)
   Tensors: (none)
   GlobalIds: (none)
   PedigreeIds: (none)
 Bounds:
   Xmin,Xmax: (0, 5.00005)
   Ymin,Ymax: (0, 5.00005)
   Zmin,Zmax: (0, 0)
 Compute Time: 0
 ScalarType: 10
 NumberOfScalarComponents: 1
 Spacing: (0.0781258, 0.0781258, 0)
 Origin: (0, 0, 0)
 Dimensions: (65, 65, 1)
 Increments: (0, 0, 0)
 Extent: (0, 64, 0, 64, 0, 0)
============================================ *snap*
============================================

The issue is that I only seem to have access to *one* of the two
SCALARS lists, and cannot get x1.

Am I possibly calling the wrong reader methods? Any hints?

Cheers,
Nico



More information about the vtkusers mailing list