Create Derivative Kernel

Synopsis

Create a derivative kernel.

Results

Output:

Size: [3, 3]
Neighborhood:
Radius:[1, 1]
Size:[3, 3]
DataBuffer:NeighborhoodAllocator { this = 0x7ffeec8f19e8, begin = 0x7f822c2a8f00, size=9 }
[-1, -1] 0
[0, -1] 0
[1, -1] 0
[-1, 0] 0.5
[0, 0] 0
[1, 0] -0.5
[-1, 1] 0
[0, 1] 0
[1, 1] 0

Code

C++

#include <itkDerivativeOperator.h>

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

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

  std::cout << derivativeOperator << std::endl;

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

Classes demonstrated