Skip to content

Commit c32258c

Browse files
committed
additional changes to new mrtrix3 interfaces
1 parent 80dc7b2 commit c32258c

File tree

1 file changed

+35
-22
lines changed

1 file changed

+35
-22
lines changed

nipype/interfaces/mrtrix3/preprocess.py

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,22 @@ class DWIDenoiseInputSpec(MRTrix3BaseInputSpec):
2626
extent = traits.Tuple((traits.Int, traits.Int, traits.Int),
2727
argstr='-extent %d,%d,%d',
2828
desc='set the window size of the denoising filter. (default = 5,5,5)')
29-
noise = File(
29+
out_noise = File(name_template='%s_noise',
30+
name_source='in_file',
31+
keep_extension=True,
3032
argstr='-noise %s',
31-
desc='noise map')
33+
desc="the output noise map",
34+
genfile=True)
3235
out_file = File(name_template='%s_denoised',
3336
name_source='in_file',
3437
keep_extension=True,
3538
argstr="%s",
3639
position=-1,
37-
desc="the output denoised DWI image")
40+
desc="the output denoised DWI image",
41+
genfile=True)
3842

3943
class DWIDenoiseOutputSpec(TraitedSpec):
44+
out_noise = File(desc="the output noise map", exists=True)
4045
out_file = File(desc="the output denoised DWI image", exists=True)
4146

4247
class DWIDenoise(MRTrix3Base):
@@ -84,10 +89,10 @@ class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
8489
desc='input DWI image')
8590
axes = InputMultiObject(
8691
traits.Int,
87-
value=[0],
92+
value=[0,1],
8893
usedefault=True,
89-
argstr='-axes %d',
90-
desc='select the slice axes (default = 0)')
94+
argstr='-axes %s', # how to define list?
95+
desc='select the slice axes (default = 0,1)')
9196
nshifts = InputMultiObject(
9297
traits.Int,
9398
value=[20],
@@ -99,19 +104,22 @@ class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
99104
value=[1],
100105
usedefault=True,
101106
argstr='-minW %d',
102-
desc='left border of window used for TV computation (default = 1)')
107+
desc='left border of window used for total variation (TV) computation '
108+
'(default = 1)')
103109
maxW = InputMultiObject(
104110
traits.Int,
105111
value=[3],
106112
usedefault=True,
107113
argstr='-maxW %d',
108-
desc='right border of window used for TV computation (default = 3)')
114+
desc='right border of window used for total variation (TV) computation '
115+
'(default = 3)')
109116
out_file = File(name_template='%s_unring',
110117
name_source='in_file',
111118
keep_extension=True,
112119
argstr="%s",
113120
position=-1,
114-
desc="the output unringed DWI image")
121+
desc="the output unringed DWI image",
122+
genfile=True)
115123

116124
class MRDeGibbsOutputSpec(TraitedSpec):
117125
out_file = File(desc="the output unringed DWI image", exists=True)
@@ -147,9 +155,9 @@ class MRDeGibbs(MRTrix3Base):
147155
>>> import nipype.interfaces.mrtrix3 as mrt
148156
>>> unring = mrt.MRDeGibbs()
149157
>>> unring.inputs.in_file = 'dwi.mif'
150-
>>> unring.cmdline
158+
>>> unring.cmdline # doctest: +ELLIPSIS
151159
'mrdegibbs dwi.mif dwi_unring.mif'
152-
>>> unring.run()
160+
>>> unring.run() # doctest: +SKIP
153161
"""
154162

155163
_cmd = 'mrdegibbs'
@@ -164,33 +172,38 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec):
164172
position=-2,
165173
mandatory=True,
166174
desc='input DWI image')
167-
mask = File(
175+
in_mask = File(
168176
argstr='-mask %s',
169177
desc='mask image')
170-
bias = File(
171-
argstr='-bias %s',
172-
desc='bias field')
173178
ants = traits.Bool(
174179
True,
175180
argstr='-ants',
176-
desc='use ANTS N4')
181+
desc='use ANTS N4 to estimate the inhomogeneity field')
177182
fsl = traits.Bool(
178183
False,
179184
argstr='-fsl',
180-
desc='use FSL FAST',
185+
desc='use FSL FAST to estimate the inhomogeneity field',
181186
min_ver='5.0.10')
187+
# only one of either grad or fslgrad should be supplied
182188
grad = File(
183189
argstr='-grad %s',
184190
desc='diffusion gradient table in MRtrix format')
185191
fslgrad = File(
186192
argstr='-fslgrad %s %s',
187193
desc='diffusion gradient table in FSL bvecs/bvals format')
188-
out_file = File(name_template='%s_unbias',
194+
out_bias = File(name_template='%s_biasfield',
195+
name_source='in_file',
196+
keep_extension=True,
197+
argstr='-bias %s',
198+
desc='bias field',
199+
genfile=True)
200+
out_file = File(name_template='%s_biascorr',
189201
name_source='in_file',
190202
keep_extension=True,
191203
argstr="%s",
192204
position=-1,
193-
desc="the output bias corrected DWI image")
205+
desc="the output bias corrected DWI image",
206+
genfile=True)
194207

195208
class DWIBiasCorrectOutputSpec(TraitedSpec):
196209
out_file = File(desc="the output bias corrected DWI image", exists=True)
@@ -208,9 +221,9 @@ class DWIBiasCorrect(MRTrix3Base):
208221
>>> import nipype.interfaces.mrtrix3 as mrt
209222
>>> bias_correct = mrt.DWIBiasCorrect()
210223
>>> bias_correct.inputs.in_file = 'dwi.mif'
211-
>>> bias_correct.cmdline
212-
'dwibiascorrect dwi.mif dwi_unbias.mif'
213-
>>> bias_correct.run()
224+
>>> bias_correct.cmdline # doctest: +ELLIPSIS
225+
'dwibiascorrect dwi.mif dwi_biascorr.mif'
226+
>>> bias_correct.run() # doctest: +SKIP
214227
"""
215228

216229
_cmd = 'dwibiascorrect'

0 commit comments

Comments
 (0)