mayavi volume animation not updating

房东的猫 提交于 2021-02-11 13:21:37

问题


I’m trying to animate a Mayavi pipeline volume:

src = mlab.pipeline.volume(mlab.pipeline.scalar_field(data),vmin=.1*np.max(data),vmax=.2*np.max(data))

that is combined in the pipeline by another dataset represented as a cut plane.

However, I can’t get the volume visualization to update - only the first frame shows up. The animation is stepping through the data correctly (I get different values of the np.max(data[t]) below) but nothing in the visualization changes.

My understanding is that mlab_source_set should re-render correctly, and there’s nothing on the web anywhere that describes this (as far as I can tell).

The animation looks like:

@mlab.show
@mlab.animate(delay=250,ui=True)
def anim(src,data,tax,fig):
    """Animate."""
    t = 0
    nt = len(tax)
    while 1:
        vmin = .1*np.max(data[t])
        vmax = .2*np.max(data[t])
        print 'animation t = ',tax[t],', max = ',np.max(data[t])
        src.mlab_source.set(scalar = mlab.pipeline.scalar_field(data[t]), vmin=vmin,vmax=vmax)
        t = mod(t+1,nt)
        yield

Any thoughts?

来源:https://stackoverflow.com/questions/24620153/mayavi-volume-animation-not-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!