Skip to content

Commit

Permalink
Merge pull request #2691 from MRtrix3/dicom_fix_multiframe_with_expli…
Browse files Browse the repository at this point in the history
…cit_length_sequences

DICOM: fix multiframe encoding with explicit length sequences
  • Loading branch information
Lestropie authored Aug 8, 2023
2 parents 8a19272 + f21af33 commit fdec23d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/file/dicom/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,15 @@ namespace MR {



if (parents.size())
if ((parents.back().end && data > parents.back().end) ||
(group == GROUP_SEQUENCE && element == ELEMENT_SEQUENCE_DELIMITATION_ITEM))
if (parents.size()) {
if (group == GROUP_SEQUENCE && element == ELEMENT_SEQUENCE_DELIMITATION_ITEM) {
parents.pop_back();
}
else { // Undefined length encoding:
while (parents.size() && parents.back().end && data > parents.back().end)
parents.pop_back();
}
}

if (is_new_sequence()) {
if (size == LENGTH_UNDEFINED)
Expand Down

0 comments on commit fdec23d

Please sign in to comment.