Pixel Data Utilities (pydicom.pixels.utils)

Pixel data related utility functions.

as_pixel_options(ds, **kwargs)

Return a dict containing the image pixel element values from ds.

compress(ds, transfer_syntax_uid[, arr, ...])

Compress uncompressed pixel data and update ds in-place with the resulting encapsulated codestream.

decompress(ds, *[, as_rgb, ...])

Perform an in-place decompression of a dataset with a compressed Transfer Syntax UID.

expand_ybr422(src, bits_allocated)

Return YBR_FULL_422 data expanded to YBR_FULL.

get_expected_length(ds[, unit])

Return the expected length (in terms of bytes or pixels) of the Pixel Data.

get_image_pixel_ids(ds)

Return a dict of the pixel data affecting element's id() values.

get_j2k_parameters(codestream)

Return a dict containing JPEG 2000 component parameters.

get_nr_frames(ds[, warn])

Return NumberOfFrames or 1 if NumberOfFrames is None or 0.

iter_pixels(src, *[, ds_out, specific_tags, ...])

Yield decoded pixel data frames from src as ndarray.

pack_bits(arr[, pad])

Pack a binary numpy.ndarray for use with Pixel Data.

pixel_array(src, *[, ds_out, specific_tags, ...])

Return decoded pixel data from src as ndarray.

pixel_dtype(ds[, as_float])

Return a numpy.dtype for the pixel data in ds.

reshape_pixel_array(ds, arr)

Return a reshaped numpy.ndarray arr.

set_pixel_data(ds, arr, ...[, ...])

Use an ndarray to set a dataset's Pixel Data and related Image Pixel module elements.

unpack_bits(src[, as_array])

Unpack the bit-packed data in src.