linumpy.intensity.normalize#
Intensity normalization, equalization and histogram matching.
Functions#
|
Apply histogram equalisation on the input image. |
|
Normalize an image using low and high intensity thresholds. |
Match im2 and im1 histograms. |
|
|
Match neighbor tiles histograms sequentially. |
|
Use a regularization function to get a smooth intensity transition between adjacent slices. |
Module Contents#
- linumpy.intensity.normalize.eqhist(image, nbins=32)[source]#
Apply histogram equalisation on the input image.
- Parameters:
image (ndarray) – Input image
nbins (int) – Number of histogram bins to use
- Returns:
Equalized image
- Return type:
ndarray
- linumpy.intensity.normalize.normalize(image, low_thresh=0.0, high_thresh=99.5)[source]#
Normalize an image using low and high intensity thresholds.
- linumpy.intensity.normalize.match_histogram(im1: numpy.ndarray, im2: numpy.ndarray, return_transforms: Literal[False] = ...) numpy.ndarray[source]#
- linumpy.intensity.normalize.match_histogram(im1: numpy.ndarray, im2: numpy.ndarray, return_transforms: Literal[True]) tuple[Any, Any]
Match im2 and im1 histograms.
- Parameters:
im1 (ndarray) – Reference image used as target
im2 (ndarray) – Image to be adjusted
return_transforms (bool) – If set to True, the transform functions will be returned instead of the adjusted image.
- Returns:
ndarray – If returnTransform=False, returns adjusted image (im2)
list(interpolator functions) – If returnTransform=True, returns the function used to adjust im2 intensity to fit the im1 histogram. (V_inv, and T)
Notes
The returned interpolators V_inv and T need to be applied in chain. Example :
>> V_inv, T = match_histogram(im1, im2, returnTransform=True) >> im2p = V_inv(T(im2))
- linumpy.intensity.normalize.match_histogram_sequentially(data, preproc_data, abspos, z, overwrite=False)[source]#
Match neighbor tiles histograms sequentially.
- Parameters:
- Return type:
None
- linumpy.intensity.normalize.get_smooth_intensity_transition(vol, slices_start)[source]#
Use a regularization function to get a smooth intensity transition between adjacent slices.
- Parameters:
vol (ndarray) – Volume containing the slice to adjust
slices_start (list of int) – List of slice positions, corresponding to the slice transition location
compensateAttenuation (bool) – If true, compensation Beer-Lambert attenuation before the regularization (using a division by a low-pass version of the slice).
- Returns:
Adjusted volume.
- Return type:
ndarray
References
Wang, H., et al. (2014). Serial optical coherence scanner for large-scale brain imaging at microscopic resolution. NeuroImage, 84, 1007-1017. http://doi.org/10.1016/j.neuroimage.2013.09.063