Question

Using Mayavi, I get a nice cut plane with my data:

SF  = mlab.pipeline.scalar_field(H)
obj = mlab.pipeline.image_plane_widget(SF,
              plane_orientation='y_axes',
              slice_index=16)

How do I programmatically adjust the slice_index on the mlab.pipeline.image_plane_widget for animation purposes? I tried looking through help(obj) and it's a mess of options.

Was it helpful?

Solution

Using the Mayavi "record" button, I found that you can get a sense for what is being called when then plane moves. It's not as simple as slice_index, which can only be used at creation, but at least it shows the right calls. A single move of the plane can be recreated with the following commands:

image_plane_widget1 = engine.scenes[0].children[1].children[0].children[0]
image_plane_widget1.ipw.origin = array([  0.5,  21. ,   0.5])
image_plane_widget1.ipw.point1 = array([  0.5,  21. ,  50.5])
image_plane_widget1.ipw.point2 = array([ 50.5,  21. ,   0.5])
image_plane_widget1.ipw.origin = array([  0.5,  21. ,   0.5])
image_plane_widget1.ipw.point1 = array([  0.5,  21. ,  50.5])
image_plane_widget1.ipw.point2 = array([ 50.5,  21. ,   0.5])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top