Parametric

Parameteric rank filters

This module provides rank filters that depend on several parameters.

nilblack(source, selem=None, sink=None, mask=None, k=0.0, **kwargs)[source]

Local nilblack threshold of an image.

The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean.

Arguments

sourcearray

Input array.

selemarray

Structure element. If None, use a cube of size 3.

sinkarray

Output array. If None, a new array is allocated.

maskarray

Optional mask, if None, the complete source is used. Pixels on the mask are zero in the output.

max_binint or None

Maximal number of bins.

kfloat

The factor between mean and standard deviation: threshold = mu + k * std

Returns

sinkarray

The filtered array.

sauvola(source, selem=None, sink=None, mask=None, k=0.0, R=1.0)[source]

Local Sauvola threshold of an image.

The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean.

Arguments

sourcearray

Input array.

selemarray

Structure element. If None, use a cube of size 3.

sinkarray

Output array. If None, a new array is allocated.

maskarray

Optional mask, if None, the complete source is used. Pixels on the mask are zero in the output.

max_binint or None

Maximal number of bins.

k, Rfloat

The factors in the formula: threshold = mu + k * (std/R - 1) * (mu - max_bin)

Returns

sinkarray

The filtered array.

contrast_limited_percentile(source, selem=None, sink=None, mask=None, percentile=0.0, limit=None, contrast_limit=0.1, **kwargs)[source]

Local Sauvola threshold of an image.

The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean.

Arguments

sourcearray

Input array.

selemarray

Structure element. If None, use a cube of size 3.

sinkarray

Output array. If None, a new array is allocated.

maskarray

Optional mask, if None, the complete source is used. Pixels on the mask are zero in the output.

max_binint or None

Maximal number of bins.

k, Rfloat

The factors in the formula: threshold = mu + k * (std/R - 1) * (mu - max_bin)

Returns

sinkarray

The filtered array.

light_sheet_artifact_correction(source, selem=None, sink=None, mask=None, percentiles=(0.0, 1.0), limit=None, contrast_limit=0.5, **kwargs)[source]

Local Sauvola threshold of an image.

The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean.

Arguments

sourcearray

Input array.

selemarray

Structure element. If None, use a cube of size 3.

sinkarray

Output array. If None, a new array is allocated.

maskarray

Optional mask, if None, the complete source is used. Pixels on the mask are zero in the output.

max_binint or None

Maximal number of bins.

k, Rfloat

The factors in the formula: threshold = mu + k * (std/R - 1) * (mu - max_bin)

Returns

sinkarray

The filtered array.