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

Parse: If transfer syntax is missing, attempt to infer it by peeking next 100 bytes. #330

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

suyashkumar
Copy link
Owner

@suyashkumar suyashkumar commented Jun 8, 2024

This PR attempts to infer missing transfer syntax in dicoms during Parse.

Specifically:

  • When transfer syntax is missing in dicom metadata, attempt to infer the correct transfer syntax by peeking the next 100bytes and trying to read an element without an error. This isn't foolproof, but one option to start with.
  • This also makes test updates to support testfiles/ that may not have PixelData.
  • This also introduces a write option to write dicoms without transfer syntax elements, in order to write some "roundtrip" unit tests for this behavior on Parse.

I was able to successfully test using some test data from #327, but I need to do some more investigation to see if we can safely add those to our test files (licensing and otherwise).

Things to consider in the future:

  • Try deflated little endian explicit as well.
  • Peek more/less than the initial 100 bytes, or move away from a fixed peek.

@suyashkumar suyashkumar marked this pull request as ready for review June 10, 2024 02:27
@suyashkumar suyashkumar changed the title Initial implementation of opportunistic transfer syntax inference Parse: If transfer syntax is missing, attempt to infer it. Jun 10, 2024
@suyashkumar suyashkumar changed the title Parse: If transfer syntax is missing, attempt to infer it. Parse: If transfer syntax is missing, attempt to infer it by peeking next 100 bytes. Jun 10, 2024
@suyashkumar suyashkumar merged commit b8bf692 into main Jun 10, 2024
4 checks passed
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.

1 participant