Repository navigation
fix(legacy): keep untilTag and NumberOfFrames out of AsyncDicomReader sequence items (port of #657) - #666
Merged
wayfarer3130 merged 1 commit intoNov 25, 2026
Conversation
… sequence items (port of #657) 1.0 port of #657 (commit d236313), fixes #643. AsyncDicomReader applied top-level state inside sequence items. With an Icon Image Sequence (0088,0200), untilTag "7FE00010" stopped at the icon's Pixel Data and readSequence threw an empty Error, and the NumberOfFrames of the file split the icon's Pixel Data. - readSequence reads the items without untilTag and includeUntilTagValue. - A sequenceDepth counter and getNumberOfFrames() give 1 frame inside an item; readCompressed, readUncompressed and readUncompressedBitFrame use it. - The error for an unexpected tag in a sequence names the tag. - docs/AsyncDicomReader-skill.md: untilTag is for the top level. Rows, Columns and BitsAllocated still come from the top level, as in #657. test/async-sequence-item-state.test.js builds the file with createSampleDicom; both tests fail on 1.0-beta and pass with the change. The bundle-size ceilings rise to x1.091 and x1.073 (measured x1.09044, x1.07212). Co-Authored-By: Claude Opus 5.5 <[email protected]>
wayfarer3130
marked this pull request as ready for review
November 25, 2026 19:13
wayfarer3130
added a commit
that referenced
this pull request
Nov 25, 2026
…-622-big-endian-swap Brings in #666. Conflicts: the AsyncDicomReader constructor comments (keep both), and the bundle-size ceilings (measured after the build: x1.09355, x1.07519; ceilings 1.094, 1.076). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.20 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Nov 25, 2026
wayfarer3130
added a commit
that referenced
this pull request
Nov 26, 2026
…#667) Remove the normalizers from the untouched list, and add the three visible changes. Name #666 in the bundle-size comment. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Why
This PR ports #657 (commit
d236313onmaster) to1.0-beta. The PR fixes #643 on1.0-beta.AsyncDicomReader(packages/legacy/src/AsyncDicomReader.js) applies the state of the top-level data set inside sequence items. An Icon Image Sequence (0088,0200) item has its own Pixel Data (PS3.3 C.7.6.1.1.6). The reader fails on such a file in two cases:untilTag: "7FE00010", the read stops at the Pixel Data of the icon. ThenreadSequencethrows anErrorwith an empty message.NumberOfFramesof the file to split the Pixel Data of the icon. With 2 frames, the reader gives two 2-byte frames for a 4-byte icon. With 3 frames, the reader throwsInvalid frame length: 4 for 3 frames.The sync reader (
DicomMessage.readFile) reads these files correctly.What changes
readSequencereads the items withoutuntilTagandincludeUntilTagValue. ThusuntilTagstops the read at the top level only.sequenceDepthcounter and the newgetNumberOfFrames()method give 1 frame for Pixel Data inside a sequence item.readCompressed,readUncompressedandreadUncompressedBitFrameuse the method.docs/AsyncDicomReader-skill.md:untilTagapplies to the top-level data set.On
1.0-beta,readSequencealready callsreadTagHeader({ ...options, readSyntax }). The port replacesoptionswith the item options in that call.What stays
listener.information.rows,columnsandbitsAllocatedstill come from the top level, as in fix: keep untilTag and NumberOfFrames out of AsyncDicomReader sequence items #657. The reader uses these values only for multi-frame or 1-bit Pixel Data. Inside an item, the reader does not use the 1-bit frame code, so these top-level values do not apply to an icon. The fix also corrects a 1-bit multi-frame image that has an 8-bit icon.includeUntilTagValue: truebehaviour at the top level does not change. The review of fix: keep untilTag and NumberOfFrames out of AsyncDicomReader sequence items #657 found an older bug there. This PR does not fix that bug.fromPart10,fromPart10Stream) is correct on the same file. I checked 2 and 3 frames, with one buffer and with 37-byte chunks. The reader gives the 4 icon bytes as one value. The event-stream reader has nountilTagoption, and it does not split frames byNumberOfFrames.Tests
The new
test/async-sequence-item-state.test.jsbuilds the file of #643 withcreateSampleDicom. The test checks two things:untilTag: "7FE00010"reads the icon whole and stops before the Pixel Data of the data set. The sync reader gives the same icon.NumberOfFramesis 1, 2 or 3. The Pixel Data of the data set still has 1, 2 or 3 frames.Both tests fail on
origin/1.0-beta: the first test gets the emptyError, and the second test gets more than one icon frame. Both tests pass with the change.npx jest test/async-sequence-item-state.test.js: 2 passed.npx jest: 123 suites passed, 2 skipped; 1426 tests passed, 11 skipped. Onlytest/bundle-size.test.jsfailed before the ceiling change below.npx eslintandnpx prettier --checkon the changed source and test files: no errors.prettier --checkalso warns ondocs/AsyncDicomReader-skill.md, but the warning is the same on1.0-beta.Bundle size
pnpm run build, thentest/bundle-size.test.js:dcmjs.jsdcmjs.es.jsThe new ceilings are the measured ratios, rounded up to 3 decimals. #663 also changes these lines. The second PR to merge must merge
1.0-betainto its branch, and then measure again.Release note
AsyncDicomReader:untilTagapplies to the top-level data set only. The reader no longer stops at a matching tag inside a sequence item. Pixel Data inside a sequence item is one frame. This is the behaviour of the sync reader and of 0.x after #657. I did not add adocs/MIGRATION.mdnote, because 0.x and 1.0 now behave the same.Port of #657. Fixes #643 on
1.0-beta.🤖 Generated with Claude Code