Skip to content

Commit 53e0662

Browse files
authored
Merge pull request #2582 from mgxd/fix/response
FIX: ResponseSD support for multiple b-vals
2 parents d65688c + b58b95d commit 53e0662

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

nipype/interfaces/mrtrix3/preprocess.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os.path as op
88

99
from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,
10-
File, isdefined, Undefined)
10+
File, isdefined, Undefined, InputMultiObject)
1111
from .base import MRTrix3BaseInputSpec, MRTrix3Base
1212

1313

@@ -40,10 +40,14 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
4040
argstr='%s', position=-1, desc='output CSF response text file')
4141
in_mask = File(
4242
exists=True, argstr='-mask %s', desc='provide initial mask image')
43-
max_sh = traits.Int(
44-
8, usedefault=True,
45-
argstr='-lmax %d',
46-
desc='maximum harmonic degree of response function')
43+
max_sh = InputMultiObject(
44+
traits.Int,
45+
value=[8],
46+
usedefault=True,
47+
argstr='-lmax %s',
48+
sep=',',
49+
desc=('maximum harmonic degree of response function - single value for '
50+
'single-shell response, list for multi-shell response'))
4751

4852

4953
class ResponseSDOutputSpec(TraitedSpec):
@@ -67,6 +71,11 @@ class ResponseSD(MRTrix3Base):
6771
>>> resp.cmdline # doctest: +ELLIPSIS
6872
'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'
6973
>>> resp.run() # doctest: +SKIP
74+
75+
# We can also pass in multiple harmonic degrees in the case of multi-shell
76+
>>> resp.inputs.max_sh = [6,8,10]
77+
>>> resp.cmdline
78+
'dwi2response tournier -fslgrad bvecs bvals -lmax 6,8,10 dwi.mif wm.txt'
7079
"""
7180

7281
_cmd = 'dwi2response'

nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def test_ResponseSD_inputs():
4040
),
4141
in_mask=dict(argstr='-mask %s', ),
4242
max_sh=dict(
43-
argstr='-lmax %d',
43+
argstr='-lmax %s',
44+
sep=',',
4445
usedefault=True,
4546
),
4647
mtt_file=dict(

0 commit comments

Comments
 (0)