5

I have k cubes of (n,n,n) intensity values and I would like to plot them.

I consider them as diffusion tensors in diffusion MRI and I would like to visualize them (maybe as ellipsoids) and then try to "align" in some way. At present I simply plot for each cube its n "slice" (n,n).

Is there any python module for this task?

Hooked
  • 84,485
  • 43
  • 192
  • 261
no_name
  • 1,315
  • 2
  • 16
  • 20
  • It's not clear where the extra information for the "ellipsoids" would come from. For each tuple `(x,y,z)` you presumably have a scalar value `v` associated with it. To place an ellipsoid at that point you would need four more points of data, two angular values and the length of the major and minor axes. – Hooked May 25 '12 at 14:02
  • I think your "cubes" are the three Eigenvalues of the corresponding diffusion tensor. Do you like to draw an Ellipsoid with its semi-axes lengths corresponding to those three Eigenvalues? By which criterion would you like to align those ellipsoids? – Dr. Jan-Philip Gehrcke May 25 '12 at 14:22
  • Each cube represents a sort of tissue voxel, therefore for correct comparison between them, I need to align them. For each cube I think I should compute its diffusion tensor and rotate it wrt the principal axes. – no_name May 25 '12 at 16:51

1 Answers1

7

You can use mayavi2 for this. Since I don't have a representation of your data, I gave a minimal working example with some random spheres over a grid below:

import numpy
import mayavi.mlab as mlab

# Create some random data
N = 20
x, y, z = numpy.mgrid[-5:5:20j, -5:5:20j, -5:5:20j]
val = numpy.random.random(z.shape)

# Plot and show in mayavi2
pts = mlab.points3d(x, y, z, val, scale_factor=.5,transparent=True)
mlab.show()

enter image description here

Hooked
  • 84,485
  • 43
  • 192
  • 261
  • 1
    Thank you, it works! (with enthought.mayavi, not simply mayavi) – no_name May 25 '12 at 15:56
  • 1
    The difference between `enthought.mayavi` and `mayavi` is simply how you installed the `mayavi` library in the first place. The former being from the Enthought distribution. – Hooked May 25 '12 at 16:07