Repository navigation
fix: keep untilTag and NumberOfFrames out of AsyncDicomReader sequence items - #657
Merged
wayfarer3130 merged 3 commits intoNov 25, 2026
Merged
Conversation
…e items untilTag now applies to the top-level data set only, and Pixel Data inside a sequence item (an Icon Image Sequence item) is one frame instead of being split with the NumberOfFrames of the file. The error for a tag that is not an item in a sequence now names the tag.
✅ Deploy Preview for dcmjs2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
wayfarer3130
approved these changes
Nov 25, 2026
|
🎉 This PR is included in version 0.53.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
wayfarer3130
added a commit
that referenced
this pull request
Nov 25, 2026
… sequence items (port of #657) (#666) 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]>
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
AsyncDicomReaderapplies state of the top-level data set inside sequence items, so a file with an Icon Image Sequence (0088,0200), whose item has its own Pixel Data (PS3.3 C.7.6.1.1.6), cannot be read in two cases (#643):untilTag: "7FE00010", the read stops at the icon's Pixel Data andreadSequencethrows anErrorwith an empty message.NumberOfFramesof the file is used to split the icon's Pixel Data: 2 frames returns two 2-byte frames for a 4-byte icon, 3 frames throwsInvalid frame length: 4 for 3 frames.The sync reader (
DicomMessage.readFile) reads these files correctly.What changes
readSequenceno longer passesuntilTagandincludeUntilTagValueto the items, sountilTagstops the read at the top level only.sequenceDepthcounter andgetNumberOfFrames()give 1 for Pixel Data inside a sequence item.NumberOfFramesis tracked inlistener.informationfor the top-level data set only, so the nested value was never known. The three places that read it (readCompressed,readUncompressed,readUncompressedBitFrame) use the method.docs/AsyncDicomReader-skill.md:untilTagis for the top level.Not changed:
listener.information.rows,columnsandbitsAllocatedalso come from the top level. They are read only for multi-frame or 1-bit Pixel Data, which an icon does not have in this fix. A nested 1-bit icon is not covered. ThereadTagHeader(syntax, options)call mentioned in the issue is alreadyreadTagHeader({...options, readSyntax})onmaster.This is on
master, where the issue was reported (0.52.3).packages/legacy/src/AsyncDicomReader.json1.0-betahas the same code; it needs the same change, as with the othermasterfixes listed in #649.Fixes #643
Tests
New
test/async-sequence-item-state.test.jsbuilds the file of the issue (Icon Image Sequence with Pixel Data in the item) and checks:untilTag: "7FE00010"reads the icon whole and stops before the Pixel Data of the data set (the sync reader gives the same icon);NumberOfFrames1 (absent), 2 and 3, and the Pixel Data of the data set is still split in 2 or 3 frames.Both tests fail on
master(empty-messageError, then[[[1,2]],[[3,4]]]instead of one frame) and pass with the change.npx jest test/async-sequence-item-state.test.js: 2 passedpnpm test: 33 suites, 435 tests passed (the baselinemasterhas 433)pnpm run format:check: passednpx eslint "src/**/*.js" "test/**/*.js": no errors