]>
gitweb.michael.orlitzky.com - spline3.git/blob - util/view-mri-data.py
01bddbdcfc8d91aa24f6ae3156a5d57ccb985a69
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(f
"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
= 109*256*256
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 # Our data is scalar (grayscale), but not equally spaced in all
46 src
= mlab
.pipeline
.scalar_field(data
)
47 src
.spacing
= [1, 1, 1.5]
48 src
.update_image_data
= True
50 mlab
.pipeline
.volume(src
, vmin
=1400, vmax
=2500)