Repository navigation
fix: registerTag and anonymizer fixes from 0.53.3 (port of #510 and #625) - #674
Merged
Merged
Conversation
) - registerTag() stores the tag in upper case and finds both cases, so a tag registered in lower case keeps its keyword when a file is read. - The first registration of a name keeps the name; a warning names both tags. - DicomMetaDictionary.entryForName() is the one lookup by name (standard keyword first, then a registerTag() name). It is used by denaturalizeDataset(), tagAsIntegerFromName(), entryFor() and cleanTags(), so cleanTags() empties a registered name in a custom list. - dcmjs.data exports registerTag and dictionary again, as in 0.53.3. - The anonymizer list has ResponsiblePersonRole, as in 0.53.3. - MIGRATION.md states the nameMap difference from 0.53.3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
wayfarer3130
marked this pull request as ready for review
November 27, 2026 18:05
…674) - The tag of the first argument wins over entry.tag. - A name that is the keyword of a different tag throws. The keyword of the same tag is accepted with no warning. - When two tags use one name, the second tag gets its hex tag as its name and keeps its VR and VM, so a read and a write keep both values. - A new name for a registered tag removes the old name. - entryForName() reads only own entries of nameMap. - docs/specs/registries.md: REG-U-18 to REG-U-21 for the tag registry; registries-implementation.md: REG-I-23 to REG-I-26. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.24 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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 ports to
1.0-betathe parts of #510 and #625 that #590 and #548 do not cover.masterreleased these fixes in 0.53.3. Without this PR, a user who upgrades from 0.53.3 or 0.54 to 1.0 loses them. The PR also adds user requirements for the tag registry.Changes
#625 (
registerTag()), with #548 kept as the base design:registerTag()stores the tag in upper case. Lookups accept both cases. Before this change, a tag registered in lower case lost its keyword when a file was read, because a reader makes upper case keys.tagfield in the entry. Before this change, a copy of a standard entry as a template wrote the value into the source tag of the template, for example PatientName.Error. The registration of a keyword for its own tag is accepted with no warning. Before this change, a read of such a file put the registered value in place of the standard value, for examplePatientID, and no warning showed.DicomMetaDictionary.entryForName(name, nameMap)gives the entry of a keyword: an own entry ofnameMapfirst, then aregisterTag()name.denaturalizeDataset(),tagAsIntegerFromName(),entryFor()andcleanTags()use this one method. Before this change,cleanTags()with a custom list did not empty a registered tag. A name such asconstructorno longer resolves to a prototype function.dcmjs.data.registerTaganddcmjs.data.dictionaryexist again, as in 0.53.3.registerTag()does not write intoDicomMetaDictionary.nameMap. This is the design of fix: make registerTag symmetric without mutating the shared nameMap #548.#510 (anonymizer):
cleanTags()hasResponsiblePersonRole(0010,2298), as in 0.53.3. fix(anonymizer): correct the 103 non-resolving names in tagNamesToEmpty #590 already has the other 221 names.Documents:
docs/specs/registries.md: the user requirements REG-U-18 to REG-U-21 for the tag registry.docs/specs/registries-implementation.md: REG-I-23 to REG-I-26.docs/MIGRATION.md, change 3: thenameMapdifference from 0.53.3 and 0.54, and the two name rules that differ from 0.53.3 (the throw, and the hex key of the second tag).docs/MIGRATION.md: the anonymizer bullet no longer says that the corrected list "arrives with the anonymizer port".Other:
test/bundle-size.test.js: the ceilings change from 1.104 to 1.107 (dcmjs.js) and from 1.085 to 1.088 (dcmjs.es.js).Differences from master
The tag rule, the throw, and the hex key of the second tag are on 1.x only. Master keeps the 0.53.3 behaviour.
Tests
test/dictionary-register.test.js, with 6 tests: thedcmjs.dataexports; a lower case registration keeps its keyword on read; both spellings find the entry; the first registration of a name wins, with the warning, and both values survive a read and a write; the tag and keyword rules;cleanTags()with a registered name andResponsiblePersonRole.npx jest: 1481 tests pass.test/async-data.test.js("async reader listen test uncompressed") failed in the full run. The test passed two times in a separate run. The same test failed in a full run before this change.🤖 Generated with Claude Code