This algorithm uses morphological operators to set the voxel value to the median for the defined
neighborhood. This filter is particularly effective for removing speckle noise and salt and pepper noise
(impulsive noise) without affecting edges.
The median filter usually works well with images containing non-Gaussian noise and/or very small artifacts.
It does not cause blurring to the same extent as the Box Filter, but takes longer
to execute.
The gray levels of all voxels of the considered neighborhood are sorted from the smallest value to the
largest one. The central voxel in the sort is then the median value (the value for which there are as
many lower gray levels as higher ones). The process can be iterated.
Considering the array:
[123456789][121715201416181914][202122232425262728]
The sorted gray level values are: [1 2 3 4 5 6 7 8 9 12 14 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28].
The median value is 16, and it is assigned to the output voxel.
// Command constructor.MedianFilter3d();/// Gets the inputImage parameter./// The input image.
std::shared_ptr< iolink::ImageView> inputImage()const;/// Sets the inputImage parameter./// The input image.void setInputImage( std::shared_ptr< iolink::ImageView> inputImage );/// Gets the kernelRadius parameter./// The half size of the structuring element. A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1.uint32_t kernelRadius()const;/// Sets the kernelRadius parameter./// The half size of the structuring element. A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1.void setKernelRadius(constuint32_t& kernelRadius );/// Gets the kernelMode parameter./// The structuring element shape and application mode.MedianFilter3d::KernelMode kernelMode()const;/// Sets the kernelMode parameter./// The structuring element shape and application mode.void setKernelMode(constMedianFilter3d::KernelMode& kernelMode );/// Gets the searchMode parameter./// Handles all types of methods for finding the median.MedianFilter3d::SearchMode searchMode()const;/// Sets the searchMode parameter./// Handles all types of methods for finding the median.void setSearchMode(constMedianFilter3d::SearchMode& searchMode );/// Gets the outputImage parameter./// The output image. Its dimensions and type are forced to the same values as the input.
std::shared_ptr< iolink::ImageView> outputImage()const;/// Sets the outputImage parameter./// The output image. Its dimensions and type are forced to the same values as the input.void setOutputImage( std::shared_ptr< iolink::ImageView> outputImage );// Method to launch the command.void execute();
# Property of the inputImage parameter.MedianFilter3d.input_image
# Property of the kernelRadius parameter.MedianFilter3d.kernel_radius
# Property of the kernelMode parameter.MedianFilter3d.kernel_mode
# Property of the searchMode parameter.MedianFilter3d.search_mode
# Property of the outputImage parameter.MedianFilter3d.output_image
// Method to launch the command.
execute()
// Command constructor.MedianFilter3d()// Property of the inputImage parameter.MedianFilter3d.inputImage
// Property of the kernelRadius parameter.MedianFilter3d.kernelRadius
// Property of the kernelMode parameter.MedianFilter3d.kernelMode
// Property of the searchMode parameter.MedianFilter3d.searchMode
// Property of the outputImage parameter.MedianFilter3d.outputImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputImage
The input image.
Image
Binary, Label, Grayscale or Multispectral
nullptr
kernelRadius
The half size of the structuring element. A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1.
UInt32
>=1
3
searchMode
Handles all types of methods for finding the median.
AUTOMATIC
The algorithm automatically chooses the method to find the median value.
HISTOGRAM
The algorithm uses a histogram to find the median value.
SELECTION
The algorithm uses a shoting by selection to find the median value.
Enumeration
AUTOMATIC
kernelMode
The structuring element shape and application mode.
CUBE
This mode considers a cube structuring element of side length 2 x kernelRadius + 1 voxels.
BALL
This mode considers a sphere structuring element of diameter 2 x kernelRadius + 1 voxels.
Enumeration
CUBE
outputImage
The output image. Its dimensions and type are forced to the same values as the input.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_image
The input image.
image
Binary, Label, Grayscale or Multispectral
None
kernel_radius
The half size of the structuring element. A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1.
uint32
>=1
3
search_mode
Handles all types of methods for finding the median.
AUTOMATIC
The algorithm automatically chooses the method to find the median value.
HISTOGRAM
The algorithm uses a histogram to find the median value.
SELECTION
The algorithm uses a shoting by selection to find the median value.
enumeration
AUTOMATIC
kernel_mode
The structuring element shape and application mode.
CUBE
This mode considers a cube structuring element of side length 2 x kernelRadius + 1 voxels.
BALL
This mode considers a sphere structuring element of diameter 2 x kernelRadius + 1 voxels.
enumeration
CUBE
output_image
The output image. Its dimensions and type are forced to the same values as the input.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputImage
The input image.
Image
Binary, Label, Grayscale or Multispectral
null
kernelRadius
The half size of the structuring element. A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1.
UInt32
>=1
3
searchMode
Handles all types of methods for finding the median.
AUTOMATIC
The algorithm automatically chooses the method to find the median value.
HISTOGRAM
The algorithm uses a histogram to find the median value.
SELECTION
The algorithm uses a shoting by selection to find the median value.
Enumeration
AUTOMATIC
kernelMode
The structuring element shape and application mode.
CUBE
This mode considers a cube structuring element of side length 2 x kernelRadius + 1 voxels.
BALL
This mode considers a sphere structuring element of diameter 2 x kernelRadius + 1 voxels.
Enumeration
CUBE
outputImage
The output image. Its dimensions and type are forced to the same values as the input.