Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot a cube of 3D intensity data

Tags:

python

plot

cube

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?

like image 824
no_name Avatar asked May 25 '12 13:05

no_name


1 Answers

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

like image 166
Hooked Avatar answered Sep 30 '22 23:09

Hooked