Filtering
Python Functions
- actag.median_filter.divide_array(arr_len: int, num_sections: int) list
Divides an array into a specified number of sections and returns a list containing the start and end indices for each section.
- Parameters:
arr_len (int) – Length of the array.
num_sections (int) – Number of sections to divide the array into.
- Returns:
List containing the start and end indices for each section.
- Return type:
list
- actag.median_filter.filter_sub_image(sub_img: ndarray, kernel_radius: int) ndarray
Filters a sub-image using a median filter.
- Parameters:
sub_img (np.ndarray) – Sub-image to filter.
kernel_radius (int) – Radius of the kernel.
- Returns:
Filtered sub-image.
- Return type:
np.ndarray
- actag.median_filter.median_filter(img: ndarray, kernel_radius: int) ndarray
Median filter for 2D images.
- Parameters:
img (np.ndarray) – 2D image.
kernel_radius (int) – Radius of the kernel.
- Returns:
Filtered image.
- Return type:
np.ndarray
- actag.median_filter.median_filter_multiprocessed(img: ndarray, kernel_radius: int, num_processes: int | None = None) ndarray
Same as
median_filter(), but leverages multiprocessing to speed up computation time.- Parameters:
img (np.ndarray) – 2D image.
kernel_radius (int) – Radius of the kernel.
num_processes (int, default_value=None) – The number of processes to use. The default is
None, which will attempt to use the maximum number of CPUs available, as reported by the OS.
- Returns:
Filtered image.
- Return type:
np.ndarray
Rust Functions
- actag.rust_impl.median_filter()
Rust equivalent of
actag.median_filter.median_filter().- Parameters:
data – 2D image.
radius (usize) – Radius of the kernel.
- Returns:
Filtered image.
- Return type:
Vec<Vec<i32>>
- actag.rust_impl.median_filter_multithread()
Rust equivalent of
actag.median_filter.median_filter_multiprocessed().- Parameters:
data – 2D image.
radius (usize) – Radius of the kernel.
cpu_option – The number of CPUS to use. If None, all available CPUs will be used.
- Returns:
Filtered image.
- Return type:
Vec<Vec<i32>>