File: profile_dti.py

package info (click to toggle)
dipy 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 43,276 kB
  • ctags: 9,823
  • sloc: python: 22,407; makefile: 260; pascal: 155; sh: 15; ansic: 11
file content (34 lines) | stat: -rw-r--r-- 685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
To use:

import profile_dti as p
import dipy.reconst.dti as dti
lprun -f dti.restore_fit_tensor -f p.tm.fit_method p.func()

"""


import nibabel as nib
import dipy.core.gradients as grad
import dipy.data as dpd
import dipy.reconst.dti as dti

data, bvals, bvecs = dpd.get_data('small_25')
dd = nib.load(data).get_data()
gtab = grad.gradient_table(bvals, bvecs)


fit_method = 'restore' # 'NLLS'
jac = True # False

# To profile RESTORE, set some of the signals to be outliers (otherwise comment
# out the following line):
dd[..., 5] = 1.0

tm = dti.TensorModel(gtab, fit_method=fit_method, jac=True, sigma=10)

def func():
    tf = tm.fit(dd)

if __name__=="__main__":
    func()