Repository navigation
feat(core): private blocks of a DICOM JSON dict by block key (1.0 port of #626) - #641
Merged
Merged
Conversation
The 1.0 port of #626. findPrivateBlock() and reservePrivateBlock() in @dcmjs-org/core, and DicomDict#privateBlock() in legacy, name a block by the naturalized block key "gggg:creator" (or group and creator) and an element by "xEE" (or its number). They reuse creatorText and firstFreeBlock of privateBlocks.js. privateBlockKey() now builds every block key: a line break in the creator is the text \n (and \r) in the key, and parsePrivateBlockKey reverses it. The #639 tests expect the escaped key. test/privateBlock.test.js is the same file as on master. NAT-U-PRIV-1 gets the escape rule, NAT-U-PRIV-11 is new, and the dcmjs.js bundle ceiling moves to x1.075. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.13 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Nov 24, 2026
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.
Summary
This PR is the 1.0-beta equivalent of #626. It adds the private block API of a DICOM JSON dict, with the names of the 1.0 naturalized form. It also changes the block key of a creator that has a line break.
Changes
packages/core/src/utilities/privateBlockDict.js(new):findPrivateBlock(dict, groupOrKey, creator?)andreservePrivateBlock(dict, groupOrKey, creator?)."gggg:creator", or by the group number and the creator."xEE"or by the number0x00–0xFF.key,group,creator,reservedBlock,tag(),has(),get()andset().creatorTextandfirstFreeBlockofprivateBlocks.js. They do not copy those rules.packages/legacy/src/DicomDict.js:privateBlock(groupOrKey, creator?, { create }). The defaultcreate: truewrites the creator element when the creator has no block.privateBlockKey(group, creator)inprivateBlocks.jsbuilds every block key. In the key, a line feed in the creator is the text\n, and a carriage return is the text\r.parsePrivateBlockKeychanges the text back. An LO value holds no backslash, so the escape is not ambiguous.@dcmjs-org/coreanddcmjs.dataexportfindPrivateBlock,reservePrivateBlockandprivateBlockKey.docs/specs/naturalized-dataset.md: NAT-U-PRIV-1 gets the escape rule. NAT-U-PRIV-11 (new) is the user requirement of the dict-level API. NAT-I-CODE-1 lists the new functions.docs/MIGRATION.md, item 6: the escape rule and the dict-level API.A change to a user expectation
#639 gave the block key of a creator
"AC\nME"as"0029:AC+ line feed +ME". This PR changes that key to"0029:AC\\nME"(the backslash and the lettern). Thecreatorvalue of the block keeps the line feed, and the written creator element does not change. The four #639 tests intest/core/privateBlocks.test.jsnow expect the new key. A line separator () does not change.Tests
test/privateBlock.test.js(new) is the same file as in feat: private block reservation per PS3.5 Section 7.8.1 #626 onmaster.git hash-objectgives the same blob on the two branches. The file tests the dict-level API on 0.x and on 1.0 with one definition format.test/core/privateBlocks.test.js: one new test makes sure that a block that the dict API reserves naturalizes under the same key, and that a new naturalized block is found by the dict API after denaturalize.test/bundle-size.test.js: thedcmjs.jsceiling changes from ×1.066 to ×1.075. The bundle is not minified, and the new API adds about 8.7 KB (×1.0713).dcmjs.es.jsstays below its ×1.06 ceiling (×1.055).Local result: 1248 tests pass.
test/data.test.jshas 3 failures because a local test-data cache is missing a file (ENOENT). One test oftest/async-data.test.jsfailed under the load of the full suite, and it passes when it runs alone.Relation to #626
#626 targets
master(0.x). It now has the same API, the same block key, and the same test file. Merge this PR before or with #626, so that the 0.x names stay valid in 1.0.🤖 Generated with Claude Code