Skip to content

Commit 6f5cf6c

Browse files
committed
Merge pull request #1268 from hanke/gh-1267
Sometimes the filename 'arrow' is shorter (Fixes gh-1267)
2 parents db29845 + 2699e7f commit 6f5cf6c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,24 @@ def _parse_stdout(self, stdout):
108108
out_file = line[len("Saving "):]
109109
elif line.startswith("GZip..."):
110110
# for gzipped outpus files are not absolute
111+
fname = line[len("GZip..."):]
112+
if len(files) and os.path.basename(files[-1]) == fname[:-3]:
113+
# we are seeing a previously reported conversion
114+
# as being saved in gzipped form -- remove the
115+
# obsolete, uncompressed file
116+
files.pop()
111117
if isdefined(self.inputs.output_dir):
112118
output_dir = self.inputs.output_dir
113119
else:
114120
output_dir = self._gen_filename('output_dir')
115-
out_file = os.path.abspath(os.path.join(output_dir, line[len("GZip..."):]))
121+
out_file = os.path.abspath(os.path.join(output_dir, fname))
116122
elif line.startswith("Number of diffusion directions "):
117123
if last_added_file:
118124
base, filename, ext = split_filename(last_added_file)
119125
bvecs.append(os.path.join(base, filename + ".bvec"))
120126
bvals.append(os.path.join(base, filename + ".bval"))
121-
elif re.search('.*-->(.*)', line):
122-
val = re.search('.*-->(.*)', line)
127+
elif re.search('.*->(.*)', line):
128+
val = re.search('.*->(.*)', line)
123129
val = val.groups()[0]
124130
if isdefined(self.inputs.output_dir):
125131
output_dir = self.inputs.output_dir

0 commit comments

Comments
 (0)