In transform_point_set_from_dicom_struct, each contour slice is associated with some location in the input dicom_image using the sitk function TransformPhysicalPointToIndex.
The issue arises if the z coordinates of the input sitk.Image are not well aligned with the contour z spacing. This happens commonly with an RT-STRUCT and an RT-DOSE file. I believe that TransformPhysicalPointToIndex will find the closest index. This index is not the same location as the contour z coordinate if the strucuture set and image have different z spacing, hence the returned structure will have incorrect z coordinates.
Possible fixes
- (recommended). Since the input image is only used as a template to generate the structure mask, you can just update the image such that the z-spacing exactly matches the contour z-spacing. You then need to update the relevant metadata - spacing, origin, size etc.
- Just check whether the z coordinates are within some tolerance and raise an error if not
In transform_point_set_from_dicom_struct, each contour slice is associated with some location in the input
dicom_imageusing the sitk functionTransformPhysicalPointToIndex.The issue arises if the z coordinates of the input sitk.Image are not well aligned with the contour z spacing. This happens commonly with an RT-STRUCT and an RT-DOSE file. I believe that
TransformPhysicalPointToIndexwill find the closest index. This index is not the same location as the contour z coordinate if the strucuture set and image have different z spacing, hence the returned structure will have incorrect z coordinates.Possible fixes