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

feat: throw exception if rtstruct references images outside of series data #12

Merged
merged 2 commits into from
Mar 2, 2021

Conversation

asim-shrestha
Copy link
Contributor

closes #10

@@ -91,20 +99,20 @@ def test_loading_valid_rt_struct(series_path):
assert hasattr(rtstruct.ds, 'ROIContourSequence')
assert hasattr(rtstruct.ds, 'StructureSetROISequence')
assert hasattr(rtstruct.ds, 'RTROIObservationsSequence')
assert len(rtstruct.ds.ROIContourSequence) == 4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the test rt struct file to only have 1 ROI within it

Method to validate RTStruct only references dicom images found within the input series_data
"""
# Blame DICOM for this nesting
for refd_frame_of_ref in ds.ReferencedFrameOfReferenceSequence:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk if i can make this cleaner. Also lmk if you have better ideas for method names

@awtkns
Copy link
Contributor

awtkns commented Mar 1, 2021

@carluri now is your time to become a contributor (if you review an make a change) 😉

Comment on lines +74 to +77
raise Exception(
f'Loaded RTStruct references image(s) that are not contained in input series data. ' +
f'Problematic image has SOP Instance Id: {contour_image.ReferencedSOPInstanceUID}'
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to maybe throw an RTStuctException?

@awtkns awtkns self-requested a review March 1, 2021 23:21
rt_utils/rtstruct_builder.py Outdated Show resolved Hide resolved
Remove DICOM nesting comment

Co-authored-by: Adam Watkins <[email protected]>
@awtkns awtkns merged commit 1a7c7d7 into main Mar 2, 2021
@awtkns awtkns deleted the 10-error-with-unreferenced-contour-images branch March 21, 2021 02:51
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

Successfully merging this pull request may close these issues.

No Error Message when Loading an RT-Struct while Providing an Unreferenced Series
3 participants