Skip to content

feat(dicom): decode HTJ2K with OpenJPH - #1053

Merged
PaulHax merged 1 commit into
dicom-loadingfrom
dicom-htj2k
Nov 26, 2026
Merged

PaulHax merged 1 commit into
dicom-loadingfrom
dicom-htj2k

Conversation

@PaulHax

@PaulHax PaulHax commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1046 (dicom-loading). Review and merge that first; this PR then retargets to main.

VolView had no decoder for the High-Throughput JPEG 2000 transfer syntaxes (1.2.840.10008.1.2.4.201, .202 and .203). This adds one.

Changes

  • HTJ2K instances decode whole in OpenJPH (@cornerstonejs/codec-openjph, MIT) workers. A worker starts on the first HTJ2K decode, so sessions without HTJ2K data load no extra code or WASM.
  • The decoder reads only the Pixel Data value, splits frames with the existing splitEncapsulatedFrames, and finishes samples with the native frame code (masking, sign extension from Bits Stored, modality rescale). It declines what native decoding declines, so photometric and bit-depth rules stay in one place. YBR_RCT and YBR_ICT labelled files are declined for now.
  • The GDCM decoder's worker slot handling moves into a shared lanePool.ts that both decoders use.
  • createDicomRuntime's decoders option now receives { gdcm, htj2k } instead of the GDCM decoder alone.

Test data

The volume corpus gains the two pydicom-data HTJ2K files (RGB lossless and lossy) and a generated file of three signed 12 bit greyscale frames, encoded with OpenJPH at test time and checked against the pydicom reference, which decodes with OpenJPEG. An application spec opens an HTJ2K file and checks the decoded colour image reaches the slice view.

HTJ2K transfer syntaxes had no decoder. They now decode whole in OpenJPH
workers, started on first use, and the samples are finished by the same
code as native frames, so the HTJ2K decoder declines what native decoding
declines. The GDCM decoder and the new one share a lane pool.

The corpus gains the two pydicom-data HTJ2K files and a generated file
of three signed 12 bit frames, checked against the reference.
@PaulHax
PaulHax merged commit 6251323 into dicom-loading Nov 26, 2026
4 checks passed
@PaulHax
PaulHax deleted the dicom-htj2k branch November 26, 2026 01:02
@PaulHax

PaulHax commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #1046: this commit is now on dicom-loading, along with MONOCHROME1 display handling.

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