OTB  6.7.0
Orfeo Toolbox
otbGroundSpacingImageFunction.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 otbGroundSpacingImageFunction_h
22 #define otbGroundSpacingImageFunction_h
23 
24 #include "itkImageFunction.h"
25 #include "itkNumericTraits.h"
26 
27 #include "otbGenericRSTransform.h"
28 
29 namespace otb
30 {
31 
44 template <class TInputImage, class TCoordRep = float>
45 class ITK_EXPORT GroundSpacingImageFunction :
46  public itk::ImageFunction<TInputImage, itk::Vector<float, 2>,
47  TCoordRep>
48 {
49 public:
50 
53 
55  typedef float ValueType;
56  //typedef std::pair<ValueType, ValueType> FloatType;
58 
59  typedef itk::ImageFunction<TInputImage, FloatType ,
60  TCoordRep> Superclass;
61 
64 
67 
69  itkNewMacro(Self);
70 
72  typedef TInputImage InputImageType;
73  typedef typename Superclass::OutputType OutputType;
74  typedef typename Superclass::IndexType IndexType;
75  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
76  typedef typename Superclass::PointType PointType;
77 
79 
80  typedef typename IndexType::IndexValueType IndexValueType;
81 
82  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
83 
85  FloatType EvaluateAtIndex(const IndexType& index) const override;
86 
88  FloatType Evaluate(const PointType& point) const override
89  {
90  IndexType index;
91  this->ConvertPointToNearestIndex(point, index);
92  return this->EvaluateAtIndex(index);
93  }
95 
97  const ContinuousIndexType& cindex) const override
98  {
99  IndexType index;
100  this->ConvertContinuousIndexToNearestIndex(cindex, index);
101  return this->EvaluateAtIndex(index);
102  }
103 
104  PointType GetPixelLocation(const IndexType& index) const;
105 
106 protected:
109  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
110 
111 private:
112  GroundSpacingImageFunction(const Self &) = delete;
113  void operator =(const Self&) = delete;
114 
117 };
118 
119 } // end namespace otb
120 
121 #ifndef OTB_MANUAL_INSTANTIATION
123 #endif
124 
125 #endif
otb::GenericRSTransform< double > TransformType
itk::ImageFunction< TInputImage, FloatType, TCoordRep > Superclass
Calculate the approximate ground spacing in X and Y directions.
Superclass::ContinuousIndexType ContinuousIndexType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
itk::SmartPointer< const Self > ConstPointer
FloatType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
This is the class to handle generic remote sensing transform.
FloatType Evaluate(const PointType &point) const override
VectorImageType::PointType PointType
Definition: mvdTypes.h:189