[vtkusers] python, volume rendering and segmentation fault

Ernvik Aron Aron.Ernvik at smhi.se
Thu Sep 20 10:11:48 EDT 2001


Hi everyone,

I'm trying to modify the volSimple.py volume rendering example. Instead
of reading the volume data from an SLC file, I want to specify the data
myself by looking it up in a Python Numeric Array. The original code is:

==============================================
reader = vtkSLCReader()
reader.SetFileName(VTK_DATA+"/poship.slc")
...
volumeMapper.SetInput(reader.GetOutput())
...
outline.SetInput(reader.GetOutput())
============================================ *

I've changed this into:

==============================================
import Numeric
a = Numeric.array([0, 1, 2], Numeric.UnsignedInt8)
data = vtkStructuredPoints()
data.setDimensions(3, 3, 1)
scalars = vtkScalars()
scalars.InsertScalar(0, a[0])
...
scalars.InsertScalar(8, a[2])
...
volumeMapper.setInput(data)
...
outline.setInput(data)
============================================ *

...and I get a segmentation fault? Is there any other way to do this (I
suppose there is...)?

Thanks for any help,

Aron Ernvik, Swedish Meteorological and Hydrological Institute



More information about the vtkusers mailing list