Skip to content

Commit

Permalink
Merge pull request nipy#1424 from akeshavan/dcm2nii
Browse files Browse the repository at this point in the history
Dcm2nii
  • Loading branch information
satra committed Apr 18, 2016
2 parents f6ae4e4 + 9f2e498 commit 77b1cb9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nipype/interfaces/dcm2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ def _parse_stdout(self, stdout):
else:
output_dir = self._gen_filename('output_dir')
val = os.path.join(output_dir, val)
out_file = val
if os.path.exists(val):
out_file = val

if out_file:
files.append(out_file)
last_added_file = out_file
if not out_file in files:
files.append(out_file)
last_added_file = out_file
continue

if line.startswith("Reorienting as "):
Expand All @@ -153,9 +155,12 @@ def _parse_stdout(self, stdout):
elif line.startswith("Cropping NIfTI/Analyze image "):
base, filename = os.path.split(line[len("Cropping NIfTI/Analyze image "):])
filename = "c" + filename
reoriented_and_cropped_files.append(os.path.join(base, filename))
skip = True
continue
if os.path.exists(os.path.join(base, filename)) or self.inputs.reorient_and_crop:
# if reorient&crop is true but the file doesn't exist, this errors when setting outputs
reoriented_and_cropped_files.append(os.path.join(base, filename))
skip = True
continue

skip = False
return files, reoriented_files, reoriented_and_cropped_files, bvecs, bvals

Expand Down

0 comments on commit 77b1cb9

Please sign in to comment.