pydicom.config.pixel_data_handlers¶
- pydicom.config.pixel_data_handlers = [<module 'pydicom.pixel_data_handlers.numpy_handler' from '/root/project/src/pydicom/pixel_data_handlers/numpy_handler.py'>, <module 'pydicom.pixel_data_handlers.gdcm_handler' from '/root/project/src/pydicom/pixel_data_handlers/gdcm_handler.py'>, <module 'pydicom.pixel_data_handlers.pillow_handler' from '/root/project/src/pydicom/pixel_data_handlers/pillow_handler.py'>, <module 'pydicom.pixel_data_handlers.jpeg_ls_handler' from '/root/project/src/pydicom/pixel_data_handlers/jpeg_ls_handler.py'>, <module 'pydicom.pixel_data_handlers.pylibjpeg_handler' from '/root/project/src/pydicom/pixel_data_handlers/pylibjpeg_handler.py'>, <module 'pydicom.pixel_data_handlers.rle_handler' from '/root/project/src/pydicom/pixel_data_handlers/rle_handler.py'>]¶
Handlers for converting (7FE0,0010) Pixel Data.
This is an ordered list of Pixel Data handlers that the
convert_pixel_data()
method will use to try to extract a correctly sized numpy array from the Pixel Data element.Handlers shall have four methods:
- def supports_transfer_syntax(transfer_syntax: UID)
Return
True
if the handler supports the transfer syntax indicated inDataset
ds,False
otherwise.- def is_available():
Return
True
if the handler’s dependencies are installed,False
otherwise.- def get_pixeldata(ds):
Return a correctly sized 1D
numpy.ndarray
derived from the Pixel Data inDataset
ds or raise an exception. Reshaping the returned array to the correct dimensions is handled automatically.- def needs_to_convert_to_RGB(ds):
Return
True
if the Pixel Data in theDataset
ds needs to be converted to the RGB colourspace,False
otherwise.
The first handler that both announces that it supports the transfer syntax and does not raise an exception, either in getting the data or when the data is reshaped to the correct dimensions, is the handler that will provide the data.
If they all fail only the last exception is raised.
If none raise an exception, but they all refuse to support the transfer syntax, then this fact is announced in a
NotImplementedError
exception.