OTB  9.0.0
Orfeo Toolbox
otbGroundSpacingImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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:
110  GroundSpacingImageFunction(const Self&) = delete;
111  void operator=(const Self&) = delete;
112 
115 };
116 
117 } // end namespace otb
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
121 #endif
122 
123 #endif
otb::GroundSpacingImageFunction::FloatType
itk::Vector< ValueType, 2 > FloatType
Definition: otbGroundSpacingImageFunction.h:55
otb::GroundSpacingImageFunction::OutputType
Superclass::OutputType OutputType
Definition: otbGroundSpacingImageFunction.h:70
otb::GroundSpacingImageFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGroundSpacingImageFunction.h:60
otb::GroundSpacingImageFunction::ContinuousIndexType
Superclass::ContinuousIndexType ContinuousIndexType
Definition: otbGroundSpacingImageFunction.h:72
otb::GroundSpacingImageFunction::ValueType
float ValueType
Definition: otbGroundSpacingImageFunction.h:53
otb::GroundSpacingImageFunction::EvaluateAtContinuousIndex
FloatType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
Definition: otbGroundSpacingImageFunction.h:93
otb::GroundSpacingImageFunction::Evaluate
FloatType Evaluate(const PointType &point) const override
Definition: otbGroundSpacingImageFunction.h:85
otb::GroundSpacingImageFunction::PointType
Superclass::PointType PointType
Definition: otbGroundSpacingImageFunction.h:73
otb::GroundSpacingImageFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGroundSpacingImageFunction.h:59
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GroundSpacingImageFunction::Self
GroundSpacingImageFunction Self
Definition: otbGroundSpacingImageFunction.h:50
otb::GroundSpacingImageFunction::m_R
ValueType m_R
Definition: otbGroundSpacingImageFunction.h:113
otbGroundSpacingImageFunction.hxx
otb::GroundSpacingImageFunction::m_Deg2radCoef
ValueType m_Deg2radCoef
Definition: otbGroundSpacingImageFunction.h:114
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::GroundSpacingImageFunction
Calculate the approximate ground spacing in X and Y directions.
Definition: otbGroundSpacingImageFunction.h:45
otb::GroundSpacingImageFunction::~GroundSpacingImageFunction
~GroundSpacingImageFunction() override
Definition: otbGroundSpacingImageFunction.h:104
otbGenericRSTransform.h
otb::GroundSpacingImageFunction::IndexValueType
IndexType::IndexValueType IndexValueType
Definition: otbGroundSpacingImageFunction.h:77
otb::GroundSpacingImageFunction::IndexType
Superclass::IndexType IndexType
Definition: otbGroundSpacingImageFunction.h:71
otb::GroundSpacingImageFunction::InputImageType
TInputImage InputImageType
Definition: otbGroundSpacingImageFunction.h:66
otb::GroundSpacingImageFunction::TransformType
otb::GenericRSTransform< double > TransformType
Definition: otbGroundSpacingImageFunction.h:75
otb::GroundSpacingImageFunction::Superclass
itk::ImageFunction< TInputImage, FloatType, TCoordRep > Superclass
Definition: otbGroundSpacingImageFunction.h:57