[encoding] Fix length serialization of Explicit VR TS for new VRs#744
Merged
Enet4 merged 2 commits intoEnet4:masterfrom Mar 5, 2026
Merged
[encoding] Fix length serialization of Explicit VR TS for new VRs#744Enet4 merged 2 commits intoEnet4:masterfrom
Enet4 merged 2 commits intoEnet4:masterfrom
Conversation
Enet4
approved these changes
Mar 5, 2026
Owner
Enet4
left a comment
There was a problem hiding this comment.
Excellent! Now it is implemented just as in the standard (2-byte lengths for these specific VRs, 4-byte length for every other VR), with nice test coverage. No concerns from my side. Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the long-format VR encoding according to the standard (closes #739).
In particular, VRs of type UV, SV and OV were not properly serialized. The standard says that when using the Explicit VR transfer syntax, a 16-bit length field applies only to VRs of AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL and US (PS3.5 7.1.2), and the rest uses the 32-bit version including a reserved 16-bit field where the old 16-bit length was.
It also says that all new VRs in future versions of the standard will use the long version of the encoding for lengths:
So, this patch fixes the encoding for the VRs that are not working and prepares the code for possible future VRs.