From 42652ef5dd3b090dab73ee6c430e3fede52154f2 Mon Sep 17 00:00:00 2001 From: wasserth Date: Mon, 5 Feb 2024 15:31:26 +0100 Subject: [PATCH] bugfix --- totalsegmentator/nnunet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/totalsegmentator/nnunet.py b/totalsegmentator/nnunet.py index 1bb8af902..c14f95757 100644 --- a/totalsegmentator/nnunet.py +++ b/totalsegmentator/nnunet.py @@ -249,10 +249,10 @@ def nnUNet_predict_image(file_in: Union[str, Path, Nifti1Image], file_out, task_ if not isinstance(file_in, Nifti1Image): file_in = Path(file_in) img_type = "nifti" if str(file_in).endswith(".nii") or str(file_in).endswith(".nii.gz") else "dicom" + if not file_in.exists(): + sys.exit("ERROR: The input file or directory does not exist.") if file_out is not None: file_out = Path(file_out) - if not file_in.exists(): - sys.exit("ERROR: The input file or directory does not exist.") multimodel = type(task_id) is list if img_type == "nifti" and output_type == "dicom":