I have a scrip that is to visualize a object and I need to animate it. But I am using a TVTK Polydata object, and it seems I cannot change the scalar variable of the Polydata using the mlab_source technique.
Please let me know how can I animate this by changing the scalar for PolyData. Thanks
def polydata(pointsList, triangleList, scalars):
points = numpy.array(pointsList, 'f')
triangles = numpy.array(triangleList)
mesh = tvtk.PolyData(points=points, polys=triangles)
mesh.point_data.scalars = scalars
mesh.point_data.scalars.name = 'scalars'
return mesh
def view(dataset):
fig = mlab.figure(bgcolor=(1, 1, 1), fgcolor=(0, 0, 0),
figure=dataset.class_name[3:])
m_surf = mlab.pipeline.surface(dataset, opacity=1)
return m_surf
m_surf = view(polydata(pointsList, triangleList, FMRIValues_norm[0]))
ms = m_surf.mlab_source #Gives the error.