OTB  6.1.0
Orfeo Toolbox
otbTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 otbTransform_h
22 #define otbTransform_h
23 
24 #include "itkTransform.h"
25 #include "vnl/vnl_vector_fixed.h"
26 
27 
28 namespace otb
29 {
37 template< class TScalarType,
38  unsigned int NInputDimensions = 3,
39  unsigned int NOutputDimensions = 3 >
40 class ITK_EXPORT Transform : public itk::Transform<TScalarType, // Data type for scalars
41  NInputDimensions, // Number of dimensions in the input space
42  NOutputDimensions> // Number of dimensions in the output space
43 {
44 public:
46  typedef Transform Self;
47  typedef itk::Transform<TScalarType,
48  NInputDimensions,
49  NOutputDimensions> Superclass;
52 
54  itkTypeMacro(Transform, itk::Transform);
55 
57  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
58  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
60 
62  unsigned int GetInputSpaceDimension(void) const ITK_OVERRIDE { return NInputDimensions; }
63 
65  unsigned int GetOutputSpaceDimension(void) const ITK_OVERRIDE { return NOutputDimensions; }
66 
68  typedef TScalarType ScalarType;
69 
72  typedef typename Superclass::ParametersValueType ParametersValueType;
73  typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
74 
77 
81 
85 
87  typedef vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType;
88  typedef vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType;
89 
93 
96  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
97 
98  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;
99 
102  OutputPointType TransformPoint(const InputPointType & ) const ITK_OVERRIDE
103  { return OutputPointType(); }
104 
105  using Superclass::TransformVector;
108  { return OutputVectorType(); }
109 
112  { return OutputVnlVectorType(); }
113 
114  using Superclass::TransformCovariantVector;
117  const InputCovariantVectorType &) const ITK_OVERRIDE
118  { return OutputCovariantVectorType(); }
119 
120 
128  void SetParameters( const ParametersType & ) ITK_OVERRIDE
129  { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetParameters)" ) }
130 
132  {
133  itkExceptionMacro(<< "Subclasses should ITK_OVERRIDE this method (ComputeJacobianWithRespectToParameters)" );
134  }
135 
143  void SetParametersByValue(const ParametersType & p) ITK_OVERRIDE
144  { this->SetParameters (p); }
145 
147  const ParametersType & GetParameters(void) const ITK_OVERRIDE
148  {
149  return m_Parameters;
150  }
151 
153  void SetFixedParameters( const ParametersType & ) ITK_OVERRIDE
154  { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetFixedParameters)" ) }
155 
157  const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE
158  {
159  itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (GetFixedParameters)" );
160  // Next line is needed to avoid errors due to:
161  // "function must return a value".
162  return this->m_FixedParameters;
163  }
165 
193  virtual const JacobianType & GetJacobian(const InputPointType &) const
194  {
195  itkExceptionMacro( << "Subclass should ITK_OVERRIDE this method (GetJacobian)" );
196  // Next line is needed to avoid errors due to:
197  // "function must return a value" .
198  return this->m_Jacobian;
199  }
201 
204  { return this->m_Parameters.Size(); }
205 
206 protected:
208  {}
209 
210  Transform(NumberOfParametersType numberOfParameters)
211  : Superclass::Transform(numberOfParameters)
212  {}
213 
214  ~Transform() ITK_OVERRIDE {}
215 
216  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE
217  {
218  Superclass::PrintSelf(os, indent);
219 #if 0
220  os << indent << "Parameters : " << m_Parameters << std::endl;
221  os << indent << "FixedParameters : " << m_FixedParameters << std::endl;
222  os << indent << "Jacobian : " << m_Jacobian << std::endl;
223 #endif
224  }
225 
226 
229 
231 private:
232  Transform(const Self &); //purposely not implemented
233  void operator=(const Self &); //purposely not implemented
234 };
235 } // end namespace otb
236 
237 #endif
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const ITK_OVERRIDE
Definition: otbTransform.h:116
itk::Point< TScalarType, NInputDimensions > InputPointType
Definition: otbTransform.h:91
ParametersType m_FixedParameters
Definition: otbTransform.h:228
unsigned int GetInputSpaceDimension(void) const ITK_OVERRIDE
Definition: otbTransform.h:62
IdentifierType NumberOfParametersType
itk::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Definition: otbTransform.h:49
itk::CovariantVector< TScalarType, NInputDimensions > InputCovariantVectorType
Definition: otbTransform.h:83
~Transform() ITK_OVERRIDE
Definition: otbTransform.h:214
itk::Array2D< double > JacobianType
Definition: otbTransform.h:76
void SetParametersByValue(const ParametersType &p) ITK_OVERRIDE
Definition: otbTransform.h:143
vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType
itk::Vector< TScalarType, NOutputDimensions > OutputVectorType
Definition: otbTransform.h:80
void SetFixedParameters(const ParametersType &) ITK_OVERRIDE
Definition: otbTransform.h:153
JacobianType m_Jacobian
Definition: otbTransform.h:230
void SetParameters(const ParametersType &) ITK_OVERRIDE
Definition: otbTransform.h:128
const ParametersType & GetFixedParameters(void) const ITK_OVERRIDE
Definition: otbTransform.h:157
Transform(NumberOfParametersType numberOfParameters)
Definition: otbTransform.h:210
itk::Point< TScalarType, NOutputDimensions > OutputPointType
Definition: otbTransform.h:92
itk::SmartPointer< const Self > ConstPointer
Definition: otbTransform.h:51
unsigned int GetOutputSpaceDimension(void) const ITK_OVERRIDE
Definition: otbTransform.h:65
OutputPointType TransformPoint(const InputPointType &) const ITK_OVERRIDE
Definition: otbTransform.h:102
virtual OutputVnlVectorType TransforVector(const InputVnlVectorType &) const
Definition: otbTransform.h:111
Superclass::ParametersType ParametersType
Definition: otbTransform.h:71
vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType
Definition: otbTransform.h:88
itk::Array< double > ParametersType
Definition: mvdTypes.h:131
itk::Vector< TScalarType, NInputDimensions > InputVectorType
Definition: otbTransform.h:79
OutputVectorType TransformVector(const InputVectorType &) const ITK_OVERRIDE
Definition: otbTransform.h:107
void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE
Definition: otbTransform.h:216
Superclass::NumberOfParametersType NumberOfParametersType
Definition: otbTransform.h:73
vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType
virtual const JacobianType & GetJacobian(const InputPointType &) const
Definition: otbTransform.h:193
Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: otbTransform.h:96
itk::SmartPointer< Self > Pointer
Definition: otbTransform.h:50
ParametersType m_Parameters
Definition: otbTransform.h:227
vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType
Definition: otbTransform.h:87
Superclass::ParametersValueType ParametersValueType
Definition: otbTransform.h:72
const ParametersType & GetParameters(void) const ITK_OVERRIDE
Definition: otbTransform.h:147
itk::CovariantVector< TScalarType, NOutputDimensions > OutputCovariantVectorType
Definition: otbTransform.h:84
NumberOfParametersType GetNumberOfParameters(void) const ITK_OVERRIDE
Definition: otbTransform.h:203
TScalarType ScalarType
Definition: otbTransform.h:68
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const ITK_OVERRIDE
Definition: otbTransform.h:131
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:98
Transform Self
Definition: otbTransform.h:46
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:40