21 #ifndef otbLocalActivityVectorImageFilter_h
22 #define otbLocalActivityVectorImageFilter_h
26 #include <itkNumericTraits.h>
38 template <
class TInput,
class TOutput>
54 typename TInput::PixelType centerPixel = input.GetCenterPixel();
56 unsigned int neighborSize = input.Size();
57 unsigned int vectorSize = centerPixel.Size();
59 if (neighborSize == 1)
62 TOutput output(vectorSize);
64 for (
unsigned int i = 0; i < vectorSize; ++i)
66 typename TOutput::ValueType out = itk::NumericTraits<typename TOutput::ValueType>::Zero;
67 for (
unsigned int j = 0; j < neighborSize / 2; ++j)
69 out += input.GetPixel(j)[i];
71 for (
unsigned int j = neighborSize / 2 + 1; j < neighborSize; ++j)
73 out += input.GetPixel(j)[i];
76 output[i] = centerPixel[i] - out /
static_cast<double>(neighborSize - 1);
90 template <
class TInputImage,
class TOutputImage>
93 TInputImage, TOutputImage, Functor::LocalActivityOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
Performs the calculation of LocalActivity derivation.
virtual ~LocalActivityOperator()
TOutput operator()(const TInput &input)
Implements the LocalActivity Gradient to be processed on a vector image.
itk::SmartPointer< const Self > ConstPointer
LocalActivityVectorImageFilter()=default
itk::SmartPointer< Self > Pointer
void operator=(const Self &)
~LocalActivityVectorImageFilter()=default
LocalActivityVectorImageFilter(const Self &)
LocalActivityVectorImageFilter Self
UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage, Functor::LocalActivityOperator< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
Implements neighborhood-wise generic operation of one vector image.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.