[vtkusers] generating isopoints with vtkContourFilter -- segmentation fault
Greg Whittier
greg at thewhittiers.com
Thu Jan 29 21:30:44 EST 2004
I'm still having the problem of getting a segmentation fault when trying
to contour lines to get isopoints. The previous example used VTKData.
Below is a standalone version in both python and tcl that generates a
segmentation fault. I've verified that windows (python 2.2.3 enthought
edition) also generates a seg fault.
Can anyone confirm they get this behavior? Am I doing something
obviously wrong?
Thanks,
Greg
## python version ##
import vtk
points = vtk.vtkPoints()
points.InsertPoint(0, 0.0, 0.0, 0.0)
points.InsertPoint(1, 1.0, 0.0, 0.0)
lines = vtk.vtkCellArray()
lines.InsertNextCell(2)
lines.InsertCellPoint(0)
lines.InsertCellPoint(1)
scalars = vtk.vtkFloatArray()
scalars.InsertNextValue(0.0)
scalars.InsertNextValue(1.0)
line = vtk.vtkPolyData()
line.SetLines(lines)
line.GetPointData().SetScalars(scalars)
cfilter = vtk.vtkContourFilter()
cfilter.SetValue(0,0.5)
cfilter.SetInput(line)
cfilter.Update() # seg faults here
## tcl vesion ##
package require vtk
vtkPoints points
points InsertPoint 0 0.0 0.0 0.0
points InsertPoint 1 1.0 0.0 0.0
vtkCellArray lines
lines InsertNextCell 2
lines InsertCellPoint 0
lines InsertCellPoint 1
vtkFloatArray scalars
scalars InsertNextValue 0.0
scalars InsertNextValue 1.0
vtkPolyData line
line SetLines lines
[line GetPointData] SetScalars scalars
vtkContourFilter cfilter
cfilter SetValue 0 0.5
cfilter SetInput line
cfilter Update
On Sun, 2004-01-18 at 20:58, Greg Whittier wrote:
> I'm new to VTK, so I apologize if I'm doing something wrong here. I
> would like to use vtkContourFilter with vtkPolyData to get a set of
> isopoints from a set of lines. The vtkContourFilter docs say you can
> generate isopoints from 1D or 0D cell data, but I can't find any
> examples. Is this really possible? When I try, I get a segmentation
> fault.
>
> Here is some sample code that generates a seg fault.
>
> import vtk
>
> reader = vtk.vtkPolyDataReader()
> reader.SetFileName("/usr/share/doc/vtk-data-4.5.0/Data/track1.binary.vtk")
>
>
> cfilter = vtk.vtkContourFilter()
> cfilter.SetValue(0,5.0)
> cfilter.SetInput(reader.GetOutput())
>
> writer = vtk.vtkPolyDataWriter()
> writer.SetFileName('test.vtk')
> writer.SetInput(cfilter.GetOutput())
> writer.Write()
>
> Opening track1.binary.vtk with mayavi and selecting isosurface also
> generates a seg fault.
>
> I'm running Red Hat Linux 9 and using using the 20040118 rpms from
> http://creatis-www.insa-lyon.fr/vtk/.
>
> Any help would be appreciated. Thanks for such a great piece of
> software.
>
> Greg
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Greg Whittier <greg at thewhittiers.com>
More information about the vtkusers
mailing list