21 #ifndef otbConvolutionImageFilter_h
22 #define otbConvolutionImageFilter_h
24 #include "itkImageToImageFilter.h"
26 #include "itkNumericTraits.h"
28 #include "itkZeroFluxNeumannBoundaryCondition.h"
66 template <
class TInputImage,
class TOutputImage,
class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>,
67 class TFilterPrecision =
typename itk::NumericTraits<
typename TInputImage::InternalPixelType>::RealType>
72 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
73 itkStaticConstMacro(OutputImageDimension,
unsigned int, TOutputImage::ImageDimension);
82 typedef itk::ImageToImageFilter<InputImageType, OutputImageType>
Superclass;
95 typedef typename itk::NumericTraits<InputPixelType>::RealType
InputRealType;
100 typedef typename itk::Array<FilterPrecisionType>
ArrayType;
106 itkDebugMacro(
"setting radius to " << rad);
107 if (this->m_Radius != rad)
109 this->m_Radius = rad;
110 unsigned int arraySize = 1;
111 for (
unsigned int i = 0; i < m_Radius.GetSizeDimension(); ++i)
113 arraySize *= 2 * this->m_Radius[i] + 1;
115 this->m_Filter.SetSize(arraySize);
116 this->m_Filter.Fill(1);
123 itkGetConstReferenceMacro(Radius, InputSizeType);
128 if (filter.Size() != m_Filter.Size())
130 itkExceptionMacro(
"Error in SetFilter, invalid filter size:" << filter.Size() <<
" instead of (2*m_Radius[0]+1)*(2*m_Radius[1]+1): " << m_Filter.Size());
138 itkGetConstReferenceMacro(
Filter, ArrayType);
144 itkSetMacro(NormalizeFilter,
bool);
145 itkGetMacro(NormalizeFilter,
bool);
146 itkBooleanMacro(NormalizeFilter);
149 #ifdef ITK_USE_CONCEPT_CHECKING
151 itkConceptMacro(InputHasNumericTraitsCheck, (itk::Concept::HasNumericTraits<InputPixelType>));
161 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
173 void ThreadedGenerateData(
const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId)
override;
181 void GenerateInputRequestedRegion()
override;
185 void operator=(
const Self&) =
delete;
199 #ifndef OTB_MANUAL_INSTANTIATION