@@ -58,9 +58,8 @@ class Dcm2nii(CommandLine):
58
58
>>> converter.inputs.source_names = ['functional_1.dcm', 'functional_2.dcm']
59
59
>>> converter.inputs.gzip_output = True
60
60
>>> converter.inputs.output_dir = '.'
61
- >>> converter.cmdline #doctest: +ELLIPSIS
61
+ >>> converter.cmdline
62
62
'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm'
63
- >>> converter.run() # doctest: +SKIP
64
63
"""
65
64
66
65
input_spec = Dcm2niiInputSpec
@@ -83,11 +82,14 @@ def _format_arg(self, opt, spec, val):
83
82
return super (Dcm2nii , self )._format_arg (opt , spec , val )
84
83
85
84
def _run_interface (self , runtime ):
85
+ self ._config_created = False
86
86
new_runtime = super (Dcm2nii , self )._run_interface (runtime )
87
87
(self .output_files ,
88
88
self .reoriented_files ,
89
89
self .reoriented_and_cropped_files ,
90
90
self .bvecs , self .bvals ) = self ._parse_stdout (new_runtime .stdout )
91
+ if self ._config_created :
92
+ os .remove ('config.ini' )
91
93
return new_runtime
92
94
93
95
def _parse_stdout (self , stdout ):
@@ -156,6 +158,7 @@ def _gen_filename(self, name):
156
158
if name == 'output_dir' :
157
159
return os .getcwd ()
158
160
elif name == 'config_file' :
161
+ self ._config_created = True
159
162
config_file = "config.ini"
160
163
f = open (config_file , "w" )
161
164
# disable interactive mode
0 commit comments