[vtkusers] Reading subsets from vtk files

Ed Bachta ebachta at iupui.edu
Tue Aug 26 15:15:28 EDT 2003


Hello vtkusers,

I've been searching the docs and archives to find out if VTK supports
reading subsets of a dataset from file, but I still can't see how to do
it. For example, if I have a huge set of volume data saved in binary VTK
format as vtkStructuredPoints, and I just want to visualize a subset, is
there some way to set extents on the reader so that it only reads the
data I'm interested in looking at?

This was my best guess, but it doesn't seem to work:

print "Setting up..."
reader = vtk.vtkStructuredPointsReader()
#data = vtk.vtkStructuredPoints()           <- doesn't work either
data = reader.GetOutput()
data.SetOrigin(0,0,0)
data.SetSpacing(1,1,1)
data.SetExtent(0, 319, 0, 319, 0, 0)
reader.ComputeInputUpdateExtents(data)
reader.SetFileName("/usr/local/data/Blondin/St12dS.1193.vtk")
reader.UpdateWholeExtent()
print "Reading..."
reader.Update()
extent = reader.GetOutput().GetExtent()
print extent
print "Done."

The extent ends up as (0, 319, 0, 319, 0, 319)

-- 
Ed Bachta
Technical Lead
Visualization and Interactive Spaces Lab,
Pervasive Technology Labs at Indiana University
http://vis.iu.edu




More information about the vtkusers mailing list