imars3d.backend.morph package
iMars3D’s module for function that modify inputs.
Submodules
imars3d.backend.morph.crop module
iMars3D: crop module.
- class imars3d.backend.morph.crop.crop(*, arrays, border_pix, crop_limit, expand_ratio, rel_intensity_threshold_air_or_slit, rel_intensity_threshold_fov, rel_intensity_threshold_sample, name)[source]
Bases:
ParameterizedFunction
Crop the image stack to provided limits or auto detected bound box.
- Parameters:
arrays (ndarray) – The image stack to crop. Can also be a 2D image.
crop_limit (tuple) – The four limits for cropping. Default is (-1, -1, -1, -1), which will trigger the automatic bounds detection.
border_pix (int) – the width of border region to estimate the background intensity, which helps to determine which case we are in.
expand_ratio (float) – the ratio to expand the cropped region.
rel_intensity_threshold_air_or_slit (float) – passing through keyword arguments to detect_bounds.
rel_intensity_threshold_fov (float) – passing through keyword arguments to detect_bounds.
rel_intensity_threshold_sample (float) – passing through keyword arguments to detect_bounds.
- Return type:
The cropped image stack.
- imars3d.backend.morph.crop.detect_bounds(arrays: ndarray, border_pix: int = 10, expand_ratio: float = 0.1, rel_intensity_threshold_air_or_slit: float = 0.05, rel_intensity_threshold_fov: float = 0.1, rel_intensity_threshold_sample: float = 0.95) tuple [source]
Auto detect bounds based on intensity thresholding.
- Parameters:
arrays – The image stack to crop. Can also be a 2D image.
border_pix – the width of border region to estimate the background intensity
expand_ratio – the ratio to expand the cropped region.
rel_intensity_threshold_air_or_slit – the relative intensity threshold to determine whether the outter boarder is slit (case 1) or air (case 2).
rel_intensity_threshold_fov – the relative intensity threshold used to determine pixels within to the field of view, only valid for case 1.
rel_intensity_threshold_sample – the relative intensity threshold used to determine pixels within the sample region, only valid for case 2, and the value is relative to the intensity of the air region (outter region in case 2).
- Return type:
The crop limits in (left, right, top, bottom) order.