pydicom.pixels.apply_color_lut

pydicom.pixels.apply_color_lut(arr: np.ndarray, ds: Dataset | None = None, palette: str | UID | None = None) np.ndarray[source]

Apply a color palette lookup table to arr.

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