11
11
>>> os.chdir(datadir)
12
12
"""
13
13
14
- from ..base import TraitedSpec , traits , isdefined , CommandLineInputSpec
14
+ from ..base import TraitedSpec , traits , CommandLineInputSpec
15
15
from .base import NiftyFitCommand , get_custom_path
16
16
17
17
@@ -28,11 +28,17 @@ class FitAslInputSpec(CommandLineInputSpec):
28
28
29
29
# *** Output options:
30
30
desc = 'Filename of the Cerebral Blood Flow map (in ml/100g/min).'
31
- cbf_file = traits .File (genfile = True , argstr = '-cbf %s' , desc = desc )
31
+ cbf_file = traits .File (name_source = ['source_file' ],
32
+ name_template = '%s_cbf.nii.gz' ,
33
+ argstr = '-cbf %s' , desc = desc )
32
34
desc = 'Filename of the CBF error map.'
33
- error_file = traits .File (genfile = True , argstr = '-error %s' , desc = desc )
35
+ error_file = traits .File (name_source = ['source_file' ],
36
+ name_template = '%s_error.nii.gz' ,
37
+ argstr = '-error %s' , desc = desc )
34
38
desc = 'Filename of the synthetic ASL data.'
35
- syn_file = traits .File (genfile = True , argstr = '-syn %s' , desc = desc )
39
+ syn_file = traits .File (name_source = ['source_file' ],
40
+ name_template = '%s_syn.nii.gz' ,
41
+ argstr = '-syn %s' , desc = desc )
36
42
37
43
# *** Input options (see also fit_qt1 for generic T1 fitting):
38
44
desc = 'Filename of the estimated input T1 map (in ms).'
@@ -139,44 +145,12 @@ class FitAsl(NiftyFitCommand):
139
145
>>> from nipype.interfaces import niftyfit
140
146
>>> node = niftyfit.FitAsl()
141
147
>>> node.inputs.source_file = 'asl.nii.gz'
142
- >>> node.cmdline # doctest: +ELLIPSIS +ALLOW_UNICODE
143
- 'fit_asl -source asl.nii.gz -cbf .../ asl_cbf.nii.gz -error \
144
- .../asl_error.nii.gz -syn .../ asl_syn.nii.gz'
148
+ >>> node.cmdline # doctest: +ALLOW_UNICODE
149
+ 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \
150
+ -syn asl_syn.nii.gz'
145
151
146
152
"""
147
153
_cmd = get_custom_path ('fit_asl' )
148
154
input_spec = FitAslInputSpec
149
155
output_spec = FitAslOutputSpec
150
156
_suffix = '_fit_asl'
151
-
152
- def _gen_filename (self , name ):
153
- if name == 'error_file' :
154
- return self ._gen_fname (self .inputs .source_file ,
155
- suffix = '_error' , ext = '.nii.gz' )
156
- if name == 'syn_file' :
157
- return self ._gen_fname (self .inputs .source_file ,
158
- suffix = '_syn' , ext = '.nii.gz' )
159
- if name == 'cbf_file' :
160
- return self ._gen_fname (self .inputs .source_file ,
161
- suffix = '_cbf' , ext = '.nii.gz' )
162
- return None
163
-
164
- def _list_outputs (self ):
165
- outputs = self .output_spec ().get ()
166
-
167
- if isdefined (self .inputs .error_file ):
168
- outputs ['error_file' ] = self .inputs .error_file
169
- else :
170
- outputs ['error_file' ] = self ._gen_filename ('error_file' )
171
-
172
- if isdefined (self .inputs .syn_file ):
173
- outputs ['syn_file' ] = self .inputs .syn_file
174
- else :
175
- outputs ['syn_file' ] = self ._gen_filename ('syn_file' )
176
-
177
- if isdefined (self .inputs .cbf_file ):
178
- outputs ['cbf_file' ] = self .inputs .cbf_file
179
- else :
180
- outputs ['cbf_file' ] = self ._gen_filename ('cbf_file' )
181
-
182
- return outputs
0 commit comments