From 14fb7aa824293e2c538c445db9c78ac6cfe93019 Mon Sep 17 00:00:00 2001 From: Chris Bridge Date: Tue, 14 Jan 2025 21:23:20 -0500 Subject: [PATCH] Fix for case where input image is already a numpy array Signed-off-by: Chris Bridge --- monai/deploy/operators/dicom_seg_writer_operator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monai/deploy/operators/dicom_seg_writer_operator.py b/monai/deploy/operators/dicom_seg_writer_operator.py index f5bc5ae4..41bad8af 100644 --- a/monai/deploy/operators/dicom_seg_writer_operator.py +++ b/monai/deploy/operators/dicom_seg_writer_operator.py @@ -288,8 +288,10 @@ def process_images( seg_image_numpy = image.asnumpy() elif isinstance(image, (Path, str)): seg_image_numpy = self._image_file_to_numpy(str(image)) - elif not isinstance(image, np.ndarray): - raise ValueError("'image' is not a numpy array, Image object, or supported image file.") + else: + if not isinstance(image, np.ndarray): + raise ValueError("'image' is not a numpy array, Image object, or supported image file.") + seg_image_numpy = image # Pick DICOM Series that was used as input for getting the seg image. # For now, first one in the list.