[vtkusers] Basic question, vtkStructuredPoints

Oeyvind Knudsen knudsen at operamail.com
Tue Feb 10 15:07:23 EST 2004


Hi!

I'm using VTK to visualize a surface from a data file using the vtkStructuredPointsReader in Python. But from now the data should be passed directly from within the program, i.e. without using files or readers at all. Currently the code for making the surface looks like this:

reader = vtkStructuredPointsReader()
reader.SetFileName("data.vtk")

geometry = vtkImageDataGeometryFilter()
geometry.SetInput(reader.GetOutput()) #
warp = vtkWarpScalar()
warp.SetInput(geometry.GetOutput())
warp.XYPlaneOff()
warp.SetScaleFactor(100)

merge = vtkMergeFilter()
merge.SetGeometry(warp.GetOutput())
merge.SetScalars(reader.GetOutput()) #

smoother = vtkSmoothPolyDataFilter()
smoother.SetInput(merge.GetOutput())
smoother.SetNumberOfIterations(50)

mapper = vtkPolyDataMapper()
mapper.SetInput(smoother.GetOutput())
mapper.SetScalarRange(self.minData,self.maxData)
mapper.ImmediateModeRenderingOff()

surface = vtkLODActor()
surface.SetMapper(mapper)

self.renderer.AddActor(surface)
(+ some axis stuff)

The data is in this format:

# vtk DataFile Version 2.0
data
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 81 81 1
ORIGIN 0 0 0
SPACING 1 1 1
POINT_DATA 6561
SCALARS Scalars0 float 1
LOOKUP_TABLE default
0.0624595315954 0.0686842278186 0.0747777522745 (+ many more numbers)

So, instead of using this file as a source I now get a python list of the data in to my visualization method. But I can't seem to get the vtkStructuredPoints object constructed in a proper way as my surface will no longer appear. I start with this:

spData = vtkStructuredPoints()
spData.SetDimensions(81, 81, 1)

But how do I get the scalar values into spData so that spData and reader.GetOutput() (from the current code) yields the same resulting object? The goal is to replace all the occurences of reader.GetOutput() from the above code with just spData.

Regards, 
Øyvind Knudsen
-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
>From your mailbox to local or overseas cell phones.

Powered by Outblaze



More information about the vtkusers mailing list