Skip to content

fix: registerTag and anonymizer fixes from 0.53.3 (port of #510 and #625) - #674

Merged
wayfarer3130 merged 2 commits into
1.0-betafrom
fix/1.0-beta-port-510-625
Nov 27, 2026
Merged

wayfarer3130 merged 2 commits into
1.0-betafrom
fix/1.0-beta-port-510-625

Conversation

@wayfarer3130

@wayfarer3130 wayfarer3130 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR ports to 1.0-beta the parts of #510 and #625 that #590 and #548 do not cover. master released 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.
  • The tag of the first argument wins over a tag field 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.
  • A registered name that is the keyword of a different tag throws an 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 example PatientID, and no warning showed.
  • When two tags use one name, the first tag keeps the name, and a warning names both tags. The second tag gets its hex tag as its name, and keeps its VR and VM. A read and a write keep both values.
  • A new name for a registered tag removes the old name.
  • The new method DicomMetaDictionary.entryForName(name, nameMap) gives the entry of a keyword: an own entry of nameMap first, then a registerTag() name. denaturalizeDataset(), tagAsIntegerFromName(), entryFor() and cleanTags() use this one method. Before this change, cleanTags() with a custom list did not empty a registered tag. A name such as constructor no longer resolves to a prototype function.
  • dcmjs.data.registerTag and dcmjs.data.dictionary exist again, as in 0.53.3.
  • registerTag() does not write into DicomMetaDictionary.nameMap. This is the design of fix: make registerTag symmetric without mutating the shared nameMap #548.

#510 (anonymizer):

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: the nameMap difference 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

  • New file test/dictionary-register.test.js, with 6 tests: the dcmjs.data exports; 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 and ResponsiblePersonRole.
  • 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

)

- 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
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]>
@wayfarer3130
wayfarer3130 merged commit d6291df into 1.0-beta Nov 27, 2026
5 checks passed
@wayfarer3130
wayfarer3130 deleted the fix/1.0-beta-port-510-625 branch November 27, 2026 20:29
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0-beta.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant