enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.3k stars 285 forks source link

Confusion/bug on volume rendering with mayavi #244

Open 22csnyder opened 9 years ago

22csnyder commented 9 years ago

Hi,

I wanted to bring attention to a bug I've documented on stackoverflow: http://stackoverflow.com/questions/32102213/mayavi-enthought-volume-rendering-buggy-gui


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.


Sorry if you were already aware of this. It is literally bringing my project to a standstill because users can't adjust the opacity or ctf.

Chris

22csnyder commented 9 years ago

I have posted the following reasonable workaround. http://stackoverflow.com/questions/32102213/mayavi-enthought-volume-rendering-buggy-gui/32194439#32194439

The problem is vexing though. Let me know if anyone tries to tackle this issue and I'll do what I can to help. I found following the chain of events that happen when you change the default ctf editor to be hard to follow.

My best guess is that there are some default settings, like red-blue fade, that normally do not come into play unless certain traits are changed, overwriting the normal blue-green-red.

Some strange things happen with the data range. When switching data scalled [0.03,1] with data 0.05,2, sometimes the ctf range would change wildly to [0,40]. Sometimes all the points are thrown to the right of the ctf on the gui, as shown on the video. This is probably the opposite phenomenon.

Best, Chris S

jgodwin commented 3 years ago

I ran into a very similar issue. I was able to work around it by rescaling all of my data to the range [0,255] exactly AND converting it from a 32-bit float datatype to a 32-bit integer datatype. Once you do that, the CTF seems to hold it's values as expected after setting the data.