Deflated Image Frame Compression¶
The requirements for Deflated Image Frame Compression encoding are defined in Section 8.2.16 and Annex A.4.13 in Part 5 of the DICOM Standard. The underlying algorithm is the Deflate compression method.
Deflated Image Frame Compression is primary intended for single-bit segmentation encoding, however there are no restrictions on using it with other types of pixel data.
Valid Image Pixel Parameters¶
To ensure you have the correct Photometric Interpretation when encoding using Deflated Image Frame Compression, the uncompressed pixel data should already be in the corresponding color space:
If your uncompressed pixel data is grayscale (intensity) based:
Use
MONOCHROME1
if the minimum intensity value should be displayed as white.Use
MONOCHROME2
if the minimum intensity value should be displayed as black.
If your uncompressed pixel data uses a single sample per pixel and is an index to the Red, Green and Blue Palette Color Lookup Tables:
Use
PALETTE COLOR
.
If your uncompressed pixel data is in RGB color space:
For Photometric Interpretation
RGB
nothing else is required.For Photometric Interpretation
YBR_FULL
data must beconverted into YCbCr color space
, however the conversion operation is lossy.
If your uncompressed pixel data is in YCbCr color space:
For Photometric Interpretation
RGB
the pixel data must first beconverted into RGB color space
, however the conversion operation is lossy.For Photometric Interpretation
YBR_FULL
nothing else is required.
Available Plugins¶
Encoder |
Plugins |
|
---|---|---|
Name |
Added |
|
pydicom |
v3.1 |
Examples¶
Compressing grayscale pixel data in-place:
>>> from pydicom import examples
>>> from pydicom.uid import DeflatedImageFrameCompression
>>> ds = examples.ct
>>> ds.SamplesPerPixel
1
>>> ds.PhotometricInterpretation
'MONOCHROME2'
>>> ds.BitsAllocated
16
>>> ds.PixelRepresentation
1
>>> ds.compress(DeflatedImageFrameCompression)
>>> len(ds.PixelData)
22288