我有一个可视化对象的脚本,我需要为它设置动画。但我使用的是TVTK Polydata对象,似乎我无法使用mlab_source技术更改Polydata的标量变量。
请让我知道如何通过更改PolyData的标量来设置动画。 感谢
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.