Exemplo n.º 1
0
from pylab import imshow, show, colorbar, subplot, title, figure
import nibabel as nib
import numpy as np


for datat in range(2):

	if datat == 0:
		print 'fitting with dti'
		data, affine, gtab = get_train_dti(30)
	elif datat == 1:
		print 'fitting with hardi'
		data, affine, gtab = get_train_hardi(30)
	elif datat == 2:
		print 'fitting with dsi'
		data, affine, gtab = get_train_dsi(30)

	mask, affine = get_train_mask()

	data.shape
	mask.shape


	model = TensorModel(gtab)
	fit = model.fit(data, mask)
	print 'done!'
	fa = fit.fa


	slice_z = 25
Exemplo n.º 2
0
from dipy.core.sphere_stats import angular_similarity
from copy import deepcopy
from dipy.reconst.gqi import GeneralizedQSamplingModel
from dipy.reconst.dsi import DiffusionSpectrumDeconvModel, DiffusionSpectrumModel
#from dipy.core.subdivide_octahedron import create_unit_sphere
from dipy.viz.mayavi.spheres import show_odfs
from dipy.reconst.odf import peak_directions

sphere = get_sphere('symmetric724')
sphere = sphere.subdivide(1)

#print(sphere.vertices.shape)
#sphere2 = create_unit_sphere(5)


data, affine, gtab_full = get_train_dsi(30)

gtab = deepcopy(gtab_full)

#subset of dsi gtab
bmin = 1500
bmax = 4000
gtab.b0s_mask = gtab.b0s_mask[(gtab.bvals >= bmin) & (gtab.bvals <= bmax)]
gtab.bvecs = gtab.bvecs[(gtab.bvals >= bmin) & (gtab.bvals <= bmax)]
gtab.bvals = gtab.bvals[(gtab.bvals >= bmin) & (gtab.bvals <= bmax)]
NN = gtab.bvals.shape[0]

SNR = 30.

print('SNR = {} with {} gradients direction ({}-{})'.format(SNR, gtab.bvals.shape[0], bmin, bmax))