Skip to content

FIX: ResponseSD support for multiple b-vals #2582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions nipype/interfaces/mrtrix3/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os.path as op

from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,
File, isdefined, Undefined)
File, isdefined, Undefined, InputMultiObject)
from .base import MRTrix3BaseInputSpec, MRTrix3Base


Expand Down Expand Up @@ -40,10 +40,14 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
argstr='%s', position=-1, desc='output CSF response text file')
in_mask = File(
exists=True, argstr='-mask %s', desc='provide initial mask image')
max_sh = traits.Int(
8, usedefault=True,
argstr='-lmax %d',
desc='maximum harmonic degree of response function')
max_sh = InputMultiObject(
traits.Int,
value=[8],
usedefault=True,
argstr='-lmax %s',
Copy link
Member

@effigies effigies May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, does %d not work, here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, it was complaining about joining ints with str

sep=',',
desc=('maximum harmonic degree of response function - single value for '
'single-shell response, list for multi-shell response'))


class ResponseSDOutputSpec(TraitedSpec):
Expand All @@ -67,6 +71,11 @@ class ResponseSD(MRTrix3Base):
>>> resp.cmdline # doctest: +ELLIPSIS
'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'
>>> resp.run() # doctest: +SKIP

# We can also pass in multiple harmonic degrees in the case of multi-shell
>>> resp.inputs.max_sh = [6,8,10]
>>> resp.cmdline
'dwi2response tournier -fslgrad bvecs bvals -lmax 6,8,10 dwi.mif wm.txt'
"""

_cmd = 'dwi2response'
Expand Down
3 changes: 2 additions & 1 deletion nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def test_ResponseSD_inputs():
),
in_mask=dict(argstr='-mask %s', ),
max_sh=dict(
argstr='-lmax %d',
argstr='-lmax %s',
sep=',',
usedefault=True,
),
mtt_file=dict(
Expand Down