pydicom.pixels.utils.as_pixel_options

pydicom.pixels.utils.as_pixel_options(ds: Dataset, **kwargs: Any) dict[str, Any][source]

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

Added in version 3.0.

Parameters:
  • ds (pydicom.dataset.Dataset) – A dataset containing Image Pixel module elements.

  • **kwargs – A dict containing (key, value) pairs to be used to override the values taken from ds. For example, if kwargs = {'rows': 64} then the returned dict will have a ‘rows’ value of 64 rather than whatever ds.Rows may be.

Returns:

A dictionary which may contain the following keys, depending on which elements are present in ds and the contents of kwargs:

  • samples_per_pixel

  • photometric_interpretation

  • planar_configuration

  • number_of_frames (always present)

  • rows

  • columns

  • bits_allocated

  • bits_stored

  • pixel_representation

Return type:

dict[str, Any]