SigmaFilter2d
Performs an adaptive smoothing of a two-dimensional image by excluding any aberrant pixels of a local averaging.
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm computes a local mean from each pixel neighborhood values. Pixel values far from the considered pixel intensity $I_c$ are excluded using a user threshold $\sigma$.
Only pixels verifying the following formula are kept for computation:
$$ I \in [I_c-2\sigma, I_c+2\sigma] $$ A user-defined population threshold allows the algorithm to switch between the formula above and a classical neighbor mean formula. This parameter avoids considering low populated neighborhoods for computation.
See also
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm computes a local mean from each pixel neighborhood values. Pixel values far from the considered pixel intensity $I_c$ are excluded using a user threshold $\sigma$.
Only pixels verifying the following formula are kept for computation:
$$ I \in [I_c-2\sigma, I_c+2\sigma] $$ A user-defined population threshold allows the algorithm to switch between the formula above and a classical neighbor mean formula. This parameter avoids considering low populated neighborhoods for computation.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > sigmaFilter2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, double standardDeviation, int32_t populationThreshold, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. sigma_filter_2d(input_image: idt.ImageType, kernel_size_x: int = 3, kernel_size_y: int = 3, standard_deviation: float = 20, population_threshold: int = 8, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView SigmaFilter2d( IOLink.ImageView inputImage, Int32 kernelSizeX = 3, Int32 kernelSizeY = 3, double standardDeviation = 20, Int32 populationThreshold = 8, IOLink.ImageView outputImage = null );
Class Syntax
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 pixels (odd value). | Int32 | [3, 100] | 3 | |
kernelSizeY |
The vertical kernel size in pixels (odd value). | Int32 | [3, 100] | 3 | |
standardDeviation |
The intensity interval for retaining a pixel of the neighborhood. | Float64 | >0 | 20 | |
populationThreshold |
The population threshold. If the number of pixels selected by the formula is lower than this threshold, all pixels of the neighborhood are used for computing the mean. | Int32 | >=0 | 8 | |
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 pixels (odd value). | int32 | [3, 100] | 3 | |
kernel_size_y |
The vertical kernel size in pixels (odd value). | int32 | [3, 100] | 3 | |
standard_deviation |
The intensity interval for retaining a pixel of the neighborhood. | float64 | >0 | 20 | |
population_threshold |
The population threshold. If the number of pixels selected by the formula is lower than this threshold, all pixels of the neighborhood are used for computing the mean. | int32 | >=0 | 8 | |
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 pixels (odd value). | Int32 | [3, 100] | 3 | |
kernelSizeY |
The vertical kernel size in pixels (odd value). | Int32 | [3, 100] | 3 | |
standardDeviation |
The intensity interval for retaining a pixel of the neighborhood. | Float64 | >0 | 20 | |
populationThreshold |
The population threshold. If the number of pixels selected by the formula is lower than this threshold, all pixels of the neighborhood are used for computing the mean. | Int32 | >=0 | 8 | |
outputImage |
The output image. Its dimensions, type, and calibration are forced to the same values as the input. | Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); SigmaFilter2d sigmaFilter2dAlgo; sigmaFilter2dAlgo.setInputImage( polystyrene ); sigmaFilter2dAlgo.setKernelSizeX( 3 ); sigmaFilter2dAlgo.setKernelSizeY( 3 ); sigmaFilter2dAlgo.setStandardDeviation( 20.0 ); sigmaFilter2dAlgo.setPopulationThreshold( 8 ); sigmaFilter2dAlgo.execute(); std::cout << "outputImage:" << sigmaFilter2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) sigma_filter_2d_algo = imagedev.SigmaFilter2d() sigma_filter_2d_algo.input_image = polystyrene sigma_filter_2d_algo.kernel_size_x = 3 sigma_filter_2d_algo.kernel_size_y = 3 sigma_filter_2d_algo.standard_deviation = 20.0 sigma_filter_2d_algo.population_threshold = 8 sigma_filter_2d_algo.execute() print("output_image:", str(sigma_filter_2d_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); SigmaFilter2d sigmaFilter2dAlgo = new SigmaFilter2d { inputImage = polystyrene, kernelSizeX = 3, kernelSizeY = 3, standardDeviation = 20.0, populationThreshold = 8 }; sigmaFilter2dAlgo.Execute(); Console.WriteLine( "outputImage:" + sigmaFilter2dAlgo.outputImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = sigmaFilter2d( polystyrene, 3, 3, 20.0, 8 ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.sigma_filter_2d(polystyrene, 3, 3, 20.0, 8) print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.SigmaFilter2d( polystyrene, 3, 3, 20.0, 8 ); Console.WriteLine( "outputImage:" + result.ToString() );