Skip to content

Filtermap Utils

Source

Filter map utilities.

FilterValueFunc = Callable[[NDArray[Any]], float] module-attribute

A function that outputs a value to determine whether a patch should be filtered.

create_filter_map(image, filter_value_func, patch_size, direction='greater')

Create a filter map to assess the correct thresholds for filtering.

Parameters:

  • image (ndarray) –

    The image to create a filter map for, it can be 2D or 3D with no channels. E.g. it should have the axes YX or ZYX.

  • filter_value_func (FilterValue) –

    A function that produces a single value for a patch to create the filter map with.

  • patch_size (tuple of int) –

    The patch size intended for training.

  • direction ((greater, less), default: "greater" ) –

    Whether the filter will take thresholds greater than or less than the filter value. "greater" indicates values above the threshold will be kept for training.

Returns:

  • ndarray

    An array that has the same shape as the image. It shows regions of the image that will be filtered above or below some threshold.