Skip to content

fix(dicomImageLoader): Fix expected number of LUT entries when tag value is 0 - #2876

Open
abustany wants to merge 1 commit into
cornerstonejs:mainfrom
abustany:lut-number-fix
Open

fix(dicomImageLoader): Fix expected number of LUT entries when tag value is 0#2876
abustany wants to merge 1 commit into
cornerstonejs:mainfrom
abustany:lut-number-fix

Conversation

@abustany

@abustany abustany commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Context

The code was incorrectly interpreting value 0 as 65535 instead of 65536, unlike what DICOM PS3.3 C.11.1.1.1 specifies.

Changes & Results

Fixed the code -> file now decodes fine.

Testing

Tested with an XRay file from a GE scanner I unfortunately can't share here.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: macOS
  • Node version: 24
  • Browser: Firefox 153

Summary by CodeRabbit

  • Bug Fixes
    • Corrected lookup table handling for DICOM images when the encoded entry count is zero.
    • Ensures 65,536 entries are used as specified, improving image rendering accuracy.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7fe5f4ba-cfd2-4e32-9544-c3145475b9fd

📥 Commits

Reviewing files that changed from the base of the PR and between 7034957 and aa3c8e0.

📒 Files selected for processing (1)
  • packages/dicomImageLoader/src/imageLoader/wadouri/metaData/getLUTs.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The DICOM LUT parser now interprets an encoded entry count of zero as 65,536 entries, matching the DICOM specification.

Changes

DICOM LUT parsing

Layer / File(s) Summary
Correct zero-entry LUT handling
packages/dicomImageLoader/src/imageLoader/wadouri/metaData/getLUTs.ts
A zero-encoded LUT entry count now produces 65,536 entries instead of 65,535.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to aa3c8

This localized fix corrects LUT entry handling for a DICOM value of 0; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the LUT entry-count fix and follows the semantic-release format.
Description check ✅ Passed The description explains the defect, the correction, the test result, and the tested environment; unchecked documentation items are not critical for this change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@daker

daker commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

already adressed by this PR #2856

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.

2 participants