OTB  10.0.0
Orfeo Toolbox
otbGenericRSTransform.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 otbGenericRSTransform_h
22 #define otbGenericRSTransform_h
23 
24 #include "otbCompositeTransform.h"
25 #include "otbImageMetadata.h"
27 #include <string>
28 
29 namespace otb
30 {
31 namespace Projection
32 {
34 {
37  PRECISE
38 };
39 }
55 template <class TScalarType = double, unsigned int NInputDimensions = 2,
56  unsigned int NOutputDimensions = 2>
57 class ITK_EXPORT GenericRSTransform : public otb::Transform<TScalarType, // Data type for scalars
58  NInputDimensions, // Number of dimensions in the input space
59  NOutputDimensions> // Number of dimensions in the output space
60 {
61 public:
66  typedef itk::SmartPointer<Self> Pointer;
67  typedef itk::SmartPointer<const Self> ConstPointer;
69 
72  typedef itk::Point<ScalarType, NInputDimensions> InputPointType;
73  typedef itk::Point<ScalarType, NOutputDimensions> OutputPointType;
74 
75  typedef itk::Vector<double, 2> SpacingType;
76  typedef itk::Point<double, 2> OriginType;
77 
78  typedef itk::Transform<double, NInputDimensions, NOutputDimensions> GenericTransformType;
79  typedef typename GenericTransformType::Pointer GenericTransformPointerType;
82 
84 
86  itkNewMacro(Self);
87 
89  itkTypeMacro(GenericRSTransform, Transform);
90 
92 
93  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
94  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
95  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
96  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions*(NInputDimensions + 1));
97 
99  itkSetStringMacro(InputProjectionRef);
100  itkGetStringMacro(InputProjectionRef);
102 
103  itkSetStringMacro(OutputProjectionRef);
104  itkGetStringMacro(OutputProjectionRef);
105 
108  {
109  return m_InputImd;
110  }
111 
113  {
114  m_InputImd = imd;
115  this->Modified();
116  }
117 
119  {
120  return m_OutputImd;
121  }
122 
124  {
125  m_OutputImd = imd;
126  this->Modified();
127  }
128 
131  itkSetMacro(InputOrigin, OriginType);
132  itkGetConstReferenceMacro(InputOrigin, OriginType);
134 
137  itkSetMacro(InputSpacing, SpacingType);
138  itkGetConstReferenceMacro(InputSpacing, SpacingType);
140 
143  itkSetMacro(OutputOrigin, OriginType);
144  itkGetConstReferenceMacro(OutputOrigin, OriginType);
146 
149  itkSetMacro(OutputSpacing, SpacingType);
150  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
152 
154  virtual bool IsUpToDate()
155  {
156  return m_TransformUpToDate;
157  }
158 
161 
163  virtual const TransformType* GetTransform() const;
164 
165  OutputPointType TransformPoint(const InputPointType& point) const override;
166 
167  virtual void InstantiateTransform();
168 
169  // Get inverse methods
170  bool GetInverse(Self* inverseTransform) const;
172 
173  // Dummy set parameter method
174  void SetParameters(const typename Superclass::ParametersType&) override
175  {
176  }
177 
178  // Dummy ComputeJacobianWithRespectToParameters method
180  {
181  }
182 
183 protected:
186  {
187  // SensorTransformFactory<TScalarType, NInputDimensions, NOutputDimensions>::CleanFactories();
188  }
189 
190  void Modified() const override
191  {
192  this->Superclass::Modified();
193  m_TransformUpToDate = false;
194  }
195 
196  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
197 
198 private:
199  GenericRSTransform(const Self&) = delete;
200  void operator=(const Self&) = delete;
201 
204 
205  std::string m_InputProjectionRef;
207 
212 
214 
217  mutable bool m_TransformUpToDate;
219 };
220 
221 } // namespace otb
222 
223 #ifndef OTB_MANUAL_INSTANTIATION
224 #include "otbGenericRSTransform.hxx"
225 #endif
226 
227 #endif
Class which compose two itk::Transform to obtain one itk::Transform T1 T2 T3 (x, y) -> (x',...
itk::SmartPointer< Self > Pointer
This is the class to handle generic remote sensing transform.
void operator=(const Self &)=delete
itk::Point< ScalarType, NOutputDimensions > OutputPointType
itk::SmartPointer< const Self > ConstPointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
OutputPointType TransformPoint(const InputPointType &point) const override
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Projection::TransformAccuracy m_TransformAccuracy
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override
void Modified() const override
void SetOutputImageMetadata(const ImageMetadata *imd)
const ImageMetadata * GetOutputImageMetadata() const
GenericTransformType::Pointer GenericTransformPointerType
GenericRSTransform(const Self &)=delete
itk::Transform< double, NInputDimensions, NOutputDimensions > GenericTransformType
const ImageMetadata * m_InputImd
TransformType::Pointer TransformPointerType
const ImageMetadata * GetInputImageMetadata() const
const ImageMetadata * m_OutputImd
void SetInputImageMetadata(const ImageMetadata *imd)
TransformPointerType m_Transform
virtual const TransformType * GetTransform() const
otb::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
TransformDirection DirectionOfMappingEnumType
Superclass::ScalarType ScalarType
itk::Point< double, 2 > OriginType
itk::SmartPointer< Self > Pointer
GenericTransformPointerType m_InputTransform
Superclass::JacobianType JacobianType
itk::Vector< double, 2 > SpacingType
virtual void InstantiateTransform()
GenericTransformPointerType m_OutputTransform
void SetParameters(const typename Superclass::ParametersType &) override
otb::CompositeTransform< GenericTransformType, GenericTransformType > TransformType
bool GetInverse(Self *inverseTransform) const
InverseTransformBasePointer GetInverseTransform() const override
itk::Point< ScalarType, NInputDimensions > InputPointType
Generic class containing image metadata used in OTB.
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:42
TScalarType ScalarType
Definition: otbTransform.h:71
itk::Array2D< double > JacobianType
Definition: otbTransform.h:79
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:101
Superclass::ParametersType ParametersType
Definition: otbTransform.h:74
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.