Plugins for Pixel Data compression and decompression#
The default installation of pydicom doesn’t support decompression or compression of Pixel Data, except for RLE Lossless and Deflated Image Frame Compression. Support for other compressed transfer syntaxes is added through plugins, each of which requires installing NumPy and one or more third-party packages.
To determine the transfer syntax used by a dataset you can use the following snippet:
from pydicom import dcmread
ds = dcmread("path/to/dataset")
print(ds.file_meta.TransferSyntaxUID.name)
Plugins for decompression#
The table below lists the plugins available for decompressing pixel data that’s been compressed using the method corresponding to the Transfer Syntax UID. No plugins are required for uncompressed pixel data, as pydicom can handle these natively as long as NumPy is installed.
If your dataset uses a compressed transfer syntax that isn’t listed below then you’ll have to rely on third-party methods for decoding, as described here.
Supported Transfer Syntaxes#
Transfer Syntax |
Plugins |
|||||
---|---|---|---|---|---|---|
Name |
UID |
|
|
|
|
|
JPEG Baseline 8-bit |
1.2.840.10008.1.2.4.50 |
✓1 |
✓ |
✓ |
||
JPEG Extended 12-bit |
1.2.840.10008.1.2.4.51 |
✓1 |
✓ |
✓ |
||
JPEG Lossless P14 |
1.2.840.10008.1.2.4.57 |
✓1 |
✓ |
|||
JPEG Lossless SV1 |
1.2.840.10008.1.2.4.70 |
✓1 |
✓ |
|||
JPEG-LS Lossless |
1.2.840.10008.1.2.4.80 |
✓1 |
✓ |
✓ |
||
JPEG-LS Near Lossless |
1.2.840.10008.1.2.4.81 |
✓1 |
✓ |
✓ |
||
JPEG 2000 Lossless |
1.2.840.10008.1.2.4.90 |
✓2 |
✓ |
✓4 |
||
JPEG 2000 |
1.2.840.10008.1.2.4.91 |
✓2 |
✓ |
✓4 |
||
HTJ2K Lossless |
1.2.840.10008.1.2.4.201 |
✓2 |
||||
HTJ2K Lossless RPCL |
1.2.840.10008.1.2.4.202 |
✓2 |
||||
HTJ2K |
1.2.840.10008.1.2.4.203 |
✓2 |
||||
RLE Lossless |
1.2.840.10008.1.2.5 |
✓3 |
✓ |
✓ |
||
Deflated Image Frame Compression |
1.2.840.10008.1.2.8.1 |
✓ |
pylibjpeg-libjpeg
pylibjpeg-openjpeg
pylibjpeg-rle
Plugin requirements and limitations#
Plugin |
Requires |
Known limitations |
|
---|---|---|---|
|
pylibjpeg and at least one of pylibjpeg-libjpeg, pylibjpeg-openjpeg and pylibjpeg-rle |
|
|
|
|
||
|
Pillow, with support for JPEG 2000 via Pillow’s Jpeg2KImagePlugin |
|
|
|
|||
|
|
Plugins for compression#
The table below lists the plugins available for compressing pixel data using the method corresponding to the Transfer Syntax UID. If you wish to use a compression method that isn’t listed below then you’ll have to rely on third-party methods for encoding, as described here.
Supported Transfer Syntaxes#
Transfer Syntax |
Plugins |
Encoding guide |
|
---|---|---|---|
Name |
UID |
||
JPEG-LS Lossless
JPEG-LS Near Lossless
|
1.2.840.10008.1.2.4.80
1.2.840.10008.1.2.4.81
|
|
|
JPEG 2000 Lossless
JPEG 2000
|
1.2.840.10008.1.2.4.90
1.2.840.10008.1.2.4.91
|
|
|
RLE Lossless |
1.2.840.10008.1.2.5 |
pylibjpeg pydicom |
|
Deflated Image Frame Compression |
1.2.840.10008.1.2.8.1 |
|
Plugin requirements and limitations#
Plugin |
Requires |
Known limitations |
|
---|---|---|---|
|
|||
|
pylibjpeg and pylibjpeg-openjpeg and/or pylibjpeg-rle |
|
|
|
|