MantisBT - VTK
View Issue Details
0005060VTK(No Category)public2007-05-18 12:362013-04-05 19:57
Brice Due 
Zhanping Liu 
highmajoralways
closedopen 
 
 
0005060: vtkStripper SegFaults on a simple mesh (but works on others)
Hello, I am learning python-vtk and I have run into strange behavior that may be a bug in vtkStripper. I have a short python script which takes a simple .vtk poly data file and converts the triangle list to triangle strips (listing below). The input .vtk file is generated by a Blender export script. The vtkStripper script works fine on all my test data *except* one paricular mesh (also listed below). On that mesh vtkStripper segfaults.
 
I have disected the mesh and found that the problem involves only a small area (listed below). There are no duplicate points, or wrong-way normals, or anything obviously degenerate about this mesh. Just this small sub-mesh is enough to cause vtkStripper to segfault. The original mesh is a closed surface, which topologicaly seems equivalent to a cylinder. This fragment is one end of that cylinder.
 
Adding vtkTriangleFilter before vtkStripper does not solve the issue.
 
I am using VTK 4.4.2-5 bound to python 2.3 on a linux (debian derived) system. The vtk libs were installed from the python-vtk package version 4.4.2-5.
 
Thank You Very Much!
 
-brice
 
############################
from vtk import vtkPolyDataReader, vtkStripper, vtkPolyDataWriter
 
reader = vtkPolyDataReader()
reader.SetFileName("stripify-vtkinput.vtk")
 
stripper = vtkStripper()
stripper.SetInput(triangles.GetOutput())
stripper.Update()
 
stripper = vtkStripper()
stripper.SetInput(triangles.GetOutput())
stripper.Update()
 
newmesh = None
newmesh = stripper.GetOutput()
 
writer = vtkPolyDataWriter()
writer.SetInput(newmesh)
writer.SetFileName("stripify-vtkoutput.vtk")
writer.Write()
 
############################
# vtk DataFile Version 3.0
vtk PolyData input
ASCII
DATASET POLYDATA
POINTS 41 float
0.010 -0.014 -21.389
-3.754 2.721 -20.773
-1.428 4.411 -20.773
3.774 2.721 -20.773
4.663 -0.014 -20.773
3.774 -2.749 -25.096
3.774 -2.749 -20.773
4.663 -0.014 -25.096
1.448 -4.439 -25.096
1.448 -4.439 -20.773
-1.428 -4.439 -25.096
-1.428 -4.439 -20.773
-3.754 -2.749 -25.096
-3.754 -2.749 -20.773
-4.643 -0.014 -25.096
-4.643 -0.014 -20.773
-3.754 2.721 -25.096
-1.428 4.411 -25.096
1.448 4.411 -25.096
1.448 4.411 -20.773
3.774 2.721 -25.096
6.965 5.040 -23.944
8.607 -0.014 -23.944
11.243 -0.014 -22.524
9.098 6.589 -22.524
2.667 8.163 -23.944
3.481 10.670 -22.524
-2.647 8.163 -23.944
-3.461 10.670 -22.524
-6.946 5.040 -23.944
-9.078 6.589 -22.524
-8.588 -0.014 -23.944
-11.223 -0.014 -22.524
-6.946 -5.067 -23.944
-9.078 -6.616 -22.524
-2.647 -8.190 -23.944
-3.461 -10.697 -22.524
2.667 -8.190 -23.944
3.481 -10.697 -22.524
6.965 -5.067 -23.944
9.098 -6.616 -22.524
POLYGONS 70 280
3 0 1 2
3 0 3 4
3 5 6 7
3 5 7 8
3 9 10 6
3 9 6 5
3 11 12 10
3 11 10 9
3 13 14 12
3 13 12 11
3 15 16 14
3 15 14 13
3 17 18 15
3 18 16 15
3 19 20 18
3 19 18 17
3 21 22 20
3 21 20 19
3 23 24 22
3 23 22 21
3 8 7 24
3 8 24 23
3 2 25 0
3 25 3 0
3 26 27 0
3 27 1 0
3 28 29 0
3 29 26 0
3 4 30 0
3 30 28 0
3 23 31 32
3 23 32 8
3 31 33 32
3 34 33 31
3 31 35 34
3 35 36 34
3 23 21 31
3 21 35 31
3 21 19 37
3 21 37 35
3 35 37 38
3 35 38 36
3 37 39 40
3 37 40 38
3 17 39 19
3 39 37 19
3 15 41 17
3 41 39 17
3 39 41 40
3 41 42 40
3 41 43 42
3 43 44 42
3 15 13 43
3 15 43 41
3 13 11 45
3 13 45 43
3 43 45 44
3 45 46 44
3 45 47 46
3 47 48 46
3 11 9 47
3 11 47 45
3 9 5 47
3 5 49 47
3 47 49 48
3 49 50 48
3 32 33 50
3 32 50 49
3 8 32 5
3 32 49 5
################################
No tags attached.
? zfrag458.vtk (2,519) 1969-12-31 19:00
https://www.vtk.org/Bug/file/6008/zfrag458.vtk
? zfrag462.vtk (1,937) 1969-12-31 19:00
https://www.vtk.org/Bug/file/6009/zfrag462.vtk
Issue History
2008-09-23 11:29Berk GeveciAssigned ToWill Schroeder => Zhanping Liu
2008-10-02 17:24Zhanping LiuNote Added: 0013715
2008-10-02 17:24Zhanping LiuStatustabled => @80@
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-04-05 19:57Berk GeveciStatuscustomer review => closed

Notes
(0007693)
Brice Due   
2007-05-18 14:28   
I uploaded two additional ASCII .vtk files which cause vtkStripper to segfault when using the python script listed in the first comments. These very simple meshes are for a pencil and a match stick.
(0013715)
Zhanping Liu   
2008-10-02 17:24   
Hi, Bricedue:

    By checking the format of the three VTK files (zfrag458.vtk, zfrag462.vtk, and the ASCII one pasted above) you provided, I notice that none of them is a valid VTK data file. For example in the pasted ASCII file, line #5

    POINTS 41 float

    indicates that the point Id range is [0, 40]. However, in the polygonal connectivity part that follows

    POLYGONS 70 280

    there are many point Ids (such as 43, 44, 45, 48,....) which are beyond this range.

    As these three files are NOT valid VTK files while they were intended to be loaded as VTK files, segment faults resulted. The problem was NOT due to VTK or vtkStripper, but instead due to the invalid data files provided.

    Please check the format of your VTK files. You are welcome to provide new VTK files for any further questions.

    Thanks.