OTB  10.0.0
Orfeo Toolbox
otbBCOInterpolateImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbBCOInterpolateImageFunction_h
22 #define otbBCOInterpolateImageFunction_h
23 
24 #include <boost/version.hpp>
25 #include <boost/container/small_vector.hpp>
26 
27 #include "itkInterpolateImageFunction.h"
28 #include "otbMath.h"
29 
30 #include "otbVectorImage.h"
31 
32 namespace otb
33 {
57 template <class TInputImage, class TCoordRep = double>
58 class ITK_EXPORT BCOInterpolateImageFunctionBase : public itk::InterpolateImageFunction<TInputImage, TCoordRep>
59 {
60 public:
63  typedef itk::InterpolateImageFunction<TInputImage, TCoordRep> Superclass;
64 
66  itkTypeMacro(BCOInterpolateImageFunctionBase, InterpolateImageFunction);
67 
69  typedef typename Superclass::OutputType OutputType;
70 
72  typedef typename Superclass::InputImageType InputImageType;
73 
75  typedef typename Superclass::InputPixelType InputPixelType;
76 
78  typedef typename Superclass::RealType RealType;
79 
81  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
82 
84  typedef typename Superclass::IndexType IndexType;
85  typedef typename Superclass::IndexValueType IndexValueType;
86  typedef typename Superclass::SizeType SizeType;
87 
89  typedef typename Superclass::PointType PointType;
90 
92  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
93  typedef TCoordRep ContinuousIndexValueType;
94 
96  typedef boost::container::small_vector<double, 7> CoefContainerType;
97 
99  virtual void SetRadius(unsigned int radius);
100  virtual SizeType GetRadius() const;
102 
104  virtual void SetAlpha(double alpha);
105  virtual double GetAlpha() const;
107 
116  OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override = 0;
117 
118 protected:
119  BCOInterpolateImageFunctionBase() : m_Radius(2), m_WinSize(5), m_Alpha(-0.5){};
121  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
123  CoefContainerType EvaluateCoef(const ContinuousIndexValueType& indexValue) const;
124 
126  unsigned int m_Radius;
127 
129  unsigned int m_WinSize;
130 
132  double m_Alpha;
133 
134 private:
136  void operator=(const Self&) = delete;
137 };
138 
139 
140 template <class TInputImage, class TCoordRep = double>
141 class ITK_EXPORT BCOInterpolateImageFunction : public otb::BCOInterpolateImageFunctionBase<TInputImage, TCoordRep>
142 {
143 public:
147  typedef itk::SmartPointer<Self> Pointer;
148  typedef itk::SmartPointer<const Self> ConstPointer;
149 
151  itkNewMacro(Self);
152  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
153 
157  typedef typename Superclass::RealType RealType;
163 
164  OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override;
165 
166 protected:
169  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
170 
171 private:
173  void operator=(const Self&) = delete;
174 };
175 
176 
177 template <typename TPixel, unsigned int VImageDimension, class TCoordRep>
178 class ITK_EXPORT BCOInterpolateImageFunction<otb::VectorImage<TPixel, VImageDimension>, TCoordRep>
179  : public otb::BCOInterpolateImageFunctionBase<otb::VectorImage<TPixel, VImageDimension>, TCoordRep>
180 {
181 public:
185  typedef itk::SmartPointer<Self> Pointer;
186  typedef itk::SmartPointer<const Self> ConstPointer;
187 
189  itkNewMacro(Self);
190  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
191 
195  typedef typename Superclass::RealType RealType;
199  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
201 
202  OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override;
203 
204 protected:
207  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
208 
209 private:
211  void operator=(const Self&) = delete;
212 };
213 
214 } // end namespace otb
215 
216 #ifndef OTB_MANUAL_INSTANTIATION
218 #endif
219 
220 #endif
void operator=(const Self &)=delete
Superclass::ContinuousIndexType ContinuousIndexType
BCOInterpolateImageFunctionBase(const Self &)=delete
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override=0
boost::container::small_vector< double, 7 > CoefContainerType
itk::InterpolateImageFunction< TInputImage, TCoordRep > Superclass
BCOInterpolateImageFunctionBase< otb::VectorImage< TPixel, VImageDimension >, TCoordRep > Superclass
Interpolate an image at specified positions using bicubic interpolation.
Superclass::ContinuousIndexType ContinuousIndexType
void operator=(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
Superclass::CoefContainerType CoefContainerType
BCOInterpolateImageFunction(const Self &)=delete
BCOInterpolateImageFunctionBase< TInputImage, TCoordRep > Superclass
Creation of an "otb" vector image which contains metadata.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.