Skip to content

Commit b9c8775

Browse files
author
Erik Ziegler
committed
Updated Tensor Mode interface to use latest dipy tensor code
1 parent 4722475 commit b9c8775

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

nipype/interfaces/dipy/tensors.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
try:
1515
package_check('dipy')
1616
import dipy.reconst.dti as dti
17+
from dipy.core.gradients import GradientTable
1718
except Exception, e:
1819
warnings.warn('dipy not installed')
1920

@@ -53,9 +54,14 @@ def _run_interface(self, runtime):
5354
bvals=np.loadtxt(self.inputs.bvals)
5455
gradients=np.loadtxt(self.inputs.bvecs).T
5556

56-
tensor = dti.Tensor(data,bvals,gradients,thresh=50)
57-
58-
mode_data = tensor.mode
57+
gtab = GradientTable(gradients)
58+
gtab.bvals = bvals
59+
60+
mask = data[..., 0] > 50
61+
tenmodel = dti.TensorModel(gtab)
62+
tenfit = tenmodel.fit(data, mask)
63+
64+
mode_data = tenfit.mode
5965
img = nb.Nifti1Image(mode_data,affine)
6066
out_file = op.abspath(self.inputs.out_filename)
6167
nb.save(img, out_file)

0 commit comments

Comments
 (0)