OTB  6.7.0
Orfeo Toolbox
otbBCOInterpolateImageFunction.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 otbBCOInterpolateImageFunction_h
22 #define otbBCOInterpolateImageFunction_h
23 
25 #include "vnl/vnl_vector.h"
26 #include "otbMath.h"
27 
28 #include "otbVectorImage.h"
29 
30 namespace otb
31 {
55 template< class TInputImage, class TCoordRep = double >
57  public itk::InterpolateImageFunction<TInputImage, TCoordRep>
58 {
59 public:
63 
65  itkTypeMacro(BCOInterpolateImageFunctionBase, InterpolateImageFunction);
66 
68  typedef typename Superclass::OutputType OutputType;
69 
71  typedef typename Superclass::InputImageType InputImageType;
72 
74  typedef typename Superclass::InputPixelType InputPixelType;
75 
77  typedef typename Superclass::RealType RealType;
78 
80  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
81 
83  typedef typename Superclass::IndexType IndexType;
84  typedef typename Superclass::IndexValueType IndexValueType;
85 
87  typedef typename Superclass::PointType PointType;
88 
90  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
91  typedef TCoordRep ContinuousIndexValueType;
92 
94  typedef vnl_vector<double> CoefContainerType;
95 
97  virtual void SetRadius(unsigned int radius);
98  virtual unsigned int GetRadius() const;
100 
102  virtual void SetAlpha(double alpha);
103  virtual double GetAlpha() const;
105 
114  OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const override = 0;
115 
116 protected:
117  BCOInterpolateImageFunctionBase() : m_Radius(2), m_WinSize(5), m_Alpha(-0.5) {};
119  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
121  virtual CoefContainerType EvaluateCoef( const ContinuousIndexValueType & indexValue ) const;
122 
124  unsigned int m_Radius;
125 
127  unsigned int m_WinSize;
128 
130  double m_Alpha;
131 
132 private:
133  BCOInterpolateImageFunctionBase( const Self& ) = delete;
134  void operator=( const Self& ) = delete;
135 
136 };
137 
138 
139 template < class TInputImage, class TCoordRep = double >
140 class ITK_EXPORT BCOInterpolateImageFunction :
141  public otb::BCOInterpolateImageFunctionBase< TInputImage, TCoordRep >
142 {
143 public:
149 
151  itkNewMacro(Self);
152  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
153 
157  typedef typename Superclass::RealType RealType;
162  typedef typename Superclass::CoefContainerType CoefContainerType;
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:
172  BCOInterpolateImageFunction( const Self& ) = delete;
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:
188 
190  itkNewMacro(Self);
191  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
192 
193  typedef typename Superclass::OutputType OutputType;
194  typedef typename Superclass::InputImageType InputImageType;
195  typedef typename Superclass::InputPixelType InputPixelType;
196  typedef typename Superclass::RealType RealType;
198  typedef typename Superclass::IndexValueType IndexValueType;
200  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
201  typedef typename Superclass::CoefContainerType CoefContainerType;
202 
203  OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const override;
204 
205 protected:
208  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
209 
210 private:
211  BCOInterpolateImageFunction( const Self& ) = delete;
212  void operator=( const Self& ) = delete;
213 };
214 
215 } // end namespace otb
216 
217 #ifndef OTB_MANUAL_INSTANTIATION
219 #endif
220 
221 #endif
Creation of an "otb" vector image which contains metadata.
itk::InterpolateImageFunction< TInputImage, TCoordRep > Superclass
BCOInterpolateImageFunctionBase< TInputImage, TCoordRep > Superclass
Interpolate an image at specified positions using bicubic interpolation.
Superclass::ContinuousIndexType ContinuousIndexType
Superclass::OutputType OutputType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
Superclass::ContinuousIndexType ContinuousIndexType
BCOInterpolateImageFunctionBase< otb::VectorImage< TPixel, VImageDimension >, TCoordRep > Superclass
InputImageType::PixelType InputPixelType
InputImageType::IndexType IndexType
Monteverdi_FLOATING_TYPE RealType
Definition: mvdTypes.h:84
TInputImage InputImageType
Superclass::CoefContainerType CoefContainerType
itk::SmartPointer< const Self > ConstPointer
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
InputImageType::IndexValueType IndexValueType