For each voxel of the input image, mean μ and standard deviation σ values of a rectangular
neighbor window are computed.
The output image value is then given by:
O(i,j,k)={μ(i,j,k)ifλ×|I(i,j,k)−μ(i,j,k)|>σ(i,j,k)I(i,j,k)otherwise Where λ is a user-defined threshold factor on the distance of the current voxel gray level
to the mean of its neighbors, relative to their standard deviation.
The greater λ is, the stronger the blur.
This filter gives good results in the case of impulse noise.
// Command constructor.Despeckle3d();/// 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 kernelSizeX parameter./// The horizontal kernel size in voxels (odd value).int32_t kernelSizeX()const;/// Sets the kernelSizeX parameter./// The horizontal kernel size in voxels (odd value).void setKernelSizeX(constint32_t& kernelSizeX );/// Gets the kernelSizeY parameter./// The vertical kernel size in voxels (odd value).int32_t kernelSizeY()const;/// Sets the kernelSizeY parameter./// The vertical kernel size in voxels (odd value).void setKernelSizeY(constint32_t& kernelSizeY );/// Gets the kernelSizeZ parameter./// The depth kernel size in voxels (odd value).int32_t kernelSizeZ()const;/// Sets the kernelSizeZ parameter./// The depth kernel size in voxels (odd value).void setKernelSizeZ(constint32_t& kernelSizeZ );/// Gets the thresholdFactor parameter./// The standard deviation threshold factor (must be a positive value).double thresholdFactor()const;/// Sets the thresholdFactor parameter./// The standard deviation threshold factor (must be a positive value).void setThresholdFactor(constdouble& thresholdFactor );/// Gets the outputImage parameter./// The output image. Its dimensions, type, and calibration 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, type, and calibration 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.Despeckle3d.input_image
# Property of the kernelSizeX parameter.Despeckle3d.kernel_size_x
# Property of the kernelSizeY parameter.Despeckle3d.kernel_size_y
# Property of the kernelSizeZ parameter.Despeckle3d.kernel_size_z
# Property of the thresholdFactor parameter.Despeckle3d.threshold_factor
# Property of the outputImage parameter.Despeckle3d.output_image
// Method to launch the command.
execute()
// Command constructor.Despeckle3d()// Property of the inputImage parameter.Despeckle3d.inputImage
// Property of the kernelSizeX parameter.Despeckle3d.kernelSizeX
// Property of the kernelSizeY parameter.Despeckle3d.kernelSizeY
// Property of the kernelSizeZ parameter.Despeckle3d.kernelSizeZ
// Property of the thresholdFactor parameter.Despeckle3d.thresholdFactor
// Property of the outputImage parameter.Despeckle3d.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
kernelSizeX
The horizontal kernel size in voxels (odd value).
Int32
[3, 100]
3
kernelSizeY
The vertical kernel size in voxels (odd value).
Int32
[3, 100]
3
kernelSizeZ
The depth kernel size in voxels (odd value).
Int32
[3, 100]
3
thresholdFactor
The standard deviation threshold factor (must be a positive value).
Float64
>0
1
outputImage
The output image. Its dimensions, type, and calibration 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_size_x
The horizontal kernel size in voxels (odd value).
int32
[3, 100]
3
kernel_size_y
The vertical kernel size in voxels (odd value).
int32
[3, 100]
3
kernel_size_z
The depth kernel size in voxels (odd value).
int32
[3, 100]
3
threshold_factor
The standard deviation threshold factor (must be a positive value).
float64
>0
1
output_image
The output image. Its dimensions, type, and calibration 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
kernelSizeX
The horizontal kernel size in voxels (odd value).
Int32
[3, 100]
3
kernelSizeY
The vertical kernel size in voxels (odd value).
Int32
[3, 100]
3
kernelSizeZ
The depth kernel size in voxels (odd value).
Int32
[3, 100]
3
thresholdFactor
The standard deviation threshold factor (must be a positive value).
Float64
>0
1
outputImage
The output image. Its dimensions, type, and calibration are forced to the same values as the input.
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER )+"foam.vip");auto result = despeckle3d( foam,3,3,3,1.0);
std::cout <<"outputImage:"<< result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
result = imagedev.despeckle_3d( foam,3,3,3,1.0)print("output_image:", str( result ))
ImageView foam =Data.ReadVipImage(@"Data/images/foam.vip");IOLink.ImageView result =Processing.Despeckle3d( foam,3,3,3,1.0);Console.WriteLine("outputImage:"+ result.ToString());