OTB  7.2.0
Orfeo Toolbox
otbGenericRSTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 <string>
26 
27 namespace otb
28 {
29 namespace Projection
30 {
32 {
36 };
37 }
53 template <class TScalarType = double, unsigned int NInputDimensions = 2,
54  unsigned int NOutputDimensions = 2>
55 class ITK_EXPORT GenericRSTransform : public otb::Transform<TScalarType, // Data type for scalars
56  NInputDimensions, // Number of dimensions in the input space
57  NOutputDimensions> // Number of dimensions in the output space
58 {
59 public:
64  typedef itk::SmartPointer<Self> Pointer;
65  typedef itk::SmartPointer<const Self> ConstPointer;
67 
70  typedef itk::Point<ScalarType, NInputDimensions> InputPointType;
71  typedef itk::Point<ScalarType, NOutputDimensions> OutputPointType;
72 
73  typedef itk::Vector<double, 2> SpacingType;
74  typedef itk::Point<double, 2> OriginType;
75 
76  typedef itk::Transform<double, NInputDimensions, NOutputDimensions> GenericTransformType;
77  typedef typename GenericTransformType::Pointer GenericTransformPointerType;
80 
82 
84  itkNewMacro(Self);
85 
87  itkTypeMacro(GenericRSTransform, Transform);
88 
90 
91  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
92  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
93  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
94  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions*(NInputDimensions + 1));
95 
97  itkSetStringMacro(InputProjectionRef);
98  itkGetStringMacro(InputProjectionRef);
100 
101  itkSetStringMacro(OutputProjectionRef);
102  itkGetStringMacro(OutputProjectionRef);
103 
107  const itk::MetaDataDictionary& GetInputDictionary() const
108  {
109  return m_InputDictionary;
110  }
111 
112  void SetInputDictionary(const itk::MetaDataDictionary& dictionary)
113  {
114  m_InputDictionary = dictionary;
115  this->Modified();
116  }
117 
118  const itk::MetaDataDictionary& GetOutputDictionary() const
119  {
120  return m_OutputDictionary;
121  }
122 
123  void SetOutputDictionary(const itk::MetaDataDictionary& dictionary)
124  {
125  m_OutputDictionary = dictionary;
126  this->Modified();
127  }
128 
133  itkGetMacro(InputKeywordList, ImageKeywordlist);
135  {
136  this->m_InputKeywordList = kwl;
137  this->Modified();
138  }
139 
140  itkGetMacro(OutputKeywordList, ImageKeywordlist);
142  {
143  this->m_OutputKeywordList = kwl;
144  this->Modified();
145  }
146 
149  itkSetMacro(InputOrigin, OriginType);
150  itkGetConstReferenceMacro(InputOrigin, OriginType);
152 
155  itkSetMacro(InputSpacing, SpacingType);
156  itkGetConstReferenceMacro(InputSpacing, SpacingType);
158 
161  itkSetMacro(OutputOrigin, OriginType);
162  itkGetConstReferenceMacro(OutputOrigin, OriginType);
164 
167  itkSetMacro(OutputSpacing, SpacingType);
168  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
170 
172  virtual bool IsUpToDate()
173  {
174  return m_TransformUpToDate;
175  }
176 
179 
181  virtual const TransformType* GetTransform() const;
182 
183  OutputPointType TransformPoint(const InputPointType& point) const override;
184 
185  virtual void InstantiateTransform();
186 
187  // Get inverse methods
188  bool GetInverse(Self* inverseTransform) const;
189  InverseTransformBasePointer GetInverseTransform() const override;
190 
191  // Dummy set parameter method
192  void SetParameters(const typename Superclass::ParametersType&) override
193  {
194  }
195 
196  // Dummy ComputeJacobianWithRespectToParameters method
197  void ComputeJacobianWithRespectToParameters(const InputPointType&, JacobianType&) const override
198  {
199  }
200 
201 protected:
204  {
205  }
206 
207  void Modified() const override
208  {
209  this->Superclass::Modified();
210  m_TransformUpToDate = false;
211  }
212 
213  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
214 
215 private:
216  GenericRSTransform(const Self&) = delete;
217  void operator=(const Self&) = delete;
218 
221 
222  itk::MetaDataDictionary m_InputDictionary;
223  itk::MetaDataDictionary m_OutputDictionary;
224 
225  std::string m_InputProjectionRef;
227 
228  SpacingType m_InputSpacing;
229  OriginType m_InputOrigin;
230  SpacingType m_OutputSpacing;
231  OriginType m_OutputOrigin;
232 
233  TransformPointerType m_Transform;
234 
235  GenericTransformPointerType m_InputTransform;
236  GenericTransformPointerType m_OutputTransform;
237  mutable bool m_TransformUpToDate;
239 };
240 
241 } // namespace otb
242 
243 #ifndef OTB_MANUAL_INSTANTIATION
244 #include "otbGenericRSTransform.hxx"
245 #endif
246 
247 #endif
itk::Array2D< double > JacobianType
Definition: otbTransform.h:79
itk::Transform< double, NInputDimensions, NOutputDimensions > GenericTransformType
Storage and conversion for OSSIM metadata.
itk::SmartPointer< Self > Pointer
TransformDirection::TransformationDirection DirectionOfMappingEnumType
void SetInputDictionary(const itk::MetaDataDictionary &dictionary)
void SetInputKeywordList(const ImageKeywordlist &kwl)
itk::MetaDataDictionary m_InputDictionary
ImageKeywordlist m_OutputKeywordList
TransformType::Pointer TransformPointerType
void SetOutputKeywordList(const ImageKeywordlist &kwl)
itk::MetaDataDictionary m_OutputDictionary
void SetOutputDictionary(const itk::MetaDataDictionary &dictionary)
const itk::MetaDataDictionary & GetInputDictionary() const
TransformPointerType m_Transform
GenericTransformPointerType m_InputTransform
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Superclass::ParametersType ParametersType
Definition: otbTransform.h:74
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override
void SetParameters(const typename Superclass::ParametersType &) override
itk::Point< ScalarType, NOutputDimensions > OutputPointType
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
const itk::MetaDataDictionary & GetOutputDictionary() const
itk::Vector< double, 2 > SpacingType
otb::CompositeTransform< GenericTransformType, GenericTransformType > TransformType
GenericTransformPointerType m_OutputTransform
GenericTransformType::Pointer GenericTransformPointerType
otb::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
This is the class to handle generic remote sensing transform.
void Modified() const override
Superclass::ScalarType ScalarType
itk::Point< double, 2 > OriginType
Superclass::JacobianType JacobianType
itk::Point< ScalarType, NInputDimensions > InputPointType
ImageKeywordlist m_InputKeywordList
TScalarType ScalarType
Definition: otbTransform.h:71
Projection::TransformAccuracy m_TransformAccuracy
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:101
Class which compose two itk::Transform to obtain one itk::Transform T1 T2 T3 (x, y) -> (x&#39;...
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:39