pydicom.pixel_data_handlers.apply_windowing¶
-
pydicom.pixel_data_handlers.
apply_windowing
(arr: np.ndarray, ds: Dataset, index: int = 0) → np.ndarray[source]¶ Apply a windowing operation to arr.
New in version 2.1.
- Parameters
arr (numpy.ndarray) – The
ndarray
to apply the windowing operation to.ds (dataset.Dataset) – A dataset containing a VOI LUT Module. If (0028,1050) Window Center and (0028,1051) Window Width are present then returns an array of
np.float64
, otherwise arr will be returned unchanged.index (int, optional) – When the VOI LUT Module contains multiple alternative views, this is the index of the view to return (default
0
).
- Returns
An array with applied windowing operation.
- Return type
Notes
When the dataset requires a modality LUT or rescale operation as part of the Modality LUT module then that must be applied before any windowing operation.
See also
References
DICOM Standard, Part 3, Annex C.11.2
DICOM Standard, Part 3, Annex C.8.11.3.1.5
DICOM Standard, Part 4, Annex N.2.1.1