Hello Mayavi Users, This post is a duplicate of the one found here, but I haven't got any reply and the post is now buried... I have 2 questions concerning the volume module. I was trying to visualize a 3D scalar field, starting from a StructuredPoints dataset. When the spacing along the axes is 1 (or larger), it works fine (like sgrid1 in the code below). But when the spacing gets smaller than 1, the volume is not displayed properly. One thing which is fishy: the color of the volume gets more intense as the spacing increases. It seems like the volume module does not pick the right scalar information, but changing the "Scalar mode" from the application had no effect. The image_plane_widget works fine on the same grids. My second question relates to the CTF. How can I set the vmin and vmax for transparency through a script? I tried to use the record script feature from the Mayavi GUI, but nothing happens on the record window when I change the "alpha" settings. Code: ---------------------------------------------------- import numpy as np from enthought.tvtk.api import tvtk from enthought.tvtk.array_handler import get_vtk_array_type #Structured points with spacing of 1 sgrid1 = tvtk.StructuredPoints(origin=np.array((0,0,0)), spacing=np.array((1,1,1)), dimensions=np.array((10,10,10))) #Structured points with spacing of 0.1 sgrid2 = tvtk.StructuredPoints(origin=np.array((0,0,0)), spacing=np.array((1e-1,1e-1,1e-1)), dimensions=np.array((10,10,10))) #Some scalar values scalars = np.array([np.ones((10,10))*i for i in range(10)]).transpose(2,1,0) sgrid1.point_data.scalars = (scalars.ravel()) sgrid1.point_data.scalars.name = 'scalars' sgrid2.point_data.scalars = (scalars.ravel()) sgrid2.point_data.scalars.name = 'scalars' from enthought.mayavi.sources.vtk_data_source import VTKDataSource from enthought.mayavi.modules.outline import Outline from enthought.mayavi.modules.axes import Axes from enthought.mayavi.modules.image_plane_widget import ImagePlaneWidget from enthought.mayavi.modules.volume import Volume from enthought.mayavi import mlab from enthought.mayavi.api import Engine e1 = Engine() e1.start() s1 = e1.new_scene() src1 = VTKDataSource(data = ""> e1.add_source(src1) e1.add_module(Volume()) e1.add_module(ImagePlaneWidget()) e1.add_module(Outline()) e1.add_module(Axes()) e2 = Engine() e2.start() s2 = e2.new_scene() src2 = VTKDataSource(data = ""> e2.add_source(src2) e2.add_module(Volume()) e2.add_module(ImagePlaneWidget()) e2.add_module(Outline()) e1.add_module(Axes()) mlab.show() ---------------------------------------------------- My setup: Ubuntu 11.04 64bits with Mayavi2 v.3.4.0-1 Thanks a lot for your comments and help! Bertrand |
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d
_______________________________________________ MayaVi-users mailing list MayaVi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mayavi-users