@@ -23,19 +23,24 @@ class DWIDenoiseInputSpec(MRTrix3BaseInputSpec):
23
23
argstr = '-mask %s' ,
24
24
position = 1 ,
25
25
desc = 'mask image' )
26
- extent = traits .Tuple ((traits .Int , traits .Int , traits .Int ),
26
+ extent = traits .Tuple (
27
+ (traits .Int , traits .Int , traits .Int ),
27
28
argstr = '-extent %d,%d,%d' ,
28
29
desc = 'set the window size of the denoising filter. (default = 5,5,5)' )
29
30
noise = File (
30
31
argstr = '-noise %s' ,
31
- desc = 'the output noise map' )
32
- out_file = File (name_template = '%s_denoised' ,
32
+ name_template = '%s_noise' ,
33
33
name_source = 'in_file' ,
34
34
keep_extension = True ,
35
+ desc = 'the output noise map' )
36
+ out_file = File (
35
37
argstr = '%s' ,
36
38
position = - 1 ,
37
- desc = 'the output denoised DWI image' ,
38
- genfile = True )
39
+ name_template = '%s_denoised' ,
40
+ name_source = 'in_file' ,
41
+ keep_extension = True ,
42
+ desc = 'the output denoised DWI image' )
43
+
39
44
40
45
class DWIDenoiseOutputSpec (TraitedSpec ):
41
46
noise = File (desc = 'the output noise map' , exists = True )
@@ -67,22 +72,16 @@ class DWIDenoise(MRTrix3Base):
67
72
>>> denoise = mrt.DWIDenoise()
68
73
>>> denoise.inputs.in_file = 'dwi.mif'
69
74
>>> denoise.inputs.mask = 'mask.mif'
75
+ >>> denoise.inputs.noise = 'noise.mif'
70
76
>>> denoise.cmdline # doctest: +ELLIPSIS
71
- 'dwidenoise -mask mask.mif dwi.mif dwi_denoised.mif'
77
+ 'dwidenoise -mask mask.mif -noise noise.mif dwi.mif dwi_denoised.mif'
72
78
>>> denoise.run() # doctest: +SKIP
73
79
"""
74
80
75
81
_cmd = 'dwidenoise'
76
82
input_spec = DWIDenoiseInputSpec
77
83
output_spec = DWIDenoiseOutputSpec
78
84
79
- def _list_outputs (self ):
80
- outputs = self .output_spec ().get ()
81
- outputs ['out_file' ] = op .abspath (self .inputs .out_file )
82
- if self .inputs .noise != Undefined :
83
- outputs ['noise' ] = op .abspath (self .inputs .noise )
84
- return outputs
85
-
86
85
87
86
class MRDeGibbsInputSpec (MRTrix3BaseInputSpec ):
88
87
in_file = File (
@@ -92,7 +91,7 @@ class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
92
91
mandatory = True ,
93
92
desc = 'input DWI image' )
94
93
axes = traits .ListInt (
95
- default_value = [0 ,1 ],
94
+ default_value = [0 , 1 ],
96
95
usedefault = True ,
97
96
sep = ',' ,
98
97
minlen = 2 ,
@@ -117,13 +116,13 @@ class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
117
116
argstr = '-maxW %d' ,
118
117
desc = 'right border of window used for total variation (TV) computation '
119
118
'(default = 3)' )
120
- out_file = File (name_template = '%s_unr' ,
119
+ out_file = File (
120
+ name_template = '%s_unr' ,
121
121
name_source = 'in_file' ,
122
122
keep_extension = True ,
123
123
argstr = '%s' ,
124
124
position = - 1 ,
125
- desc = 'the output unringed DWI image' ,
126
- genfile = True )
125
+ desc = 'the output unringed DWI image' )
127
126
128
127
class MRDeGibbsOutputSpec (TraitedSpec ):
129
128
out_file = File (desc = 'the output unringed DWI image' , exists = True )
@@ -179,31 +178,21 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec):
179
178
in_mask = File (
180
179
argstr = '-mask %s' ,
181
180
desc = 'input mask image for bias field estimation' )
182
- _xor_methods = ('use_ants' , 'use_fsl' )
183
181
use_ants = traits .Bool (
184
- default_value = True ,
185
- usedefault = True ,
186
182
argstr = '-ants' ,
183
+ mandatory = True ,
187
184
desc = 'use ANTS N4 to estimate the inhomogeneity field' ,
188
- xor = _xor_methods )
185
+ xor = [ 'use_fsl' ] )
189
186
use_fsl = traits .Bool (
190
187
argstr = '-fsl' ,
188
+ mandatory = True ,
191
189
desc = 'use FSL FAST to estimate the inhomogeneity field' ,
192
- xor = _xor_methods ,
193
- min_ver = '5.0.10' )
194
- _xor_grads = ('mrtrix_grad' , 'fsl_grad' )
195
- mrtrix_grad = File (
196
- argstr = '-grad %s' ,
197
- desc = 'diffusion gradient table in MRtrix format' ,
198
- xor = _xor_grads )
199
- fsl_grad = File (
200
- argstr = '-fslgrad %s %s' ,
201
- desc = 'diffusion gradient table in FSL bvecs/bvals format' ,
202
- xor = _xor_grads )
190
+ xor = ['use_ants' ])
203
191
bias = File (
204
192
argstr = '-bias %s' ,
205
193
desc = 'bias field' )
206
- out_file = File (name_template = '%s_biascorr' ,
194
+ out_file = File (
195
+ name_template = '%s_biascorr' ,
207
196
name_source = 'in_file' ,
208
197
keep_extension = True ,
209
198
argstr = '%s' ,
@@ -228,6 +217,7 @@ class DWIBiasCorrect(MRTrix3Base):
228
217
>>> import nipype.interfaces.mrtrix3 as mrt
229
218
>>> bias_correct = mrt.DWIBiasCorrect()
230
219
>>> bias_correct.inputs.in_file = 'dwi.mif'
220
+ >>> bias_correct.inputs.use_ants = True
231
221
>>> bias_correct.cmdline
232
222
'dwibiascorrect -ants dwi.mif dwi_biascorr.mif'
233
223
>>> bias_correct.run() # doctest: +SKIP
@@ -237,13 +227,6 @@ class DWIBiasCorrect(MRTrix3Base):
237
227
input_spec = DWIBiasCorrectInputSpec
238
228
output_spec = DWIBiasCorrectOutputSpec
239
229
240
- def _list_outputs (self ):
241
- outputs = self .output_spec ().get ()
242
- outputs ['out_file' ] = op .abspath (self .inputs .out_file )
243
- if self .inputs .bias != Undefined :
244
- outputs ['bias' ] = op .abspath (self .inputs .bias )
245
- return outputs
246
-
247
230
248
231
class ResponseSDInputSpec (MRTrix3BaseInputSpec ):
249
232
algorithm = traits .Enum (
0 commit comments