maxfilter

Syntax: maxfilter(input image, output image, radius, allow optimization, neighbourhood type, boundary condition)

Maximum filter. Replaces pixel by maximum of pixels in its neighbourhood. For binary images, this equals dilation of foreground (non-zero) pixels.

This command can be used in the distributed processing mode. Use distribute command to change processing mode from local to distributed.

Arguments

input image [input]

Data type: uint8 image, uint16 image, uint32 image, uint64 image, int8 image, int16 image, int32 image, int64 image, float32 image

Input image.

output image [output]

Data type: uint8 image, uint16 image, uint32 image, uint64 image, int8 image, int16 image, int32 image, int64 image, float32 image

Output image.

radius [input]

Data type: 3-component integer vector

Default value: “[1, 1, 1]”

Radius of neighbourhood. Diameter will be \(2r+1\).

allow optimization [input]

Data type: boolean

Default value: True

Set to true to allow use of approximate decompositions of spherical structuring elements using periodic lines. As a result of the approximation processing is much faster but the true shape of the structuring element is not sphere but a regular polyhedron. See van Herk - A fast algorithm for local minimum and maximum filters on rectangular and octagonal kernels and Jones - Periodic lines Definition, cascades, and application to granulometries. The approximate filtering will give wrong results where distance from image edge is less than r. Consider enlarging the image by r to all directions before processing. Enlarging in the \(z\)-direction is especially important for 2D images, and therefore approximate processing is not allowed if the image is 2-dimensional.

neighbourhood type [input]

Data type: neighbourhood type

Default value: Ellipsoidal

Type of neighbourhood. Can be Ellipsoidal for ellipsoidal or spherical neighbourhood; or Rectangular for rectangular neighbourhood.

boundary condition [input]

Data type: boundary condition

Default value: Nearest

Type of boundary condition. Zero indicates that values outside of image bounds are taken to be zero. Nearest indicates that the nearest value inside the image is to be used in place of values outside of image bounds.