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>>
120 void operator=(
const Self&);
126 #endif // otbLocalActivityVectorImageFilter_h