Hi,

I'm trying to adapt the volume_slice.py example to get acquainted with Mayavi 
for my visualization project. However, by simply changing the 
mlab.pipeline.scalar_field() invocation slightly, I broke the 3D view (the side 
views still work). Let me break it down:

First of all, I'm referring to this example: 
https://docs.enthought.com/mayavi/mayavi/auto/example_volume_slicer.html#example-volume-slicer

===Globals in the example: ===

x, y, z = np.ogrid[-5:5:64j, -5:5:64j, -5:5:64j]
data = np.sin(3*x)/x + 0.05*z**2 + np.cos(3*y)

===My added globals:===

cube_resolution=64j
cube_mag=5

xindices=np.stack([np.stack([np.mgrid[-cube_mag:cube_mag:cube_resolution] for _ 
in range(int(cube_resolution.imag))],axis=0 ) for _ in 
range(int(cube_resolution.imag))], axis=0)
yindices=np.stack([np.stack([np.mgrid[-cube_mag:cube_mag:cube_resolution] for _ 
in range(int(cube_resolution.imag))],axis=0 ) for _ in 
range(int(cube_resolution.imag))], axis=2)
zindices=np.stack([np.stack([np.mgrid[-cube_mag:cube_mag:cube_resolution] for _ 
in range(int(cube_resolution.imag))],axis=1 ) for _ in 
range(int(cube_resolution.imag))], axis=1)

===Data source as defined in the example:===

    def _data_src3d_default(self):
        return mlab.pipeline.scalar_field(data, 
figure=self.scene3d.mayavi_scene)

===Data source as modified by me:===

    def _data_src3d_default(self):
        return mlab.pipeline.scalar_field(xindices, yindices, zindices, 
self.data_generator,
                            figure=self.scene3d.mayavi_scene)

where self.data_generator() is set to an instance of:

class ReproduceOriginalExample:
    def __call__(self, x, y, z):
        return np.sin(3*x)/x + 0.05*z**2 + np.cos(3*y)


===Expected result:===
All four views in the window look the same as before.

===Actual result:===
The bottom right view (3D view) only contains a single white line. The other 
three views look the same as before (they even still allow interaction).

===Reasoning===
In my view, the actual data should be the same in both examples, even if it is 
generated in two different way. So the pipeline and hence the display should 
also be the same.

What am I overlooking?

Best,
Jann Poppinga
Application Engineer
________________________________
Materialise GmbH
Mary-Somerville-Str. 3 * 28359 Bremen * Deutschland
Tel. +49 421 944 074 30 * Fax +49 421 944 074 49
http://www.materialise.de<http://www.materialise.de/>
Geschäftsführer: Johan Pauwels, Marcus Joppe
HRB 129938



Jann Poppinga
Application Engineer
________________________________
Materialise GmbH
Mary-Somerville-Str. 3 * 28359 Bremen * Deutschland
Tel. +49 421 944 074 30 * Fax +49 421 944 074 49
http://www.materialise.de<http://www.materialise.de/>
Geschäftsführer: Johan Pauwels, Marcus Joppe
HRB 129938
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to