Skip to content

Add cm to the known UCUM units - #506

Open
afip94 wants to merge 1 commit into
dcmjs-org:masterfrom
afip94:add-cm-unit
Open

Add cm to the known UCUM units#506
afip94 wants to merge 1 commit into
dcmjs-org:masterfrom
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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant