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.

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 while minimizing memory usage.

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 while minimizing memory usage.

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.

unpack_bits(src[, as_array])

Unpack the bit-packed data in src.