# pydicom.pixel_data_handlers.pillow_handler

Use the pillow Python package to decode Pixel Data.

Functions

`get_pixeldata`(ds) | Return a `numpy.ndarray` of the Pixel Data.
`is_available`() | Return `True` if the handler has its dependencies met.
`needs_to_convert_to_RGB`(ds) | Return `True` if the Pixel Data should to be converted from YCbCr to RGB.
`should_change_PhotometricInterpretation_to_RGB`(ds) | Return `True` if the Photometric Interpretation should be changed to RGB.
`supports_transfer_syntax`(transfer_syntax) | Return `True` if the handler supports the transfer_syntax.

pydicom.pixel_data_handlers.pillow_handler.get_pixeldata(ds: Dataset) → numpy.ndarray

  Return a `numpy.ndarray` of the Pixel Data.

  Parameters

    ds (Dataset) – The `Dataset` containing an Image Pixel module and the Pixel Data to be decompressed and returned.

  Returns

    The contents of (7FE0,0010) Pixel Data as a 1D array.

  Return type

    numpy.ndarray

  Raises

    - ImportError – If Pillow is not available.

    - NotImplementedError – If the transfer syntax is not supported

pydicom.pixel_data_handlers.pillow_handler.is_available() → bool

  Return `True` if the handler has its dependencies met.

pydicom.pixel_data_handlers.pillow_handler.needs_to_convert_to_RGB(ds: Dataset) → bool

  Return `True` if the Pixel Data should to be converted from YCbCr to RGB.

  This affects JPEG transfer syntaxes.

pydicom.pixel_data_handlers.pillow_handler.should_change_PhotometricInterpretation_to_RGB(ds: Dataset) → bool

  Return `True` if the Photometric Interpretation should be changed to RGB.

  This affects JPEG transfer syntaxes.

pydicom.pixel_data_handlers.pillow_handler.supports_transfer_syntax(transfer_syntax: pydicom.uid.UID) → bool

  Return `True` if the handler supports the transfer_syntax.

  Parameters

    transfer_syntax (uid.UID) – The Transfer Syntax UID of the Pixel Data that is to be used with the handler.