nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
145 stars 54 forks source link

"Segmentation fault: 11" when trying to view VTK file created by write_vtk() #28

Closed binarybottle closed 11 years ago

binarybottle commented 11 years ago

i am able to write_vtk() for a toy example:

>>> import random, os
>>> from mindboggle.utils.io_vtk import write_vtk
>>> from mindboggle.utils.plots import plot_surfaces
>>> points = [[random.random() for i in [1,2,3]] for j in range(4)]
>>> indices = [1,2,3,0]
>>> lines = [[1,2],[3,4]]
>>> faces = [[1,2,3],[0,1,3]]
>>> scalars = [[random.random() for i in range(4)] for j in [1,2]]
>>> scalar_names = ['curv','depth']
>>> output_vtk = 'write_vtk.vtk'
>>> write_vtk(output_vtk, points, indices, lines, faces, scalars, scalar_names)
>>> # View:
>>> plot_surfaces(output_vtk)

but for some reason i am now getting a "Segmentation fault: 11" when i try to view real files, such as the following:

>>> import os
>>> from mindboggle.utils.io_vtk import read_vtk, write_vtk
>>> from mindboggle.utils.plots import plot_surfaces
>>> path = os.environ['MINDBOGGLE_DATA']
>>> input_vtk = os.path.join(path, 'arno', 'shapes', 'lh.pial.mean_curvature.vtk')
>>> faces, lines, indices, points, npoints, scalars, scalar_names, input_vtk = read_vtk(input_vtk)
>>> output_vtk = 'write_vtk.vtk'
>>> write_vtk(output_vtk, points, indices, lines, faces, scalars, scalar_names)
>>> # View:
>>> plot_surfaces(output_vtk)
forrestbao commented 11 years ago

I made a change in write_scalars() over the weekend and it causes the problem. It is now fixed.