DicomCodecs.JPEG (dicom_codecs v0.1.0)

Copy Markdown View Source

JPEG codec for DICOM transfer syntaxes: Baseline (Process 1), Extended (Processes 2 & 4) and Lossless (Process 14, any predictor, including First-Order Prediction).

Decoding uses the jpeg-decoder crate: 8-bit lossy streams and lossless streams of 2 to 16 bits. Three-component lossy frames come back converted to RGB; lossless frames come back as stored. 12-bit lossy streams (Extended Process 4) are not supported and return {:error, {:decode_failed, _}}.

Encoding uses the jpeg-encoder crate and always produces lossy Baseline JPEG at quality 95 with 4:4:4 chroma, so it only accepts 8-bit frames. Lossless JPEG encoding is not available; use JPEG-LS or JPEG 2000.

Errors are {:error, {reason, message}} as described in DicomCodecs.