fix: render conformant Palette Color LUTs in Advanced Blending Presentation States (#390)#391
Merged
Merged
Conversation
) setPresentationState wrapped Palette Color Lookup Table Data in `new Uint16Array(...)` before handing it to dicom-microscopy-viewer. The element size of LUT data is governed by the descriptor's bits-per-entry, not the VR: conformant Presentation States encode 8-bit entries (descriptor [n, first, 8]) byte-packed inside the OW element, so eagerly wrapping in a Uint16Array halved the entry count and made the LUT fail to apply, so the PR never rendered. Pass the LUT data (segmented and non-segmented) through as retrieved and let DMV reinterpret the bytes per the descriptor. Also widen the LUT data types in the DMV type declarations and fix the pre-existing Unit8Array/Unit16Array typos. Closes #390
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Jun 19, 2026 11:38a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
|
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
Fixes #390. Conformant Advanced Blending Presentation States created with
highdicom(8-bit, non-segmented Palette Color LUTs) failed to render in Slim.setPresentationStatewrapped the Palette Color Lookup Table Data innew Uint16Array(...)before handing it to dicom-microscopy-viewer. But the element size of LUT data is governed by the descriptor's third value (bits per entry), not the VR. Conformant Presentation States encode 8-bit entries (descriptor[n, first, 8]) byte-packed inside theOWelement, so wrapping a 256-byte LUT in aUint16Arrayyielded 128 elements; DMV then rejected it (wrong number of entries) and the PR never applied.What changed
src/components/SlideViewer.tsx— pass Red/Green/Blue and segmented LUT data through as retrieved (no eagerUint16Arraywrapping); DMV now interprets the bytes per the descriptor.types/dicom-microscopy-viewer/index.d.ts— widen LUT data types toUint8Array | Uint16Array | ArrayBuffer | number[]and fix the pre-existingUnit8Array/Unit16Arraytypos.The real fix (byte reinterpretation by descriptor) lives in dicom-microscopy-viewer; see the paired PR below. Old segmented PRs still work.
Dependency
Requires dicom-microscopy-viewer with ImagingDataCommons/dicom-microscopy-viewer#246. Bump the dependency to a release that includes it.
Test plan
tsc --noEmit— clean.biome check .— clean.highdicom5-channel Advanced Blending PR (descriptor[256, 0, 8]), then confirmed all 5 channels build and produce the expected pseudo-colors with the paired DMV fix.Related