def test_dandelion(): fimg,fbvals,fbvecs=get_data('small_101D') bvals=np.loadtxt(fbvals) gradients=np.loadtxt(fbvecs).T data=nib.load(fimg).get_data() print(bvals.shape, gradients.shape, data.shape) sd=SphericalDandelion(data,bvals,gradients) sdf=sd.spherical_diffusivity(data[5,5,5]) XA=sd.xa() np.set_printoptions(2) print XA.min(),XA.max(),XA.mean() print sdf*10**4 """ print(sdf.shape) gq=GeneralizedQSampling(data,bvals,gradients) sodf=gq.odf(data[5,5,5]) vertices, faces = get_sphere('symmetric362') print(faces.shape) peaks,inds=peak_finding(np.squeeze(sdf),faces) print(peaks, inds) peaks2,inds2=peak_finding(np.squeeze(sodf),faces) print(peaks2, inds2) """ '''
def test_dandelion(): fimg,fbvals,fbvecs=get_data('small_64D') bvals=np.load(fbvals) gradients=np.load(fbvecs) data=nib.load(fimg).get_data() print(bvals.shape, gradients.shape, data.shape) sd=SphericalDandelion(data,bvals,gradients) sdf=sd.spherical_diffusivity(data[5,5,5]) print(sdf.shape) gq=GeneralizedQSampling(data,bvals,gradients) sodf=gq.odf(data[5,5,5]) eds=np.load(get_sphere('symmetric362')) vertices=eds['vertices'] faces=eds['faces'] print(faces.shape) peaks,inds=peak_finding(np.squeeze(sdf),faces) print(peaks, inds) peaks2,inds2=peak_finding(np.squeeze(sodf),faces) print(peaks2, inds2) '''
for fib in fibs: dix=get_sim_voxels(fib) data=dix['data'] bvals=dix['bvals'] gradients=dix['gradients'] no=10 print(bvals.shape, gradients.shape, data.shape) print(dix['fibres']) np.set_printoptions(2) for no in range(len(data)): sd=SphericalDandelion(data,bvals,gradients) sdf=sd.spherical_diffusivity(data[no]) gq=GeneralizedQSampling(data,bvals,gradients) sodf=gq.odf(data[no]) #print(faces.shape) peaks,inds=peak_finding(np.squeeze(sdf),faces) #print(peaks, inds) peaks2,inds2=peak_finding(np.squeeze(sodf),faces) #print(peaks2, inds2) print 'sdi',inds,'sodf',inds2, vertices[inds[0]]-vertices[inds2[0]] #print data[no]