Skip to content

Commit 2699e7f

Browse files
committed
Deal with double-detection of to-be-gzipped files (fixes gh-1269)
1 parent 5550b51 commit 2699e7f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,17 @@ 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)

0 commit comments

Comments
 (0)