We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
mrtrix3.ResponseSD - Handling of multiple b-values
### Summary
When running ResponseSD() (and assuming EstimateFOD(), which has a similar input), current interface does not seem to handle multiple b-values (possibly due to the input `max_sh` defaulting to a single integer value).

### Actual behavior
Get an error specifying the number of manually-defined lmax's does not match number of b-values (see last line).

```Command:  mrconvert /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/MRConvert/dwi.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/dwi.mif -strides 0,0,0,1 -fslgrad /home/tkai/graham/scratch/WholeBrain/derivatives/prepdwi_0.0.6a/prepdwi/sub-5082/dwi/sub-5082_dwi_space-T1w_preproc.bvec /home/tkai/graham/scratch/WholeBrain/derivatives/prepdwi_0.0.6a/prepdwi/sub-5082/dwi/sub-5082_dwi_space-T1w_preproc.bval
Command:  dwi2mask /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/MRConvert/dwi.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/mask.mif
Command:  mrconvert /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/Generate5tt/5tt.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/5tt.mif
dwi2response: Changing to temporary directory (/home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/)
Command:  5ttcheck 5tt.mif
dwi2response: [ERROR] Number of manually-defined lmax's (1) does not match number of b-values (3)
```

### Expected behavior
The lmax, if manually defined should allow for more than a single integer to match the number of b-values (e.g. -lmax 0,8,8 in this case), otherwise no default from the Nipype interface.

At the moment, I've forked a copy of nipype and made a temporary solution with the input `max_sh` passing the expected input as a string, removing the default to run without error.

### How to replicate the behavior
Use of multi-shell dwi data with mrt.ResponseSD and algorithm 'msmt_5tt'.

### Script/Workflow details

Current pipeline code is stored at [https://github.com/kaitj/mrtpipelines](https://github.com/kaitj/mrtpipelines)

### Platform details:

```
python3 -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"
{'nibabel_version': '2.2.1', 'numpy_version': '1.14.3', 'nipype_version': '1.0.4-dev+g5a96ea5', 'commit_source': 'repository', 'sys_version': '3.5.2 (default, Nov 23 2017, 16:37:01) \n[GCC 5.4.0 20160609]', 'traits_version': '4.6.0', 'scipy_version': '1.1.0', 'pkg_path': '/home/tkai/git/nipype/nipype', 'sys_platform': 'linux', 'commit_hash': '5a96ea5', 'networkx_version': '2.1', 'sys_executable': '/usr/bin/python3'}
1.0.4-dev+g5a96ea5
```

### Execution environment

Choose one
- Container [Tag: ???]
- My python environment inside container [Base Tag: ???]
- My python environment outside container


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nipype/interfaces/mrtrix3/preprocess.py`
Content:
```
1 # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2 # vi: set ft=python sts=4 ts=4 sw=4 et:
3 # -*- coding: utf-8 -*-
4 from __future__ import (print_function, division, unicode_literals,
5                         absolute_import)
6 
7 import os.path as op
8 
9 from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,
10                     File, isdefined, Undefined)
11 from .base import MRTrix3BaseInputSpec, MRTrix3Base
12 
13 
14 class ResponseSDInputSpec(MRTrix3BaseInputSpec):
15     algorithm = traits.Enum(
16         'msmt_5tt',
17         'dhollander',
18         'tournier',
19         'tax',
20         argstr='%s',
21         position=1,
22         mandatory=True,
23         desc='response estimation algorithm (multi-tissue)')
24     in_file = File(
25         exists=True,
26         argstr='%s',
27         position=-5,
28         mandatory=True,
29         desc='input DWI image')
30     mtt_file = File(argstr='%s', position=-4, desc='input 5tt image')
31     wm_file = File(
32         'wm.txt',
33         argstr='%s',
34         position=-3,
35         usedefault=True,
36         desc='output WM response text file')
37     gm_file = File(
38         argstr='%s', position=-2, desc='output GM response text file')
39     csf_file = File(
40         argstr='%s', position=-1, desc='output CSF response text file')
41     in_mask = File(
42         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')
47 
48 
49 class ResponseSDOutputSpec(TraitedSpec):
50     wm_file = File(argstr='%s', desc='output WM response text file')
51     gm_file = File(argstr='%s', desc='output GM response text file')
52     csf_file = File(argstr='%s', desc='output CSF response text file')
53 
54 
55 class ResponseSD(MRTrix3Base):
56     """
57     Estimate response function(s) for spherical deconvolution using the specified algorithm.
58 
59     Example
60     -------
61 
62     >>> import nipype.interfaces.mrtrix3 as mrt
63     >>> resp = mrt.ResponseSD()
64     >>> resp.inputs.in_file = 'dwi.mif'
65     >>> resp.inputs.algorithm = 'tournier'
66     >>> resp.inputs.grad_fsl = ('bvecs', 'bvals')
67     >>> resp.cmdline                               # doctest: +ELLIPSIS
68     'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'
69     >>> resp.run()                                 # doctest: +SKIP
70     """
71 
72     _cmd = 'dwi2response'
73     input_spec = ResponseSDInputSpec
74     output_spec = ResponseSDOutputSpec
75 
76     def _list_outputs(self):
77         outputs = self.output_spec().get()
78         outputs['wm_file'] = op.abspath(self.inputs.wm_file)
79         if self.inputs.gm_file != Undefined:
80             outputs['gm_file'] = op.abspath(self.inputs.gm_file)
81         if self.inputs.csf_file != Undefined:
82             outputs['csf_file'] = op.abspath(self.inputs.csf_file)
83         return outputs
84 
85 
86 class ACTPrepareFSLInputSpec(CommandLineInputSpec):
87     in_file = File(
88         exists=True,
89         argstr='%s',
90         mandatory=True,
91         position=-2,
92         desc='input anatomical image')
93 
94     out_file = File(
95         'act_5tt.mif',
96         argstr='%s',
97         mandatory=True,
98         position=-1,
99         usedefault=True,
100         desc='output file after processing')
101 
102 
103 class ACTPrepareFSLOutputSpec(TraitedSpec):
104     out_file = File(exists=True, desc='the output response file')
105 
106 
107 class ACTPrepareFSL(CommandLine):
108     """
109     Generate anatomical information necessary for Anatomically
110     Constrained Tractography (ACT).
111 
112     Example
113     -------
114 
115     >>> import nipype.interfaces.mrtrix3 as mrt
116     >>> prep = mrt.ACTPrepareFSL()
117     >>> prep.inputs.in_file = 'T1.nii.gz'
118     >>> prep.cmdline                               # doctest: +ELLIPSIS
119     'act_anat_prepare_fsl T1.nii.gz act_5tt.mif'
120     >>> prep.run()                                 # doctest: +SKIP
121     """
122 
123     _cmd = 'act_anat_prepare_fsl'
124     input_spec = ACTPrepareFSLInputSpec
125     output_spec = ACTPrepareFSLOutputSpec
126 
127     def _list_outputs(self):
128         outputs = self.output_spec().get()
129         outputs['out_file'] = op.abspath(self.inputs.out_file)
130         return outputs
131 
132 
133 class ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec):
134     in_file = File(
135         exists=True,
136         argstr='%s',
137         mandatory=True,
138         position=-4,
139         desc='input anatomical image')
140     in_t1w = File(
141         exists=True,
142         argstr='%s',
143         mandatory=True,
144         position=-3,
145         desc='input T1 image')
146     in_config = File(
147         exists=True,
148         argstr='%s',
149         position=-2,
150         desc='connectome configuration file')
151 
152     out_file = File(
153         'aparc+first.mif',
154         argstr='%s',
155         mandatory=True,
156         position=-1,
157         usedefault=True,
158         desc='output file after processing')
159 
160 
161 class ReplaceFSwithFIRSTOutputSpec(TraitedSpec):
162     out_file = File(exists=True, desc='the output response file')
163 
164 
165 class ReplaceFSwithFIRST(CommandLine):
166     """
167     Replace deep gray matter structures segmented with FSL FIRST in a
168     FreeSurfer parcellation.
169 
170     Example
171     -------
172 
173     >>> import nipype.interfaces.mrtrix3 as mrt
174     >>> prep = mrt.ReplaceFSwithFIRST()
175     >>> prep.inputs.in_file = 'aparc+aseg.nii'
176     >>> prep.inputs.in_t1w = 'T1.nii.gz'
177     >>> prep.inputs.in_config = 'mrtrix3_labelconfig.txt'
178     >>> prep.cmdline                               # doctest: +ELLIPSIS
179     'fs_parc_replace_sgm_first aparc+aseg.nii T1.nii.gz \
180 mrtrix3_labelconfig.txt aparc+first.mif'
181     >>> prep.run()                                 # doctest: +SKIP
182     """
183 
184     _cmd = 'fs_parc_replace_sgm_first'
185     input_spec = ReplaceFSwithFIRSTInputSpec
186     output_spec = ReplaceFSwithFIRSTOutputSpec
187 
188     def _list_outputs(self):
189         outputs = self.output_spec().get()
190         outputs['out_file'] = op.abspath(self.inputs.out_file)
191         return outputs
192
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py
--- a/nipype/interfaces/mrtrix3/preprocess.py
+++ b/nipype/interfaces/mrtrix3/preprocess.py
@@ -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
 
 
@@ -40,10 +40,14 @@
         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',
+        sep=',',
+        desc=('maximum harmonic degree of response function - single value for '
+              'single-shell response, list for multi-shell response'))
 
 
 class ResponseSDOutputSpec(TraitedSpec):
@@ -67,6 +71,11 @@
     >>> 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'

{"golden_diff": "diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py\n--- a/nipype/interfaces/mrtrix3/preprocess.py\n+++ b/nipype/interfaces/mrtrix3/preprocess.py\n@@ -7,7 +7,7 @@\n import os.path as op\n \n from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,\n-                    File, isdefined, Undefined)\n+                    File, isdefined, Undefined, InputMultiObject)\n from .base import MRTrix3BaseInputSpec, MRTrix3Base\n \n \n@@ -40,10 +40,14 @@\n         argstr='%s', position=-1, desc='output CSF response text file')\n     in_mask = File(\n         exists=True, argstr='-mask %s', desc='provide initial mask image')\n-    max_sh = traits.Int(\n-        8, usedefault=True,\n-        argstr='-lmax %d',\n-        desc='maximum harmonic degree of response function')\n+    max_sh = InputMultiObject(\n+        traits.Int,\n+        value=[8],\n+        usedefault=True,\n+        argstr='-lmax %s',\n+        sep=',',\n+        desc=('maximum harmonic degree of response function - single value for '\n+              'single-shell response, list for multi-shell response'))\n \n \n class ResponseSDOutputSpec(TraitedSpec):\n@@ -67,6 +71,11 @@\n     >>> resp.cmdline                               # doctest: +ELLIPSIS\n     'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'\n     >>> resp.run()                                 # doctest: +SKIP\n+\n+    # We can also pass in multiple harmonic degrees in the case of multi-shell\n+    >>> resp.inputs.max_sh = [6,8,10]\n+    >>> resp.cmdline\n+    'dwi2response tournier -fslgrad bvecs bvals -lmax 6,8,10 dwi.mif wm.txt'\n     \"\"\"\n \n     _cmd = 'dwi2response'\n", "issue": "mrtrix3.ResponseSD - Handling of multiple b-values\n### Summary\r\nWhen running ResponseSD() (and assuming EstimateFOD(), which has a similar input), current interface does not seem to handle multiple b-values (possibly due to the input `max_sh` defaulting to a single integer value).\r\n\r\n### Actual behavior\r\nGet an error specifying the number of manually-defined lmax's does not match number of b-values (see last line).\r\n\r\n```Command:  mrconvert /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/MRConvert/dwi.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/dwi.mif -strides 0,0,0,1 -fslgrad /home/tkai/graham/scratch/WholeBrain/derivatives/prepdwi_0.0.6a/prepdwi/sub-5082/dwi/sub-5082_dwi_space-T1w_preproc.bvec /home/tkai/graham/scratch/WholeBrain/derivatives/prepdwi_0.0.6a/prepdwi/sub-5082/dwi/sub-5082_dwi_space-T1w_preproc.bval\r\nCommand:  dwi2mask /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/MRConvert/dwi.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/mask.mif\r\nCommand:  mrconvert /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/Generate5tt/5tt.mif /home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/5tt.mif\r\ndwi2response: Changing to temporary directory (/home/tkai/Desktop/tmp2/genACTTractography/act_preproc_wf/dwi2response/dwi2response-tmp-U774DL/)\r\nCommand:  5ttcheck 5tt.mif\r\ndwi2response: [ERROR] Number of manually-defined lmax's (1) does not match number of b-values (3)\r\n```\r\n\r\n### Expected behavior\r\nThe lmax, if manually defined should allow for more than a single integer to match the number of b-values (e.g. -lmax 0,8,8 in this case), otherwise no default from the Nipype interface.\r\n\r\nAt the moment, I've forked a copy of nipype and made a temporary solution with the input `max_sh` passing the expected input as a string, removing the default to run without error.\r\n\r\n### How to replicate the behavior\r\nUse of multi-shell dwi data with mrt.ResponseSD and algorithm 'msmt_5tt'.\r\n\r\n### Script/Workflow details\r\n\r\nCurrent pipeline code is stored at [https://github.com/kaitj/mrtpipelines](https://github.com/kaitj/mrtpipelines)\r\n\r\n### Platform details:\r\n\r\n```\r\npython3 -c \"import nipype; print(nipype.get_info()); print(nipype.__version__)\"\r\n{'nibabel_version': '2.2.1', 'numpy_version': '1.14.3', 'nipype_version': '1.0.4-dev+g5a96ea5', 'commit_source': 'repository', 'sys_version': '3.5.2 (default, Nov 23 2017, 16:37:01) \\n[GCC 5.4.0 20160609]', 'traits_version': '4.6.0', 'scipy_version': '1.1.0', 'pkg_path': '/home/tkai/git/nipype/nipype', 'sys_platform': 'linux', 'commit_hash': '5a96ea5', 'networkx_version': '2.1', 'sys_executable': '/usr/bin/python3'}\r\n1.0.4-dev+g5a96ea5\r\n```\r\n\r\n### Execution environment\r\n\r\nChoose one\r\n- Container [Tag: ???]\r\n- My python environment inside container [Base Tag: ???]\r\n- My python environment outside container\r\n\n", "before_files": [{"content": "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n# -*- coding: utf-8 -*-\nfrom __future__ import (print_function, division, unicode_literals,\n                        absolute_import)\n\nimport os.path as op\n\nfrom ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,\n                    File, isdefined, Undefined)\nfrom .base import MRTrix3BaseInputSpec, MRTrix3Base\n\n\nclass ResponseSDInputSpec(MRTrix3BaseInputSpec):\n    algorithm = traits.Enum(\n        'msmt_5tt',\n        'dhollander',\n        'tournier',\n        'tax',\n        argstr='%s',\n        position=1,\n        mandatory=True,\n        desc='response estimation algorithm (multi-tissue)')\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        position=-5,\n        mandatory=True,\n        desc='input DWI image')\n    mtt_file = File(argstr='%s', position=-4, desc='input 5tt image')\n    wm_file = File(\n        'wm.txt',\n        argstr='%s',\n        position=-3,\n        usedefault=True,\n        desc='output WM response text file')\n    gm_file = File(\n        argstr='%s', position=-2, desc='output GM response text file')\n    csf_file = File(\n        argstr='%s', position=-1, desc='output CSF response text file')\n    in_mask = File(\n        exists=True, argstr='-mask %s', desc='provide initial mask image')\n    max_sh = traits.Int(\n        8, usedefault=True,\n        argstr='-lmax %d',\n        desc='maximum harmonic degree of response function')\n\n\nclass ResponseSDOutputSpec(TraitedSpec):\n    wm_file = File(argstr='%s', desc='output WM response text file')\n    gm_file = File(argstr='%s', desc='output GM response text file')\n    csf_file = File(argstr='%s', desc='output CSF response text file')\n\n\nclass ResponseSD(MRTrix3Base):\n    \"\"\"\n    Estimate response function(s) for spherical deconvolution using the specified algorithm.\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> resp = mrt.ResponseSD()\n    >>> resp.inputs.in_file = 'dwi.mif'\n    >>> resp.inputs.algorithm = 'tournier'\n    >>> resp.inputs.grad_fsl = ('bvecs', 'bvals')\n    >>> resp.cmdline                               # doctest: +ELLIPSIS\n    'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'\n    >>> resp.run()                                 # doctest: +SKIP\n    \"\"\"\n\n    _cmd = 'dwi2response'\n    input_spec = ResponseSDInputSpec\n    output_spec = ResponseSDOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['wm_file'] = op.abspath(self.inputs.wm_file)\n        if self.inputs.gm_file != Undefined:\n            outputs['gm_file'] = op.abspath(self.inputs.gm_file)\n        if self.inputs.csf_file != Undefined:\n            outputs['csf_file'] = op.abspath(self.inputs.csf_file)\n        return outputs\n\n\nclass ACTPrepareFSLInputSpec(CommandLineInputSpec):\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-2,\n        desc='input anatomical image')\n\n    out_file = File(\n        'act_5tt.mif',\n        argstr='%s',\n        mandatory=True,\n        position=-1,\n        usedefault=True,\n        desc='output file after processing')\n\n\nclass ACTPrepareFSLOutputSpec(TraitedSpec):\n    out_file = File(exists=True, desc='the output response file')\n\n\nclass ACTPrepareFSL(CommandLine):\n    \"\"\"\n    Generate anatomical information necessary for Anatomically\n    Constrained Tractography (ACT).\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> prep = mrt.ACTPrepareFSL()\n    >>> prep.inputs.in_file = 'T1.nii.gz'\n    >>> prep.cmdline                               # doctest: +ELLIPSIS\n    'act_anat_prepare_fsl T1.nii.gz act_5tt.mif'\n    >>> prep.run()                                 # doctest: +SKIP\n    \"\"\"\n\n    _cmd = 'act_anat_prepare_fsl'\n    input_spec = ACTPrepareFSLInputSpec\n    output_spec = ACTPrepareFSLOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['out_file'] = op.abspath(self.inputs.out_file)\n        return outputs\n\n\nclass ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec):\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-4,\n        desc='input anatomical image')\n    in_t1w = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-3,\n        desc='input T1 image')\n    in_config = File(\n        exists=True,\n        argstr='%s',\n        position=-2,\n        desc='connectome configuration file')\n\n    out_file = File(\n        'aparc+first.mif',\n        argstr='%s',\n        mandatory=True,\n        position=-1,\n        usedefault=True,\n        desc='output file after processing')\n\n\nclass ReplaceFSwithFIRSTOutputSpec(TraitedSpec):\n    out_file = File(exists=True, desc='the output response file')\n\n\nclass ReplaceFSwithFIRST(CommandLine):\n    \"\"\"\n    Replace deep gray matter structures segmented with FSL FIRST in a\n    FreeSurfer parcellation.\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> prep = mrt.ReplaceFSwithFIRST()\n    >>> prep.inputs.in_file = 'aparc+aseg.nii'\n    >>> prep.inputs.in_t1w = 'T1.nii.gz'\n    >>> prep.inputs.in_config = 'mrtrix3_labelconfig.txt'\n    >>> prep.cmdline                               # doctest: +ELLIPSIS\n    'fs_parc_replace_sgm_first aparc+aseg.nii T1.nii.gz \\\nmrtrix3_labelconfig.txt aparc+first.mif'\n    >>> prep.run()                                 # doctest: +SKIP\n    \"\"\"\n\n    _cmd = 'fs_parc_replace_sgm_first'\n    input_spec = ReplaceFSwithFIRSTInputSpec\n    output_spec = ReplaceFSwithFIRSTOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['out_file'] = op.abspath(self.inputs.out_file)\n        return outputs\n", "path": "nipype/interfaces/mrtrix3/preprocess.py"}], "after_files": [{"content": "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n# -*- coding: utf-8 -*-\nfrom __future__ import (print_function, division, unicode_literals,\n                        absolute_import)\n\nimport os.path as op\n\nfrom ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec,\n                    File, isdefined, Undefined, InputMultiObject)\nfrom .base import MRTrix3BaseInputSpec, MRTrix3Base\n\n\nclass ResponseSDInputSpec(MRTrix3BaseInputSpec):\n    algorithm = traits.Enum(\n        'msmt_5tt',\n        'dhollander',\n        'tournier',\n        'tax',\n        argstr='%s',\n        position=1,\n        mandatory=True,\n        desc='response estimation algorithm (multi-tissue)')\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        position=-5,\n        mandatory=True,\n        desc='input DWI image')\n    mtt_file = File(argstr='%s', position=-4, desc='input 5tt image')\n    wm_file = File(\n        'wm.txt',\n        argstr='%s',\n        position=-3,\n        usedefault=True,\n        desc='output WM response text file')\n    gm_file = File(\n        argstr='%s', position=-2, desc='output GM response text file')\n    csf_file = File(\n        argstr='%s', position=-1, desc='output CSF response text file')\n    in_mask = File(\n        exists=True, argstr='-mask %s', desc='provide initial mask image')\n    max_sh = InputMultiObject(\n        traits.Int,\n        value=[8],\n        usedefault=True,\n        argstr='-lmax %s',\n        sep=',',\n        desc=('maximum harmonic degree of response function - single value for '\n              'single-shell response, list for multi-shell response'))\n\n\nclass ResponseSDOutputSpec(TraitedSpec):\n    wm_file = File(argstr='%s', desc='output WM response text file')\n    gm_file = File(argstr='%s', desc='output GM response text file')\n    csf_file = File(argstr='%s', desc='output CSF response text file')\n\n\nclass ResponseSD(MRTrix3Base):\n    \"\"\"\n    Estimate response function(s) for spherical deconvolution using the specified algorithm.\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> resp = mrt.ResponseSD()\n    >>> resp.inputs.in_file = 'dwi.mif'\n    >>> resp.inputs.algorithm = 'tournier'\n    >>> resp.inputs.grad_fsl = ('bvecs', 'bvals')\n    >>> resp.cmdline                               # doctest: +ELLIPSIS\n    'dwi2response tournier -fslgrad bvecs bvals -lmax 8 dwi.mif wm.txt'\n    >>> resp.run()                                 # doctest: +SKIP\n\n    # We can also pass in multiple harmonic degrees in the case of multi-shell\n    >>> resp.inputs.max_sh = [6,8,10]\n    >>> resp.cmdline\n    'dwi2response tournier -fslgrad bvecs bvals -lmax 6,8,10 dwi.mif wm.txt'\n    \"\"\"\n\n    _cmd = 'dwi2response'\n    input_spec = ResponseSDInputSpec\n    output_spec = ResponseSDOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['wm_file'] = op.abspath(self.inputs.wm_file)\n        if self.inputs.gm_file != Undefined:\n            outputs['gm_file'] = op.abspath(self.inputs.gm_file)\n        if self.inputs.csf_file != Undefined:\n            outputs['csf_file'] = op.abspath(self.inputs.csf_file)\n        return outputs\n\n\nclass ACTPrepareFSLInputSpec(CommandLineInputSpec):\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-2,\n        desc='input anatomical image')\n\n    out_file = File(\n        'act_5tt.mif',\n        argstr='%s',\n        mandatory=True,\n        position=-1,\n        usedefault=True,\n        desc='output file after processing')\n\n\nclass ACTPrepareFSLOutputSpec(TraitedSpec):\n    out_file = File(exists=True, desc='the output response file')\n\n\nclass ACTPrepareFSL(CommandLine):\n    \"\"\"\n    Generate anatomical information necessary for Anatomically\n    Constrained Tractography (ACT).\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> prep = mrt.ACTPrepareFSL()\n    >>> prep.inputs.in_file = 'T1.nii.gz'\n    >>> prep.cmdline                               # doctest: +ELLIPSIS\n    'act_anat_prepare_fsl T1.nii.gz act_5tt.mif'\n    >>> prep.run()                                 # doctest: +SKIP\n    \"\"\"\n\n    _cmd = 'act_anat_prepare_fsl'\n    input_spec = ACTPrepareFSLInputSpec\n    output_spec = ACTPrepareFSLOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['out_file'] = op.abspath(self.inputs.out_file)\n        return outputs\n\n\nclass ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec):\n    in_file = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-4,\n        desc='input anatomical image')\n    in_t1w = File(\n        exists=True,\n        argstr='%s',\n        mandatory=True,\n        position=-3,\n        desc='input T1 image')\n    in_config = File(\n        exists=True,\n        argstr='%s',\n        position=-2,\n        desc='connectome configuration file')\n\n    out_file = File(\n        'aparc+first.mif',\n        argstr='%s',\n        mandatory=True,\n        position=-1,\n        usedefault=True,\n        desc='output file after processing')\n\n\nclass ReplaceFSwithFIRSTOutputSpec(TraitedSpec):\n    out_file = File(exists=True, desc='the output response file')\n\n\nclass ReplaceFSwithFIRST(CommandLine):\n    \"\"\"\n    Replace deep gray matter structures segmented with FSL FIRST in a\n    FreeSurfer parcellation.\n\n    Example\n    -------\n\n    >>> import nipype.interfaces.mrtrix3 as mrt\n    >>> prep = mrt.ReplaceFSwithFIRST()\n    >>> prep.inputs.in_file = 'aparc+aseg.nii'\n    >>> prep.inputs.in_t1w = 'T1.nii.gz'\n    >>> prep.inputs.in_config = 'mrtrix3_labelconfig.txt'\n    >>> prep.cmdline                               # doctest: +ELLIPSIS\n    'fs_parc_replace_sgm_first aparc+aseg.nii T1.nii.gz \\\nmrtrix3_labelconfig.txt aparc+first.mif'\n    >>> prep.run()                                 # doctest: +SKIP\n    \"\"\"\n\n    _cmd = 'fs_parc_replace_sgm_first'\n    input_spec = ReplaceFSwithFIRSTInputSpec\n    output_spec = ReplaceFSwithFIRSTOutputSpec\n\n    def _list_outputs(self):\n        outputs = self.output_spec().get()\n        outputs['out_file'] = op.abspath(self.inputs.out_file)\n        return outputs\n", "path": "nipype/interfaces/mrtrix3/preprocess.py"}]}