pydicom.pixel_data_handlers.apply_rescale(arr: np.ndarray, ds: Dataset) np.ndarray[source]

Apply a modality lookup table or rescale operation to arr.

New in version 1.4.


An array with applied modality LUT or rescale operation. If (0028,3000) Modality LUT Sequence is present then returns an array of np.uint8 or np.uint16, depending on the 3rd value of (0028,3002) LUT Descriptor. If (0028,1052) Rescale Intercept and (0028,1053) Rescale Slope are present then returns an array of np.float64. If neither are present then arr will be returned unchanged.

Return type



When Rescale Slope and Rescale Intercept are used, the output range is from (min. pixel value * Rescale Slope + Rescale Intercept) to (max. pixel value * Rescale Slope + Rescale Intercept), where min. and max. pixel value are determined from (0028,0101) Bits Stored and (0028,0103) Pixel Representation.