From 28e9e4d6c5d5b17e82fc7415107f9bd601d7bad4 Mon Sep 17 00:00:00 2001 From: Phillip Chlap Date: Wed, 12 Jun 2024 06:59:14 -0500 Subject: [PATCH] Use XOR when combining masks to support multiple contours which define holes --- platipy/dicom/io/crawl.py | 2 +- platipy/dicom/io/rtstruct_to_nifti.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platipy/dicom/io/crawl.py b/platipy/dicom/io/crawl.py index c0fd8480..d2aa071e 100644 --- a/platipy/dicom/io/crawl.py +++ b/platipy/dicom/io/crawl.py @@ -343,7 +343,7 @@ def transform_point_set_from_dicom_struct(image, dicom_struct, spacing_override= xVertexArr_image, yVertexArr_image, shape=sliceArr.shape ) sliceArr[filledIndicesX, filledIndicesY] = 1 - image_blank[zIndex] += sliceArr.T + image_blank[zIndex] ^= sliceArr.T struct_image = sitk.GetImageFromArray(1 * (image_blank > 0)) struct_image.CopyInformation(image) diff --git a/platipy/dicom/io/rtstruct_to_nifti.py b/platipy/dicom/io/rtstruct_to_nifti.py index fe7dd5f7..e0bb7340 100644 --- a/platipy/dicom/io/rtstruct_to_nifti.py +++ b/platipy/dicom/io/rtstruct_to_nifti.py @@ -194,7 +194,7 @@ def transform_point_set_from_dicom_struct(dicom_image, dicom_struct, spacing_ove ) slice_arr[filled_indices_y, filled_indices_x] = 1 - image_blank[z_index] += slice_arr + image_blank[z_index] ^= slice_arr if not skip_contour: struct_image = sitk.GetImageFromArray(1 * (image_blank > 0))