Skip to content

fix(sr): map cm and cm² to the UCUM units in unit2CodingValue - #506

Merged
wayfarer3130 merged 3 commits into
dcmjs-org:0.xfrom
afip94:add-cm-unit
Nov 28, 2026
Merged

wayfarer3130 merged 3 commits into
dcmjs-org:0.xfrom
afip94:add-cm-unit

Conversation

@afip94

@afip94 afip94 commented Jul 31, 2026

Copy link
Copy Markdown

Adds cm to knownUnits in unit2CodingValue, as discussed in #505.

A length measured in centimetres — the normal case for ultrasound images calibrated through SequenceOfUltrasoundRegions, where PhysicalUnitsXDirection = 3 means cm — had no entry and fell through to the arbitrary-unit branch, so the stored SR carried CodeValue: "[arb'U]{cm}" / CodeMeaning: "arbitrary cm".

Also adds test/unit2CodingValue.test.js covering:

  • mm (unchanged behaviour),
  • cm resolving to the UCUM code rather than an arbitrary unit,
  • "cm US Region" resolving via the existing base-unit fallback — that is the label Cornerstone3D produces for calibrated ultrasound measurements,
  • an unknown unit still falling back to [arb'U]{…}.

Verified that the two new assertions fail without the one-line addition.

The full suite passes with --runInBand. Running it in parallel produced three unrelated failures in test/async-data.test.js on my machine, which also pass in isolation — looks like a race over the shared downloaded fixtures rather than anything from this change.

A length measured in centimetres - the normal case for ultrasound images
calibrated through SequenceOfUltrasoundRegions, where
PhysicalUnitsXDirection = 3 means cm - had no entry in knownUnits and fell
through to the arbitrary-unit branch, ending up as [arb'U]{cm} /
"arbitrary cm" in the stored SR.

Fixes dcmjs-org#505
@netlify

netlify Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dcmjs2 ready!

Name Link
🔨 Latest commit 8a177f1
🔍 Latest deploy log https://app.netlify.com/projects/dcmjs2/deploys/6a6c997a64642e00082c6f28
😎 Deploy Preview https://deploy-preview-506--dcmjs2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

wayfarer3130 added a commit that referenced this pull request Nov 28, 2026
…683)

- unit2CodingValue: "cm²" maps to the existing UCUM "cm2" entry, as
  "mm²" maps to "mm2". Cornerstone3D labels a calibrated ultrasound
  area "cm² US Region", which became an arbitrary unit (review Q2).
- test/issues/issue505-unit2codingvalue.test.js: the skipped "cm" case
  runs, with cases for "cm US Region", "cm²" and "cm² US Region". The
  catalog marks #505 green. The separate test/unit2CodingValue.test.js
  of #506 is not needed on main (review S1, Q3).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"cm²" maps to the existing UCUM "cm2" entry, as "mm²" maps to "mm2".
Cornerstone3D labels a calibrated ultrasound area "cm² US Region",
which became the arbitrary unit [arb'U]{cm² US Region}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wayfarer3130 wayfarer3130 changed the title Add cm to the known UCUM units fix(sr): map cm and cm² to the UCUM units in unit2CodingValue Nov 28, 2026
@netlify

netlify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dcmjs2 ready!

Name Link
🔨 Latest commit 8fe909f
🔍 Latest deploy log https://app.netlify.com/projects/dcmjs2/deploys/6b0a2337ee0ec8b43c8def30
😎 Deploy Preview https://deploy-preview-506--dcmjs2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@wayfarer3130

Copy link
Copy Markdown
Contributor

Thank you for this fix. As a maintainer, I pushed two commits to this branch:

  • A merge of the current 0.x branch, so that CI runs on the current base.
  • 8fe909f: cm² now maps to the existing UCUM unit cm2, as mm² maps to mm2. Cornerstone3D labels a calibrated ultrasound area cm² US Region, and that label also became an arbitrary unit. The commit adds two test cases to your test file.

I also changed the PR title to fix(sr): ..., so that the squash merge releases a patch version of the 0.x line. The same change for main (dcmjs 1.x) is in #683, and it keeps you as the author of the first commit.

@wayfarer3130
wayfarer3130 merged commit e62d04b into dcmjs-org:0.x Nov 28, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in dcmjs roadmap Nov 28, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.54.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

wayfarer3130 added a commit that referenced this pull request Nov 28, 2026
…#506) (#683)

Fixes #505 on main. Maps cm to UCUM cm, and cm² to the existing UCUM cm2 entry. Co-authored with the author of #506.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants