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

[parser] Add robustness to data element token writing #628

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Enet4
Copy link
Owner

@Enet4 Enet4 commented Jan 11, 2025

This tweaks the data element token writing routine so that instead of panicking from unexpected values in headers with the VR SQ, it warns about the case and gracefully tries to provide some tokens.

  • A primitive value inside a data element with the VR SQ is not expected. I've added an edge case where the primitive data can be interpreted as raw DICOM bytes comprising the sequence items. This also means that it might produce malformed data inside those sequences, but this is a case of bad data in and bad data out.
  • Pixel fragment sequences should only exist inside a pixel data header. I have chosen to skip the element entirely when this happens.

- instead of panicking from
  unexpected values in header with VR SQ,
  warn about malformed cases
  and gracefully handle them
@qarmin
Copy link

qarmin commented Jan 13, 2025

I checked broken files from #626, and this PR fixes all problems that I had

@Enet4 Enet4 force-pushed the bug/parser/bad_element_to_tokens branch from 6249d7b to 8acffa1 Compare January 13, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lib Area: library C-parser Crate: dicom-parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants