ImageDev

SigmaFilter3d

Performs an adaptive smoothing of a three-dimensional image by excluding any aberrant voxels 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 voxel neighborhood values. Voxel values far from the considered voxel intensity $I_c$ are excluded using a user threshold $\sigma$.
Only voxels 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 the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
sigmaFilter3d( std::shared_ptr< iolink::ImageView > inputImage,
               int32_t kernelSizeX,
               int32_t kernelSizeY,
               int32_t kernelSizeZ,
               double standardDeviation,
               int32_t populationThreshold,
               std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
sigma_filter_3d( input_image,
                 kernel_size_x = 3,
                 kernel_size_y = 3,
                 kernel_size_z = 3,
                 standard_deviation = 20,
                 population_threshold = 8,
                 output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
SigmaFilter3d( IOLink.ImageView inputImage,
               Int32 kernelSizeX = 3,
               Int32 kernelSizeY = 3,
               Int32 kernelSizeZ = 3,
               double standardDeviation = 20,
               Int32 populationThreshold = 8,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name SigmaFilter3d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
kernelSizeX
The horizontal kernel size in voxels (odd value). Int32 [3, 100] 3
input
kernelSizeY
The vertical kernel size in voxels (odd value). Int32 [3, 100] 3
input
kernelSizeZ
The depth kernel size in voxels (odd value). Int32 [3, 100] 3
input
standardDeviation
The intensity interval for retaining a voxel of the neighborhood. Float64 >0 20
input
populationThreshold
The population threshold. If the number of voxels selected by the formula is lower than this threshold, all voxels of the neighborhood are used for computing the mean. Int32 >=0 8
output
outputImage
The output image. Its dimensions, type, and calibration are forced to the same values as the input. Image nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

SigmaFilter3d sigmaFilter3dAlgo;
sigmaFilter3dAlgo.setInputImage( foam );
sigmaFilter3dAlgo.setKernelSizeX( 3 );
sigmaFilter3dAlgo.setKernelSizeY( 3 );
sigmaFilter3dAlgo.setKernelSizeZ( 3 );
sigmaFilter3dAlgo.setStandardDeviation( 20.0 );
sigmaFilter3dAlgo.setPopulationThreshold( 8 );
sigmaFilter3dAlgo.execute();

std::cout << "outputImage:" << sigmaFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

sigma_filter_3d_algo = imagedev.SigmaFilter3d()
sigma_filter_3d_algo.input_image = foam
sigma_filter_3d_algo.kernel_size_x = 3
sigma_filter_3d_algo.kernel_size_y = 3
sigma_filter_3d_algo.kernel_size_z = 3
sigma_filter_3d_algo.standard_deviation = 20.0
sigma_filter_3d_algo.population_threshold = 8
sigma_filter_3d_algo.execute()

print( "output_image:", str( sigma_filter_3d_algo.output_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

SigmaFilter3d sigmaFilter3dAlgo = new SigmaFilter3d
{
    inputImage = foam,
    kernelSizeX = 3,
    kernelSizeY = 3,
    kernelSizeZ = 3,
    standardDeviation = 20.0,
    populationThreshold = 8
};
sigmaFilter3dAlgo.Execute();

Console.WriteLine( "outputImage:" + sigmaFilter3dAlgo.outputImage.ToString() );

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = sigmaFilter3d( foam, 3, 3, 3, 20.0, 8 );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.sigma_filter_3d( foam, 3, 3, 3, 20.0, 8 )

print( "output_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.SigmaFilter3d( foam, 3, 3, 3, 20.0, 8 );

Console.WriteLine( "outputImage:" + result.ToString() );