Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in transform_point_set_from_dicom_struct #278

Open
brendan-whelan-seetreat opened this issue Jul 18, 2024 · 2 comments
Open
Assignees

Comments

@brendan-whelan-seetreat

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

  1. (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.
  2. Just check whether the z coordinates are within some tolerance and raise an error if not
@pchlap
Copy link
Contributor

pchlap commented Jul 19, 2024

Thanks for reporting this @brendan-whelan-seetreat. Yeah think is definitely something we should resolve. @rnfinnegan and I have had a few discussions on how we could improve this function. One idea was to actually ignore the paired image or RTDOSE entirely, and just generate a structure mask which would cover the bounds of the structure at a predefined resolution (e.g. 1x1xSliceThickness but this could also be configurable)... Then you can just resample the resulting binary mask to the target space as needed (whether thats the image or dose space).

I think it would be good to keep the current function compatible with how it is currently used though, since most users probably just want to a binary mask that matches their image. But I will discuss with Rob to see if we can build in some flexibility and ensure a correct structure mask is returned including the use case you described.

@pchlap pchlap self-assigned this Jul 19, 2024
@brendan-whelan-seetreat
Copy link
Author

Actually, the functionality is nearly already there with the spacing_override - just that the default use will not detect any problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants