Create Laplacian Kernel

Synopsis

Create a Laplacian kernel.

Results

Output:

Size: [3, 3]
Neighborhood:
Radius:[1, 1]
Size:[3, 3]
DataBuffer:NeighborhoodAllocator { this = 0x7ffee97e29e0, begin = 0x7f87798a8810, size=9 }
[-1, -1] 0
[0, -1] 1
[1, -1] 0
[-1, 0] 1
[0, 0] -4
[1, 0] 1
[-1, 1] 0
[0, 1] 1
[1, 1] 0

Code

C++

#include <itkLaplacianOperator.h>

int
main(int, char *[])
{
  using LaplacianOperatorType = itk::LaplacianOperator<float, 2>;
  LaplacianOperatorType laplacianOperator;
  itk::Size<2>          radius;
  radius.Fill(1);
  laplacianOperator.CreateToRadius(radius);

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

  std::cout << laplacianOperator << std::endl;

  for (unsigned int i = 0; i < laplacianOperator.GetSize()[0] * laplacianOperator.GetSize()[1]; i++)
  {
    std::cout << laplacianOperator.GetOffset(i) << " " << laplacianOperator.GetElement(i) << std::endl;
  }
  return EXIT_SUCCESS;
}

Classes demonstrated