comparison dmri.py @ 38:b054adc68274 draft

Uploaded
author greg
date Thu, 30 Nov 2017 10:54:46 -0500
parents d9c4ef2ee7c6
children 24c3ca0fd7fa
comparison
equal deleted inserted replaced
37:d9c4ef2ee7c6 38:b054adc68274
60 # k voxel coordinates and the last dimension is the number of 60 # k voxel coordinates and the last dimension is the number of
61 # non-weighted (S0s) and diffusion-weighted volumes. 61 # non-weighted (S0s) and diffusion-weighted volumes.
62 # Visualize the results using matplotlib. 62 # Visualize the results using matplotlib.
63 axial_middle = data.shape[2] // 2 63 axial_middle = data.shape[2] // 2
64 pyplot.subplot(1, 2, 1).set_axis_off() 64 pyplot.subplot(1, 2, 1).set_axis_off()
65 pyplot.imshow(data[:, :, axial_middle, 0].T, cmap='gray', origin='lower') 65 if args.drmi_dataset == 'stanford_hardi':
66 pyplot.subplot(1, 2, 2).set_axis_off() 66 pyplot.imshow(data[:, :, axial_middle, 0].T, cmap='gray', origin='lower')
67 pyplot.imshow(data[:, :, axial_middle, 10].T, cmap='gray', origin='lower') 67 pyplot.subplot(1, 2, 2).set_axis_off()
68 pyplot.imshow(data[:, :, axial_middle, 10].T, cmap='gray', origin='lower')
68 pyplot.savefig('data.png', bbox_inches='tight') 69 pyplot.savefig('data.png', bbox_inches='tight')
69 shutil.move('data.png', args.output_png) 70 shutil.move('data.png', args.output_png)
70 # Load the b-values and b-vectors. 71 # Load the b-values and b-vectors.
71 bvals, bvecs = read_bvals_bvecs(fbval, fbvec) 72 bvals, bvecs = read_bvals_bvecs(fbval, fbvec)
72 gtab = gradient_table(bvals, bvecs) 73 gtab = gradient_table(bvals, bvecs)