@@ -58,9 +58,8 @@ class Dcm2nii(CommandLine):
5858 >>> converter.inputs.source_names = ['functional_1.dcm', 'functional_2.dcm']
5959 >>> converter.inputs.gzip_output = True
6060 >>> converter.inputs.output_dir = '.'
61- >>> converter.cmdline #doctest: +ELLIPSIS
61+ >>> converter.cmdline
6262 '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
6463 """
6564
6665 input_spec = Dcm2niiInputSpec
@@ -83,11 +82,14 @@ def _format_arg(self, opt, spec, val):
8382 return super (Dcm2nii , self )._format_arg (opt , spec , val )
8483
8584 def _run_interface (self , runtime ):
85+ self ._config_created = False
8686 new_runtime = super (Dcm2nii , self )._run_interface (runtime )
8787 (self .output_files ,
8888 self .reoriented_files ,
8989 self .reoriented_and_cropped_files ,
9090 self .bvecs , self .bvals ) = self ._parse_stdout (new_runtime .stdout )
91+ if self ._config_created :
92+ os .remove ('config.ini' )
9193 return new_runtime
9294
9395 def _parse_stdout (self , stdout ):
@@ -156,6 +158,7 @@ def _gen_filename(self, name):
156158 if name == 'output_dir' :
157159 return os .getcwd ()
158160 elif name == 'config_file' :
161+ self ._config_created = True
159162 config_file = "config.ini"
160163 f = open (config_file , "w" )
161164 # disable interactive mode
0 commit comments