Statistical Filters — SciPy Filters for QGIS

Estimate local standard deviation

class scipy_filters.algs.scipy_local_variance_algorithm.SciPyEstimateStdAlgorithm[source]

Estimate local variance. Implementation based on the source code of scipy.signal.wiener. using correlate from scipy.signal.

Note

No data cells within the filter radius are filled with 0.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter window.

Estimate local variance

class scipy_filters.algs.scipy_local_variance_algorithm.SciPyEstimateVarianceAlgorithm[source]

Estimate local variance

Implementation based on the source code of scipy.signal.wiener. using correlate from scipy.signal.

Note

No data cells within the filter radius are filled with 0.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter window.

Local range (difference of min and max)

class scipy_filters.algs.scipy_statistical_algorithms.SciPyRangeAlgorithm[source]

Range filter, returns the difference of min and max within the neighborhood

Calculated with minimum_filter and maximum_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the band mean.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).

Maximum filter

class scipy_filters.algs.scipy_statistical_algorithms.SciPyMaximumAlgorithm[source]

Maximum filter. Calculated with maximum_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the minimum of the data type.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).

Median filter

class scipy_filters.algs.scipy_statistical_algorithms.SciPyMedianAlgorithm[source]

Median filter

Calculated with median_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the band mean.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).

Minimum filter

class scipy_filters.algs.scipy_statistical_algorithms.SciPyMinimumAlgorithm[source]

Minimum filter

Calculated with minimum_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the maximum of the data type.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).

Percentile filter

class scipy_filters.algs.scipy_statistical_algorithms.SciPyPercentileAlgorithm[source]

Percentile filter

Calculated with percentile_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the band mean.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D.

Note

bands will be the first axis of the datacube.

Percentile Percentile from 0 to 100. Negative values: use 100 - given value as percentile.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).

Rank filter

class scipy_filters.algs.scipy_statistical_algorithms.SciPyRankAlgorithm[source]

Rank filter

Calculated with rank_filter from scipy.ndimage.

Note

No data cells within the filter radius are filled with the band mean.

The filter calculates a histogram for the neighborhood (specified by footprint or size) and returns the value at the position of rank.

Note

a median filter is a special case with rank = 0.5 * size of the footprint.

Dimension Calculate for each band separately (2D) or use all bands as a 3D datacube and perform filter in 3D. .. note:: bands will be the first axis of the datacube.

Rank Index of the element in the array of the local histogram to be returned. Ranges from 0 (smallest element) to the size of the footprint minus one. If using size instead of footprint, the resulting footprint size is size raised by the power of the number of dimensions. The rank parameter may be less than zero: rank = -1 indicates the largest element, etc.

Size Size of filter in pixels if no footprint is given. Equivalent to a footprint array of shape size_rows × size_cols (in 2D) or size_bands × size_rows × size_cols (in 3D) filled with ones.

Footprint Positions of elements of a flat structuring element used for the filter (as string representation of array). Must have 2 dimensions if dimension is set to 2D. Should have 3 dimensions if dimension is set to 3D, but a 2D array is also excepted (a new axis is added as first axis and the result is the same as calculating each band seperately). Examples can be loaded with the load button. For convenience (i.e. when calling from a script), the following shortcuts are accepted as well: “square”, “cross”, “cross3D”, “ball”, “cube”.

Origin Shift the origin (hotspot) of the filter.

Border mode determines how input is extended around the edges: Reflect (input is extended by reflecting at the edge), Constant (fill around the edges with a constant value), Nearest (extend by replicating the nearest pixel), Mirror (extend by reflecting about the center of last pixel), Wrap (extend by wrapping around to the opposite edge).