Skip to content

Commit 2090493

Browse files
committed
fix: if you expect a reoriented and cropped file but it does not exist, interface errors normally
1 parent 6620234 commit 2090493

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,12 @@ def _parse_stdout(self, stdout):
155155
elif line.startswith("Cropping NIfTI/Analyze image "):
156156
base, filename = os.path.split(line[len("Cropping NIfTI/Analyze image "):])
157157
filename = "c" + filename
158-
if os.path.exists(os.path.join(base, filename)):
158+
if os.path.exists(os.path.join(base, filename)) or self.inputs.reorient_and_crop:
159+
# if reorient&crop is true but the file doesn't exist, this errors when setting outputs
159160
reoriented_and_cropped_files.append(os.path.join(base, filename))
160161
skip = True
161162
continue
162-
163+
163164
skip = False
164165
return files, reoriented_files, reoriented_and_cropped_files, bvecs, bvals
165166

0 commit comments

Comments
 (0)