pydicom.pixels.utils.decompress¶
- pydicom.pixels.utils.decompress(ds: Dataset, *, as_rgb: bool = True, generate_instance_uid: bool = True, decoding_plugin: str = '', **kwargs: Any) Dataset [source]¶
Perform an in-place decompression of a dataset with a compressed Transfer Syntax UID.
Added in version 3.0.
Warning
This function requires NumPy and may require the installation of additional packages to perform the actual pixel data decoding. See the pixel data decompression documentation for more information.
The dataset’s Transfer Syntax UID will be set to Explicit VR Little Endian.
The Pixel Data will be decompressed in its entirety and the Pixel Data element’s value updated with the uncompressed data, padded to an even length.
The Pixel Data element’s VR will be set to OB if Bits Allocated <= 8, otherwise it will be set to OW.
The
DataElement.is_undefined_length
attribute for the Pixel Data element will be set toFalse
.Any image pixel module elements may be modified as required to match the uncompressed Pixel Data.
If generate_instance_uid is
True
(default) then a new (0008,0018) SOP Instance UID value will be generated.
- Parameters:
ds (pydicom.dataset.Dataset) – A dataset containing compressed Pixel Data to be decoded and the corresponding Image Pixel module elements, along with a
file_meta
attribute containing a suitable (0002,0010) Transfer Syntax UID.as_rgb (bool, optional) – if
True
(default) then convert pixel data with a YCbCr photometric interpretation such as"YBR_FULL_422"
to RGB.generate_instance_uid (bool, optional) – If
True
(default) then generate a new (0008,0018) SOP Instance UID value for the dataset usinggenerate_uid()
, otherwise keep the original value.decoding_plugin (str, optional) – The name of the decoding plugin to use when decoding compressed pixel data. If no decoding_plugin is specified (default) then all available plugins will be tried and the result from the first successful one yielded. For information on the available plugins for each decoder see the API documentation.
kwargs (dict[str, Any], optional) – Optional keyword parameters for the decoding plugin may also be present. See the decoding plugins options for more information.
- Returns:
The dataset ds decompressed in-place.
- Return type: