Create Gaussian Kernel

Synopsis

Create a Gaussian kernel.

Results

Output:

Size: [3, 3]
Neighborhood:
Radius:[1, 1]
Size:[3, 3]
DataBuffer:NeighborhoodAllocator { this = 0x7ffee598a9d8, begin = 0x7f7f502572a0, size=9 }
[-1, -1] 0
[0, -1] 0
[1, -1] 0
[-1, 0] 0.208375
[0, 0] 0.466801
[1, 0] 0.208375
[-1, 1] 0
[0, 1] 0
[1, 1] 0

Code

C++

#include <itkGaussianOperator.h>

int
main(int, char *[])
{
  using GaussianOperatorType = itk::GaussianOperator<float, 2>;
  GaussianOperatorType gaussianOperator;
  gaussianOperator.SetDirection(0); // Create the operator for the X axis derivative
  itk::Size<2> radius;
  radius.Fill(1);
  gaussianOperator.CreateToRadius(radius);

  std::cout << "Size: " << gaussianOperator.GetSize() << std::endl;

  std::cout << gaussianOperator << std::endl;

  for (unsigned int i = 0; i < 9; i++)
  {
    std::cout << gaussianOperator.GetOffset(i) << " " << gaussianOperator.GetElement(i) << std::endl;
  }
  return EXIT_SUCCESS;
}

Classes demonstrated