Helper Module for Deep Learning.
Common functions to normalize intensities. Code: https://github.com/jcreinhold/intensity-normalization
-
pynet.preprocessing.intensity.kde_normalize(arr, mask=None, modality='T1w', norm_value=1)[source]¶ Use kernel density estimation to find the peak of the white matter in the histogram of a skull-stripped image. Then normalize intensitites to a normalization value.
- Parameters
arr: array
the input data.
mask: array, default None
the brain mask.
modality str, default ‘T1w’
the modality (T1w, T2w, FLAIR, MD, last, largest, first).
norm_value: float, default 1
the new intensity value for the detected WM peak.
- Returns
normalized: array
the normalized input data.
-
pynet.preprocessing.intensity.rescale(arr, mask=None, percentiles=(0, 100), dynamic=(0, 1))[source]¶ Performs a rescale of the image intensities to a certain range.
- Parameters
arr: array
the input data.
mask: array, default None
the brain mask.
percentiles: 2-uplet, default (0, 100)
percentile values of the input image that will be mapped. This parameter can be used for contrast stretching.
dynamic: 2-uplet, default (0, 1)
the intensities range of the rescaled data.
- Returns
rescaled: array
the rescaled input data.
Follow us
Inspired by AZMIND template.