Fluo Tophat
- tomni.illumination_correction.fluo_tophat.main.fluo_tophat(img, normalize=0)[source]
Fluorescent Top-Hat Background Subtraction
This function performs background subtraction on a fluorescent channel image using a morphological white top-hat filter. The white top-hat filter is effective at highlighting small bright structures against a darker background.
- Parameters
img (numpy.ndarray) – A grayscale image where background subtraction will be applied.
normalize (int, optional) – If set to 1, the resulting image will be normalized to the 0-255 range. Defaults to 0.
- Returns
The image after background subtraction. p2 (float): The lower bound value used for potential later normalization. p98 (float): The upper bound value used for potential later normalization.
- Return type
img (numpy.ndarray)
Note
The p2 and p98 values represent the lower and upper bounds for potential image normalization. They are not automatically applied to the image to avoid data loss. These values can be used during integration and passed to the front-end for further processing.
Example
To perform background subtraction on an image and normalize the result, you can use this function as follows:
>>> result_image, lower_bound, upper_bound = fluo_tophat(image, normalize=1)