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
Trueif the handler supports the transfer syntax indicated inDatasetds,Falseotherwise.- def is_available():
Return
Trueif the handler’s dependencies are installed,Falseotherwise.- def get_pixeldata(ds):
Return a correctly sized 1D
numpy.ndarrayderived from the Pixel Data inDatasetds or raise an exception. Reshaping the returned array to the correct dimensions is handled automatically.- def needs_to_convert_to_RGB(ds):
Return
Trueif the Pixel Data in theDatasetds needs to be converted to the RGB colourspace,Falseotherwise.
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
NotImplementedErrorexception.