From b14ae8c6aacdf83525ce46472e8b840f8e1d0108 Mon Sep 17 00:00:00 2001 From: Phil Chlap Date: Mon, 19 Aug 2024 17:57:51 -0500 Subject: [PATCH] Check if z_index less than 0 --- platipy/dicom/io/rtstruct_to_nifti.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platipy/dicom/io/rtstruct_to_nifti.py b/platipy/dicom/io/rtstruct_to_nifti.py index e0bb734..7245645 100644 --- a/platipy/dicom/io/rtstruct_to_nifti.py +++ b/platipy/dicom/io/rtstruct_to_nifti.py @@ -187,6 +187,12 @@ def transform_point_set_from_dicom_struct(dicom_image, dicom_struct, spacing_ove logger.debug("Slice index: %d", z_index) continue + if z_index < 0: + logger.debug("Warning: Slice index less than zero. Skipping slice.") + logger.debug("Structure: %s", struct_name) + logger.debug("Slice index: %d", z_index) + continue + slice_arr = np.zeros(image_blank.shape[-2:], dtype=np.uint8) filled_indices_x, filled_indices_y = polygon(