OTB  9.0.0
Orfeo Toolbox
otbGenericRSTransform.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 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 {
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;
171  InverseTransformBasePointer GetInverseTransform() const override;
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
otb::GenericRSTransform::m_OutputProjectionRef
std::string m_OutputProjectionRef
Definition: otbGenericRSTransform.h:206
otb::GenericRSTransform::m_InputSpacing
SpacingType m_InputSpacing
Definition: otbGenericRSTransform.h:208
otb::GenericRSTransform::DirectionOfMappingEnumType
TransformDirection DirectionOfMappingEnumType
Definition: otbGenericRSTransform.h:89
otb::GenericRSTransform::Self
GenericRSTransform Self
Definition: otbGenericRSTransform.h:65
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::GenericRSTransform::m_InputProjectionRef
std::string m_InputProjectionRef
Definition: otbGenericRSTransform.h:205
otb::GenericRSTransform::TransformPointerType
TransformType::Pointer TransformPointerType
Definition: otbGenericRSTransform.h:81
otb::GenericRSTransform::GetInputImageMetadata
const ImageMetadata * GetInputImageMetadata() const
Definition: otbGenericRSTransform.h:107
otb::Transform< double, 2, 2 >::TransformDirection
TransformDirection
Definition: otbPCAImageFilter.h:34
otb::GenericRSTransform::SetOutputImageMetadata
void SetOutputImageMetadata(const ImageMetadata *imd)
Definition: otbGenericRSTransform.h:123
otb::GenericRSTransform::TransformType
otb::CompositeTransform< GenericTransformType, GenericTransformType > TransformType
Definition: otbGenericRSTransform.h:80
otb::Projection::TransformAccuracy
TransformAccuracy
Definition: otbGenericRSTransform.h:33
otb::GenericRSTransform::InverseTransformBasePointer
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbGenericRSTransform.h:83
otb::CompositeTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbCompositeTransform.h:65
otb::Projection::UNKNOWN
@ UNKNOWN
Definition: otbGenericRSTransform.h:35
otb::GenericRSTransform::IsUpToDate
virtual bool IsUpToDate()
Definition: otbGenericRSTransform.h:154
otb::Transform::ScalarType
TScalarType ScalarType
Definition: otbTransform.h:71
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbSensorTransformFactory.h
otb::Transform::InverseTransformBasePointer
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:101
otb::GenericRSTransform::m_InputOrigin
OriginType m_InputOrigin
Definition: otbGenericRSTransform.h:209
otb::GenericRSTransform::m_TransformAccuracy
Projection::TransformAccuracy m_TransformAccuracy
Definition: otbGenericRSTransform.h:218
otb::GenericRSTransform::OutputPointType
itk::Point< ScalarType, NOutputDimensions > OutputPointType
Definition: otbGenericRSTransform.h:73
otb::GenericRSTransform::ScalarType
Superclass::ScalarType ScalarType
Definition: otbGenericRSTransform.h:70
otb::GenericRSTransform::GenericTransformPointerType
GenericTransformType::Pointer GenericTransformPointerType
Definition: otbGenericRSTransform.h:79
otb::GenericRSTransform::GenericTransformType
itk::Transform< double, NInputDimensions, NOutputDimensions > GenericTransformType
Definition: otbGenericRSTransform.h:78
otb::GenericRSTransform::SpacingType
itk::Vector< double, 2 > SpacingType
Definition: otbGenericRSTransform.h:75
otb::Transform::JacobianType
itk::Array2D< double > JacobianType
Definition: otbTransform.h:79
otb::Projection::PRECISE
@ PRECISE
Definition: otbGenericRSTransform.h:37
otb::GenericRSTransform::Superclass
otb::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Definition: otbGenericRSTransform.h:64
otb::GenericRSTransform::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGenericRSTransform.h:67
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::GenericRSTransform::GetOutputImageMetadata
const ImageMetadata * GetOutputImageMetadata() const
Definition: otbGenericRSTransform.h:118
otb::GenericRSTransform::OriginType
itk::Point< double, 2 > OriginType
Definition: otbGenericRSTransform.h:76
otb::Transform
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:39
otb::GenericRSTransform::m_OutputImd
const ImageMetadata * m_OutputImd
Definition: otbGenericRSTransform.h:203
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otbGenericRSTransform.hxx
otb::GenericRSTransform::m_InputTransform
GenericTransformPointerType m_InputTransform
Definition: otbGenericRSTransform.h:215
otb::GenericRSTransform::Modified
void Modified() const override
Definition: otbGenericRSTransform.h:190
otb::GenericRSTransform::m_OutputSpacing
SpacingType m_OutputSpacing
Definition: otbGenericRSTransform.h:210
otb::CompositeTransform
Class which compose two itk::Transform to obtain one itk::Transform T1 T2 T3 (x, y) -> (x',...
Definition: otbCompositeTransform.h:57
otb::GenericRSTransform::JacobianType
Superclass::JacobianType JacobianType
Definition: otbGenericRSTransform.h:71
otb::Transform
Definition: otbPCAImageFilter.h:32
otb::GenericRSTransform::ComputeJacobianWithRespectToParameters
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override
Definition: otbGenericRSTransform.h:179
otb::GenericRSTransform::SetInputImageMetadata
void SetInputImageMetadata(const ImageMetadata *imd)
Definition: otbGenericRSTransform.h:112
otb::GenericRSTransform::m_Transform
TransformPointerType m_Transform
Definition: otbGenericRSTransform.h:213
otb::GenericRSTransform::SetParameters
void SetParameters(const typename Superclass::ParametersType &) override
Definition: otbGenericRSTransform.h:174
otb::GenericRSTransform::m_TransformUpToDate
bool m_TransformUpToDate
Definition: otbGenericRSTransform.h:217
otb::GenericRSTransform::~GenericRSTransform
~GenericRSTransform() override
Definition: otbGenericRSTransform.h:185
otb::GenericRSTransform::m_OutputOrigin
OriginType m_OutputOrigin
Definition: otbGenericRSTransform.h:211
otbCompositeTransform.h
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::GenericRSTransform::m_OutputTransform
GenericTransformPointerType m_OutputTransform
Definition: otbGenericRSTransform.h:216
otb::Transform::ParametersType
Superclass::ParametersType ParametersType
Definition: otbTransform.h:74
otbImageMetadata.h
otb::GenericRSTransform::m_InputImd
const ImageMetadata * m_InputImd
Definition: otbGenericRSTransform.h:202
otb::Projection::ESTIMATE
@ ESTIMATE
Definition: otbGenericRSTransform.h:36