fix: palette color 8 encoded 16 (#5823)

* fix: Detect 16 bit when 8 declared

* Update bun lock with dcmjs changes

* PR comments

* Update package versions

* fix: Palette color lookup table data for dcmjs parsed data

* fix: Published version should match (#5813)

* fix: Published version should match

* Move version number update to package.json

* fix: Netlify version number update

* Try updating platform app vesion too

* PR comments

---------

Co-authored-by: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com>

* Update latest cs3d

* formatting

* fix: Use 64k instead of 0 for number of entries

* fix: Revert CS3D version to see test issues

* Updated screenshots for ArrowAnnotate.spec.ts.

* Update CS3D version

* fix: Update cs3d 4.17.4

* Update bun lock

* Update bun

* Downgrade to CS3D 4.17.2 to try to release

---------

Co-authored-by: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com>
Co-authored-by: Joe Boccanfuso <joe.boccanfuso@radicalimaging.com>
This commit is contained in:
authored and GitHub committed 2026-02-23 17:24:33 -05:00
1 parent 279ae0dfe0
commit eeca1f7a7b
18 files changed
+241 -232

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "4.15.29",
"@cornerstonejs/dicom-image-loader": "4.17.2",
"@emotion/serialize": "1.3.3",
"@ohif/core": "3.13.0-beta.22",
"@ohif/extension-cornerstone": "3.13.0-beta.22",
+2 -2
View File
@@ -37,8 +37,8 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/core": "4.15.29",
"@cornerstonejs/dicom-image-loader": "4.15.29",
"@cornerstonejs/core": "4.17.2",
"@cornerstonejs/dicom-image-loader": "4.17.2",
"@ohif/ui": "3.13.0-beta.22",
"cornerstone-math": "0.1.9",
"dicom-parser": "1.8.21"
@@ -22,8 +22,10 @@ export default function fetchPaletteColorLookupTableData(item, tag, descriptorTa
}
function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
const numLutEntries = lutDescriptor[0];
const bits = lutDescriptor[2];
// DICOM standard says to use 64k instead of 0 as 64k isn't specifiable in
// 2 bytes.
const numLutEntries = lutDescriptor[0] || 65536;
const bitsAllocated = lutDescriptor[2];
if (!paletteColorLookupTableData) {
return undefined;
@@ -32,7 +34,11 @@ function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
const arrayBufferToPaletteColorLUT = arraybuffer => {
// Handle both ArrayBuffer and TypedArray inputs
const buffer = arraybuffer.buffer || arraybuffer;
const data = bits === 16 ? new Uint16Array(buffer) : new Uint8Array(buffer);
// See note in PS3.3 C7.6.3.1.5 around 8 bit data encoded as 16 bit
const data =
buffer.byteLength === 2 * numLutEntries || bitsAllocated > 8
? new Uint16Array(buffer)
: new Uint8Array(buffer);
const lut = [];
for (let i = 0; i < numLutEntries; i++) {
@@ -58,6 +64,13 @@ function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
}
}
const arrayPalette = Array.isArray(paletteColorLookupTableData)
? paletteColorLookupTableData[0]
: paletteColorLookupTableData;
if (arrayPalette instanceof ArrayBuffer) {
return (paletteColorLookupTableData.palette = arrayBufferToPaletteColorLUT(arrayPalette));
}
if (paletteColorLookupTableData.retrieveBulkData) {
return paletteColorLookupTableData
.retrieveBulkData()