Skip to content

Commit 7410d05

Browse files
committed
Merge pull request #834 from chrisfilo/fix/dcm2nii
Revert some changes that broke file gathering, added more efficient commandline creation.
2 parents cba8e41 + b53de15 commit 7410d05

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Dcm2nii(CommandLine):
5050
>>> converter.inputs.gzip_output = True
5151
>>> converter.inputs.output_dir = '.'
5252
>>> converter.cmdline #doctest: +ELLIPSIS
53-
'dcm2nii -g y -n y -i n -o . -b config.ini functional_1.dcm functional_2.dcm'
53+
'dcm2nii -g y -n y -i n -o . -b config.ini functional_1.dcm'
5454
>>> converter.run() # doctest: +SKIP
5555
"""
5656

@@ -67,6 +67,8 @@ def _format_arg(self, opt, spec, val):
6767
else:
6868
spec.argstr += ' n'
6969
val = True
70+
if opt == 'source_names':
71+
return spec.argstr % val[0]
7072
return super(Dcm2nii, self)._format_arg(opt, spec, val)
7173

7274
def _run_interface(self, runtime):
@@ -104,8 +106,8 @@ def _parse_stdout(self, stdout):
104106
base, filename, ext = split_filename(last_added_file)
105107
bvecs.append(os.path.join(base,filename + ".bvec"))
106108
bvals.append(os.path.join(base,filename + ".bval"))
107-
elif re.search('.*->(.*)', line):
108-
val = re.search('.*->(.*)', line)
109+
elif re.search('.*-->(.*)', line):
110+
val = re.search('.*-->(.*)', line)
109111
val = val.groups()[0]
110112
if isdefined(self.inputs.output_dir):
111113
output_dir = self.inputs.output_dir
@@ -115,8 +117,7 @@ def _parse_stdout(self, stdout):
115117
file = val
116118

117119
if file:
118-
if last_added_file and os.path.exists(file) and not last_added_file in file:
119-
files.append(file)
120+
files.append(file)
120121
last_added_file = file
121122
continue
122123

0 commit comments

Comments
 (0)