OTB  6.7.0
Orfeo Toolbox
otbGenericInterpolateImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 
27 
28 namespace otb
29 {
30 
43 template <class TInputImage, class TFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>,
44  class TCoordRep = double>
46  public itk::InterpolateImageFunction<TInputImage, TCoordRep>
47 {
48 public:
54 
57 
59  itkNewMacro(Self);
60 
62  typedef typename Superclass::OutputType OutputType;
64 
66  //itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
67 
69  typedef typename Superclass::IndexType IndexType;
71  typedef typename Superclass::RealType RealType;
72  typedef TFunction FunctionType;
74 
77 
79  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
80 
89  OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override;
90 
92  virtual void SetRadius(unsigned int rad);
93  virtual unsigned int GetRadius() const
94  {
95  return m_Function.GetRadius();
96  }
97  //unsigned int GetRadius() { return this->GetFunction().GetRadius(); };
99 
101  // Don't have to be used here, just declared for the inheritance classes.
102  //virtual void SetWindowSize(unsigned int win){ m_WindowSize = win; };
103 
105  virtual FunctionType& GetFunction(void)
106  {
107  return m_Function;
108  }
109 
111  virtual void Initialize();
112 
114  itkSetMacro(NormalizeWeight, bool);
115  itkGetMacro(NormalizeWeight, bool);
117 
118 protected:
121  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
122 
125  void Modified(void) const override;
126 
128  virtual void ResetOffsetTable();
129 
131  virtual void InitializeTables();
132 
134  virtual void FillWeightOffsetTable();
135 
136 private:
137  GenericInterpolateImageFunction(const Self &) = delete;
138  void operator =(const Self&) = delete;
140  //unsigned int m_Radius;
141  // Constant to store twice the radius
142  unsigned int m_WindowSize;
143 
146 
148  unsigned int m_ImageDimension;
149 
155  mutable unsigned int m_OffsetTableSize;
156 
159  mutable unsigned int *m_OffsetTable;
160 
162  mutable unsigned int **m_WeightOffsetTable;
163 
166 
169 };
170 
171 } // end namespace itk
172 
173 #ifndef OTB_MANUAL_INSTANTIATION
175 #endif
176 
177 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Superclass::OutputType OutputType
InputImageType::IndexType IndexType
itk::ConstNeighborhoodIterator< InputImageType, TBoundaryCondition > IteratorType
Monteverdi_FLOATING_TYPE RealType
Definition: mvdTypes.h:84
TInputImage InputImageType
Generic interpolation of an otb::Image.
itk::InterpolateImageFunction< TInputImage, TCoordRep > Superclass