# pydicom.pixel_data_handlers.apply_color_lut

pydicom.pixel_data_handlers.apply_color_lut(arr: np.ndarray, ds: Optional[Dataset] = None, palette: Optional[Union[str, pydicom.uid.UID]] = None) → np.ndarray

  Apply a color palette lookup table to arr.

  New in version 1.4.

  If (0028,1201-1203) Palette Color Lookup Table Data are missing then (0028,1221-1223) Segmented Palette Color Lookup Table Data must be present and vice versa. The presence of (0028,1204) Alpha Palette Color Lookup Table Data or (0028,1224) Alpha Segmented Palette Color Lookup Table Data is optional.

  Use of this function with the Enhanced Palette Color Lookup Table Module or Supplemental Palette Color LUT Module is not currently supported.

  Parameters

    - arr (numpy.ndarray) – The pixel data to apply the color palette to.

    - ds (dataset.Dataset, optional) – Required if palette is not supplied. A `Dataset` containing a suitable Image Pixel or Palette Color Lookup Table Module.

    - palette (str or uid.UID, optional) – Required if ds is not supplied. The name of one of the well-known color palettes defined by the DICOM Standard. One of: `'HOT_IRON'`, `'PET'`, `'HOT_METAL_BLUE'`, `'PET_20_STEP'`, `'SPRING'`, `'SUMMER'`, `'FALL'`, `'WINTER'` or the corresponding well-known (0008,0018) SOP Instance UID.

  Returns

    The RGB or RGBA pixel data as an array of `np.uint8` or `np.uint16` values, depending on the 3rd value of (0028,1201) Red Palette Color Lookup Table Descriptor.

  Return type

    numpy.ndarray

  References

  - Image Pixel Module

  - Supplemental Palette Color LUT Module

  - Enhanced Palette Color LUT Module

  - Palette Colour LUT Module

  - Supplemental Palette Color LUTs