OTB  9.0.0
Orfeo Toolbox
otbGenericInterpolateImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbGenericInterpolateImageFunction_h
22 #define otbGenericInterpolateImageFunction_h
23 
24 #include "itkInterpolateImageFunction.h"
25 #include "itkConstNeighborhoodIterator.h"
26 #include "itkConstantBoundaryCondition.h"
27 
28 namespace otb
29 {
30 
43 template <class TInputImage, class TFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
44 class ITK_EXPORT GenericInterpolateImageFunction : public itk::InterpolateImageFunction<TInputImage, TCoordRep>
45 {
46 public:
49  typedef itk::InterpolateImageFunction<TInputImage, TCoordRep> Superclass;
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52 
54  itkTypeMacro(GenericInterpolateImageFunction, itk::InterpolateImageFunction);
55 
57  itkNewMacro(Self);
58 
60  typedef typename Superclass::OutputType OutputType;
61  typedef typename Superclass::InputImageType InputImageType;
62 
64  // itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
65 
67  typedef typename Superclass::IndexType IndexType;
68  typedef typename InputImageType::SizeType SizeType;
69  typedef typename Superclass::RealType RealType;
70  typedef TFunction FunctionType;
71  typedef itk::ConstNeighborhoodIterator<InputImageType, TBoundaryCondition> IteratorType;
72 
74  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
75 
77  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
78 
87  OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override;
88 
90  virtual void SetRadius(unsigned int rad);
91  virtual unsigned int GetRadius() const
92  {
93  return m_Function.GetRadius();
94  }
95  // unsigned int GetRadius() { return this->GetFunction().GetRadius(); };
97 
99  // Don't have to be used here, just declared for the inheritance classes.
100  // virtual void SetWindowSize(unsigned int win){ m_WindowSize = win; };
101 
103  virtual FunctionType& GetFunction(void)
104  {
105  return m_Function;
106  }
107 
109  virtual void Initialize();
110 
112  itkSetMacro(NormalizeWeight, bool);
113  itkGetMacro(NormalizeWeight, bool);
115 
116 protected:
119  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
120 
123  void Modified(void) const override;
124 
126  virtual void ResetOffsetTable();
127 
129  virtual void InitializeTables();
130 
132  virtual void FillWeightOffsetTable();
133 
134 private:
135  GenericInterpolateImageFunction(const Self&) = delete;
136  void operator=(const Self&) = delete;
138  // unsigned int m_Radius;
139  // Constant to store twice the radius
140  unsigned int m_WindowSize;
141 
144 
146  unsigned int m_ImageDimension;
147 
153  mutable unsigned int m_OffsetTableSize;
154 
157  mutable unsigned int* m_OffsetTable;
158 
160  mutable unsigned int** m_WeightOffsetTable;
161 
164 
167 };
168 
169 } // end namespace itk
170 
171 #ifndef OTB_MANUAL_INSTANTIATION
173 #endif
174 
175 #endif
otb::GenericInterpolateImageFunction::FunctionType
TFunction FunctionType
Definition: otbGenericInterpolateImageFunction.h:70
otb::GenericInterpolateImageFunction::GetRadius
virtual unsigned int GetRadius() const
Definition: otbGenericInterpolateImageFunction.h:91
otb::GenericInterpolateImageFunction
Generic interpolation of an otb::Image.
Definition: otbGenericInterpolateImageFunction.h:44
otb::GenericInterpolateImageFunction::m_ImageDimension
unsigned int m_ImageDimension
Definition: otbGenericInterpolateImageFunction.h:146
otb::GenericInterpolateImageFunction::IndexType
Superclass::IndexType IndexType
Definition: otbGenericInterpolateImageFunction.h:67
otb::GenericInterpolateImageFunction::m_OffsetTableSize
unsigned int m_OffsetTableSize
Definition: otbGenericInterpolateImageFunction.h:153
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GenericInterpolateImageFunction::GetFunction
virtual FunctionType & GetFunction(void)
Definition: otbGenericInterpolateImageFunction.h:103
otb::GenericInterpolateImageFunction::Superclass
itk::InterpolateImageFunction< TInputImage, TCoordRep > Superclass
Definition: otbGenericInterpolateImageFunction.h:49
otb::GenericInterpolateImageFunction::OutputType
Superclass::OutputType OutputType
Definition: otbGenericInterpolateImageFunction.h:57
otb::GenericInterpolateImageFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGenericInterpolateImageFunction.h:51
otb::GenericInterpolateImageFunction::m_Function
FunctionType m_Function
Definition: otbGenericInterpolateImageFunction.h:143
otb::GenericInterpolateImageFunction::SizeType
InputImageType::SizeType SizeType
Definition: otbGenericInterpolateImageFunction.h:68
otb::GenericInterpolateImageFunction::IteratorType
itk::ConstNeighborhoodIterator< InputImageType, TBoundaryCondition > IteratorType
Definition: otbGenericInterpolateImageFunction.h:71
otb::GenericInterpolateImageFunction::m_TablesHaveBeenGenerated
bool m_TablesHaveBeenGenerated
Definition: otbGenericInterpolateImageFunction.h:163
otb::GenericInterpolateImageFunction::Self
GenericInterpolateImageFunction Self
Definition: otbGenericInterpolateImageFunction.h:48
otbGenericInterpolateImageFunction.hxx
otb::GenericInterpolateImageFunction::InputImageType
Superclass::InputImageType InputImageType
Definition: otbGenericInterpolateImageFunction.h:61
otb::GenericInterpolateImageFunction::m_WeightOffsetTable
unsigned int ** m_WeightOffsetTable
Definition: otbGenericInterpolateImageFunction.h:160
otb::Function::HammingWindowFunction< double, double >
otb::GenericInterpolateImageFunction::m_WindowSize
unsigned int m_WindowSize
Definition: otbGenericInterpolateImageFunction.h:140
otb::GenericInterpolateImageFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericInterpolateImageFunction.h:50
otb::GenericInterpolateImageFunction::m_OffsetTable
unsigned int * m_OffsetTable
Definition: otbGenericInterpolateImageFunction.h:157
otb::GenericInterpolateImageFunction::m_NormalizeWeight
bool m_NormalizeWeight
Definition: otbGenericInterpolateImageFunction.h:166
otb::GenericInterpolateImageFunction::RealType
Superclass::RealType RealType
Definition: otbGenericInterpolateImageFunction.h:69
otb::GenericInterpolateImageFunction::ContinuousIndexType
Superclass::ContinuousIndexType ContinuousIndexType
Definition: otbGenericInterpolateImageFunction.h:74