platipy
platipy copied to clipboard
RTStruct to Nifti generates negative z_index
198 filled_indices_x, filled_indices_y = polygon(
199 x_vertex_arr_image, y_vertex_arr_image, shape=slice_arr.shape
200 )
201 slice_arr[filled_indices_y, filled_indices_x] = 1
--> 203 image_blank[z_index] += slice_arr
205 if not skip_contour:
206 struct_image = sitk.GetImageFromArray(1 * (image_blank > 0))
IndexError: index -138 is out of bounds for axis 0 with size 116
z_index is being set correctly for this contour point, which probably is a carry-over error from fix_missing_data()
. I don't know the reason why, but as a solution it looks like rtstruct_to_nifti
needs to have another if statement for z values below 0 that sets skip_contour
argument to True.
I am also curious about a possible link between this and #165
Thanks for the bug report @yidilozdemir. I will look into this (although might not have a chance until early January). Cheers.