pydicom.pixels.processing.convert_color_space¶
- pydicom.pixels.processing.convert_color_space(arr: ndarray, current: str, desired: str, per_frame: bool = False) ndarray [source]¶
Convert the image(s) in arr from one color space to another.
Changed in version 2.2: Added per_frame keyword parameter.
- Parameters:
arr (numpy.ndarray) – The image(s) as
numpy.ndarray
withshape
(frames, rows, columns, 3) or (rows, columns, 3) and a ‘uint8’dtype
(unsigned 8-bit).current (str) – The current color space, should be a valid value for (0028,0004) Photometric Interpretation. One of
'RGB'
,'YBR_FULL'
,'YBR_FULL_422'
.desired (str) – The desired color space, should be a valid value for (0028,0004) Photometric Interpretation. One of
'RGB'
,'YBR_FULL'
,'YBR_FULL_422'
.per_frame (bool, optional) – If
True
and the input array contains multiple frames then process each frame individually and update arr in-place to reduce memory usage. DefaultFalse
.
- Returns:
The image(s) converted to the desired color space. If per_frame is
False
(the default) then a newndarray
will be returned, otherwise arr will be updated in-place.- Return type:
References
DICOM Standard, Part 3, Annex C.7.6.3.1.2
ISO/IEC 10918-5:2012 (ITU T.871), Section 7