cbi_toolbox.reconstruct.preprocess
The preprocess module implements functions to preprocess experimental images.
- cbi_toolbox.reconstruct.preprocess.erase_corners(image_array, corner_size=300)[source]
Fill the corners of the image with the closest pixel value. This is useful when a diaphragm is visible in the field of view.
- Parameters:
image_array (numpy.ndarray) – The original image.
corner_size (int, optional) – The size of the corner to fill, by default 300
- Returns:
The new image with corners filled.
- Return type:
numpy.ndarray
- cbi_toolbox.reconstruct.preprocess.remove_background_illumination(image_array, threshold=0.5, hole_size=250, margin_size=100, border_axis=-1)[source]
Removes the background illumination from images using thresholding and morphological filtering.
- Parameters:
image_array (numpy.ndarray) – The images to be processed as a 3D array, the first dimension iterates over the different images.
threshold (float, optional) – The relative threshold used to detect background, by default 0.5.
hole_size (int, optional) – Biggest holes removed by filtering, by default 250.
margin_size (int, optional) – Margin kept around the useful information, by default 100.
border_axis (int, optional) – Axis used to detect the outer edge of the image, by default -1.
- Returns:
The array of images without background illumination.
- Return type:
numpy.ndarray
- cbi_toolbox.reconstruct.preprocess.transmission_to_absorption(image_array, max_value=4096)[source]
Convert a transmission image into an absorption one. This inverses the black-white contrast.
- Parameters:
image_array (numpy.ndarray) – The absorption image.
max_value (float, optional) – The max value for scaling the original image, by default 4096.
- Returns:
The absorption contrast image.
- Return type:
numpy.ndarray