Skip to content

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

Merged
Enet4 merged 1 commit intomasterfrom
bug/parser/bad_element_to_tokens
Jan 16, 2025
Merged

[parser] Add robustness to data element token writing#628
Enet4 merged 1 commit intomasterfrom
bug/parser/bad_element_to_tokens

Conversation

@Enet4
Copy link
Copy Markdown
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
Copy Markdown

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
@Enet4 Enet4 merged commit c0a486d into master Jan 16, 2025
@Enet4 Enet4 deleted the bug/parser/bad_element_to_tokens branch January 16, 2025 18:31
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