I think I have come across a genuine bug. It seems that something very strange and certainly unintuitive is happening with the colortransferfunction(CTF) interface.
I'll describe here what I've shown in the movie at the following link(5MB): https://drive.google.com/file/d/0B2DsQIFbCQmELTZzWVc1MDc1MGM/view?usp=sharing
Action: mlab.pipeline.volume(whatever). It doesn't matter how the volume rendering is created. Result: The volume source is displayed as red. Fine.
Action: The user just clicks on the volume transfer function without changing it much. You can even move it back to exactly where it was. Result: The volume source totally changes colors from red to green: suggesting the CTF in the "Mayavi pipeline" window is not the same as the one originally used in "Mayavi Scene 1"
Action: The user, having clicked on the opacity transfer function at least once, clicks away. Then the user clicks back. Result: The CTF totally changes to this blue-red fade instead of this nice three-color style before. If the user messes with the OTF once more, update CTF will change the volume again! from this green color to this red-purple-ish.
Note: It's not just "clicking away" and clicking back that causes this weird change in CTF. I originally ran into this problem while changing data sources. I had say 5 difference volumes. Whenever I would say "array_src.scalar_values=my_volumes.next()" the CTF would change from a rgb to a blue-red fade if and only if I had tried to alter the ctf manually in the GUI.
I really hope we can get this resolved.
Thanks, Chris Snyder
I have a workaround. The point here is that when you switch your data to be volume rendered, the ctf and otf stay in place instead of doing strange re-scalings and color changing. The solution is two fold.
1) Make sure all your data volumes are scaled to exactly 0-255. You must make sure the smallest and largest values are exactly 0 and 255 respectively, not just merely in the range [0,255]. This is important because under the hood mayavi tries to rescale the ctf/otf ranges according to your data when you switch out array.scalar_data. However, it fails in strange ways.
2) Instead of working with the built in editor from SceneEditor(MayaviScene), expose directly the Volume.view trait associated with your data. Changes to this ctf/otf editor do not switch the volume from blue-green-red mode to this blue-red fade when the underlying data is changed. Here is how to do it: (The critical line is Item('vol_module',style='custom',show_label=False)