Skip to content

Parse implicit length OB tags - #167

Open
oleksandr-penia wants to merge 11 commits into
DCMTK:masterfrom
oleksandr-penia:Parse-implicit-length-OB-tags
Open

oleksandr-penia wants to merge 11 commits into
DCMTK:masterfrom
oleksandr-penia:Parse-implicit-length-OB-tags

Conversation

@oleksandr-penia

Copy link
Copy Markdown

Issue #621

Summary of changes

Some systems create DICOM files with OB tags with undefined length that are to be read until certain delimitation sequence.
Changes provide the possibility to parse such tags using a configurable delimiter (by default fe/ff/dd/e0/00/00/00/00 - LE sequence delimiter).

Description

  • Added a new flag dcmParseUndefinedLengthOBOW to control this behavior.
  • Added a DcmElement-derived class to handle described tags. It uses std::vector<unit8_t> as a storage for byte sequence. DcmElement-related behavior is implemented similarly to DcmPixelSequence where possible.
    • Reading consumes bytes from stream until trailing sequence matches specified delimiter
    • Writing puts the tag into the stream, but following the DICOM standard, i.e. length value is explicit.
    • Other pure virtual methods, e.g. print() and getLength() are overridden to provide behavior similar to existing dicom items.

Testing

Tested locally on a custom project importing rebuilt libraries. Tested parsing, saving, printing and sending to DICOM storage on several non-conforming files. Added unit tests covering new class' behavior.

@michaelonken

Copy link
Copy Markdown
Member

Thank you for the report :) I just merged it into our internal testing branch. The fix will be visible within the next few days on public master branch.

@michaelonken

Copy link
Copy Markdown
Member

FYI: Issue in DCMTK bug tracker: https://support.dcmtk.org/redmine/issues/1309

@michaelonken michaelonken reopened this Nov 22, 2026
@michaelonken

Copy link
Copy Markdown
Member

Sorry, comments were meant for #168

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.

2 participants