]>
gitweb.michael.orlitzky.com - spline3.git/blob - util/view-mri-data.py
4 Display volumetric data from the Stanford Volume Data Archive. The
5 data (layers) are expected to be concatenated together.
8 from mayavi
import mlab
14 print "Usage:", binary
, "<data file>"
23 For integers, this probably even works.
25 for x
in range(0,n
+1):
32 # Read the data in a numpy 3D array
34 data
= np
.fromfile(sys
.argv
[1], dtype
='>u2')
36 original_data_length
= 7143424
37 multiplier
= cube_root(len(data
) / original_data_length
)
38 data
.shape
= (109*multiplier
, 256*multiplier
, 256*multiplier
)
42 mlab
.figure(bgcolor
=(0, 0, 0), size
=(1000, 1000))
44 src
= mlab
.pipeline
.scalar_field(data
)
46 # Our data is not equally spaced in all directions:
47 src
.spacing
= [1, 1, 1.5]
48 src
.update_image_data
= True
49 v
= mlab
.pipeline
.volume(src
, vmax
=2500, vmin
=1400)