Skip to content

Commit

Permalink
Update tmi.py output diff tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen33344 authored Jul 22, 2024
1 parent a86a69c commit 0c14a85
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions designer2/tmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def execute(): #pylint: disable=unused-variable
if len(set(dwi_metadata['echo_time_per_volume'])) == 1:

if app.ARGS.DTI:
from lib.mpunits import vectorize
print('...Single shell DTI fit...')
dtishell = (bval <= 0.1) | ((bval > .5) & (bval <= 1.5))
dwi_dti = dwi[:,:,:,dtishell]
Expand All @@ -164,7 +165,13 @@ def execute(): #pylint: disable=unused-variable
dti = tensor.TensorFitting(grad_dti, int(app.ARGS.n_cores))
dt_dti, s0_dti, b_dti = dti.dti_fit(dwi_dti, mask)

dt_ = {}
dt_dti_ = vectorize(dt_dti, mask)
dt_['dt'] = dt_dti_
save_params(dt_, nii, model='dti', outdir=outdir)

if app.ARGS.DKI or app.ARGS.WDKI:
from lib.mpunits import vectorize
print('...Multi shell DKI fit with constraints = ' + str(constraints))

maxb = 2.5
Expand All @@ -176,6 +183,11 @@ def execute(): #pylint: disable=unused-variable
dki = tensor.TensorFitting(grad_dki, int(app.ARGS.n_cores))
dt_dki, s0_dki, b_dki = dki.dki_fit(dwi_dki, mask, constraints=constraints)

dt_ = {}
dt_dki_ = vectorize(dt_dki, mask)
dt_['dt'] = dt_dki_
save_params(dt_, nii, model='dki', outdir=outdir)

if app.ARGS.polyreg and app.ARGS.DKI:
dt_poly = dki.train_rotated_bayes_fit(dwi_dki, dt_dki, s0_dki, b_dki, mask)

Expand Down

0 comments on commit 0c14a85

Please sign in to comment.