ImageDev

VarianceFilter3d

Computes, for each voxel of a three-dimensional image, the variance value of its neighborhood.

Access to parameter description

For an introduction: This algorithm replaces each voxel of the output image by the variance value of its neighborhood in the input image. The variance operator is given by: $$ variance=\sigma^2=\sum_{n}(n-m)^2\cdot p(n) $$ Where $m$ and $\sigma$ are respectively the mean and the standard deviation of the neighborhood.

The shape of the neighborhood can be: See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > varianceFilter3d( std::shared_ptr< iolink::ImageView > inputImage, VarianceFilter3d::KernelShape kernelShape, uint32_t kernelRadius, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
variance_filter_3d(input_image: idt.ImageType,
                   kernel_shape: VarianceFilter3d.KernelShape = VarianceFilter3d.KernelShape.BALL,
                   kernel_radius: int = 3,
                   output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
VarianceFilter3d( IOLink.ImageView inputImage,
                  VarianceFilter3d.KernelShape kernelShape = ImageDev.VarianceFilter3d.KernelShape.BALL,
                  UInt32 kernelRadius = 3,
                  IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
kernelRadius
The kernel half side length or radius, in voxels. In case of a cube, a value N produces a cube window of 2N+1 voxels side length. In case of a ball, a value N produces a ball with a 2N+1 voxels diameter. UInt32 >=1 3
input
kernelShape
The shape of the window defining the neighborhood.
CUBE The sliding window is a cube.
BALL The sliding window is a ball.
Enumeration BALL
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
kernel_radius
The kernel half side length or radius, in voxels. In case of a cube, a value N produces a cube window of 2N+1 voxels side length. In case of a ball, a value N produces a ball with a 2N+1 voxels diameter. uint32 >=1 3
input
kernel_shape
The shape of the window defining the neighborhood.
CUBE The sliding window is a cube.
BALL The sliding window is a ball.
enumeration BALL
output
output_image
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
input
kernelRadius
The kernel half side length or radius, in voxels. In case of a cube, a value N produces a cube window of 2N+1 voxels side length. In case of a ball, a value N produces a ball with a 2N+1 voxels diameter. UInt32 >=1 3
input
kernelShape
The shape of the window defining the neighborhood.
CUBE The sliding window is a cube.
BALL The sliding window is a ball.
Enumeration BALL
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is forced to floating point. Image null

Object Examples

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

VarianceFilter3d varianceFilter3dAlgo;
varianceFilter3dAlgo.setInputImage( foam );
varianceFilter3dAlgo.setKernelShape( VarianceFilter3d::KernelShape::CUBE );
varianceFilter3dAlgo.setKernelRadius( 3 );
varianceFilter3dAlgo.execute();

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

variance_filter_3d_algo = imagedev.VarianceFilter3d()
variance_filter_3d_algo.input_image = foam
variance_filter_3d_algo.kernel_shape = imagedev.VarianceFilter3d.CUBE
variance_filter_3d_algo.kernel_radius = 3
variance_filter_3d_algo.execute()

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

VarianceFilter3d varianceFilter3dAlgo = new VarianceFilter3d
{
    inputImage = foam,
    kernelShape = VarianceFilter3d.KernelShape.CUBE,
    kernelRadius = 3
};
varianceFilter3dAlgo.Execute();

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

Function Examples

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

auto result = varianceFilter3d( foam, VarianceFilter3d::KernelShape::CUBE, 3 );

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

result = imagedev.variance_filter_3d(foam, imagedev.VarianceFilter3d.CUBE, 3)

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

IOLink.ImageView result = Processing.VarianceFilter3d( foam, VarianceFilter3d.KernelShape.CUBE, 3 );

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