OTB  10.0.0
Orfeo Toolbox
otbGroundSpacingImageFunction.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 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 : public itk::ImageFunction<TInputImage, itk::Vector<float, 2>, TCoordRep>
46 {
47 public:
48 
51 
53  typedef float ValueType;
54  // typedef std::pair<ValueType, ValueType> FloatType;
55  typedef itk::Vector<ValueType, 2> FloatType;
56 
57  typedef itk::ImageFunction<TInputImage, FloatType, TCoordRep> Superclass;
58 
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  itkTypeMacro(GroundSpacingImageFunction, itk::ImageFunction);
64 
66  itkNewMacro(Self);
67 
69  typedef TInputImage InputImageType;
70  typedef typename Superclass::OutputType OutputType;
71  typedef typename Superclass::IndexType IndexType;
72  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
73  typedef typename Superclass::PointType PointType;
74 
76 
77  typedef typename IndexType::IndexValueType IndexValueType;
78 
79  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
80 
82  FloatType EvaluateAtIndex(const IndexType& index) const override;
83 
85  FloatType Evaluate(const PointType& point) const override
86  {
87  IndexType index;
88  this->ConvertPointToNearestIndex(point, index);
89  return this->EvaluateAtIndex(index);
90  }
92 
94  {
95  IndexType index;
96  this->ConvertContinuousIndexToNearestIndex(cindex, index);
97  return this->EvaluateAtIndex(index);
98  }
99 
100  PointType GetPixelLocation(const IndexType& index) const;
101 
102 protected:
105  {
106  }
107  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
108 
109 private:
111  void operator=(const Self&) = delete;
112 
115 };
116 
117 } // end namespace otb
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
121 #endif
122 
123 #endif
This is the class to handle generic remote sensing transform.
Calculate the approximate ground spacing in X and Y directions.
itk::SmartPointer< const Self > ConstPointer
FloatType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
void operator=(const Self &)=delete
otb::GenericRSTransform< double > TransformType
itk::ImageFunction< TInputImage, FloatType, TCoordRep > Superclass
GroundSpacingImageFunction(const Self &)=delete
Superclass::ContinuousIndexType ContinuousIndexType
FloatType Evaluate(const PointType &point) const override
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.