-
Notifications
You must be signed in to change notification settings - Fork 88
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
Fallback to shared groups on missing per frame tag #632
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this! Just leaving a minor suggestion inline and should be ready to merge.
( | ||
tags::SHARED_FUNCTIONAL_GROUPS_SEQUENCE, | ||
0, | ||
tags::PIXEL_VALUE_TRANSFORMATION_SEQUENCE, | ||
0, | ||
tags::RESCALE_INTERCEPT, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an impl of From<(Tag, Tag, Tag)>
for attribute selectors, so this should work too.
( | |
tags::SHARED_FUNCTIONAL_GROUPS_SEQUENCE, | |
0, | |
tags::PIXEL_VALUE_TRANSFORMATION_SEQUENCE, | |
0, | |
tags::RESCALE_INTERCEPT, | |
), | |
( | |
tags::SHARED_FUNCTIONAL_GROUPS_SEQUENCE, | |
tags::PIXEL_VALUE_TRANSFORMATION_SEQUENCE, | |
tags::RESCALE_INTERCEPT, | |
), |
Some DICOMs provide tags under
SharedFunctionalGroupsSequence
that are not present underPerFrameFunctionalGroupsSequence
. In such cases, getter functions likewindow_width()
will return an empty vector rather than falling back to a check onSharedFunctionalGroupsSequence
. Thus a guard is needed so that whenPerFrameFunctionalGroupsSequence
exists but does not contain the target tag, a fallback check onSharedFunctionalGroupsSequence
will happen.This PR implements such a guard by modifying
get_from_per_frame()
andget_from_shared()
such that empty iterator returns are instead mapped toNone
. The existing logic of the getter functions will then fall back to a shared check.