Orfeo ToolBox  4.2
Orfeo ToolBox is not a black box
otbTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbTransform_h
19 #define __otbTransform_h
20 
21 #include "itkTransform.h"
22 #include "itkVector.h"
23 #include "vnl/vnl_vector_fixed.h"
24 
25 
26 namespace otb
27 {
33 template< class TScalarType,
34  unsigned int NInputDimensions = 3,
35  unsigned int NOutputDimensions = 3 >
36 class ITK_EXPORT Transform : public itk::Transform<TScalarType, // Data type for scalars
37  NInputDimensions, // Number of dimensions in the input space
38  NOutputDimensions> // Number of dimensions in the output space
39 {
40 public:
42  typedef Transform Self;
43  typedef itk::Transform<TScalarType,
44  NInputDimensions,
45  NOutputDimensions> Superclass;
48 
50  itkTypeMacro(Transform, itk::Transform);
51 
53  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
54  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
55 
57  unsigned int GetInputSpaceDimension(void) const { return NInputDimensions; }
58 
60  unsigned int GetOutputSpaceDimension(void) const { return NOutputDimensions; }
61 
63  typedef TScalarType ScalarType;
64 
66  typedef typename Superclass::ParametersType ParametersType;
67  typedef typename Superclass::ParametersValueType ParametersValueType;
68  typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
69 
72 
76 
80 
82  typedef vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType;
83  typedef vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType;
84 
88 
91  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
92 
93  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;
94 
97  { return OutputPointType(); }
98 
101  { return OutputVectorType(); }
102 
105  { return OutputVnlVectorType(); }
106 
109  const InputCovariantVectorType &) const
110  { return OutputCovariantVectorType(); }
111 
119  virtual void SetParameters( const ParametersType & )
120  { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) }
121 
123  {
124  itkExceptionMacro(<< "Subclasses should override this method (ComputeJacobianWithRespectToParamters)" );
125  }
126 
134  virtual void SetParametersByValue(const ParametersType & p)
135  { this->SetParameters (p); }
136 
138  virtual const ParametersType & GetParameters(void) const
139  {
140  return m_Parameters;
141  }
142 
144  virtual void SetFixedParameters( const ParametersType & )
145  { itkExceptionMacro( << "Subclasses should override this method (SetFixedParameters)" ) }
146 
148  virtual const ParametersType& GetFixedParameters(void) const
149  {
150  itkExceptionMacro( << "Subclasses should override this method (GetFixedParameters)" );
151  // Next line is needed to avoid errors due to:
152  // "function must return a value".
153  return this->m_FixedParameters;
154  }
155 
183  virtual const JacobianType & GetJacobian(const InputPointType &) const
184  {
185  itkExceptionMacro( << "Subclass should override this method (GetJacobian)" );
186  // Next line is needed to avoid errors due to:
187  // "function must return a value" .
188  return this->m_Jacobian;
189  }
190 
193  { return this->m_Parameters.Size(); }
194 
195 protected:
197  {}
198 
199  Transform(NumberOfParametersType numberOfParameters)
200  : Superclass::Transform(numberOfParameters)
201  {}
202 
203  virtual ~Transform() {}
204 
205  void PrintSelf(std::ostream& os, itk::Indent indent) const
206  {
207  Superclass::PrintSelf(os, indent);
208 #if 0
209  os << indent << "Parameters : " << m_Parameters << std::endl;
210  os << indent << "FixedParameters : " << m_FixedParameters << std::endl;
211  os << indent << "Jacobian : " << m_Jacobian << std::endl;
212 #endif
213  }
214 
215 
218 
220 private:
221  Transform(const Self &); //purposely not implemented
222  void operator=(const Self &); //purposely not implemented
223 };
224 } // end namespace otb
225 
226 #endif
void PrintSelf(std::ostream &os, itk::Indent indent) const
Definition: otbTransform.h:205
itk::Point< TScalarType, NInputDimensions > InputPointType
Definition: otbTransform.h:86
ParametersType m_FixedParameters
Definition: otbTransform.h:217
unsigned int GetOutputSpaceDimension(void) const
Definition: otbTransform.h:60
virtual const ParametersType & GetFixedParameters(void) const
Definition: otbTransform.h:148
itk::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Definition: otbTransform.h:45
virtual OutputVectorType TransformVector(const InputVectorType &) const
Definition: otbTransform.h:100
itk::CovariantVector< TScalarType, NInputDimensions > InputCovariantVectorType
Definition: otbTransform.h:78
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
Definition: otbTransform.h:104
itk::Array2D< double > JacobianType
Definition: otbTransform.h:71
itk::Vector< TScalarType, NOutputDimensions > OutputVectorType
Definition: otbTransform.h:75
JacobianType m_Jacobian
Definition: otbTransform.h:219
virtual const ParametersType & GetParameters(void) const
Definition: otbTransform.h:138
virtual ~Transform()
Definition: otbTransform.h:203
Transform(NumberOfParametersType numberOfParameters)
Definition: otbTransform.h:199
itk::Point< TScalarType, NOutputDimensions > OutputPointType
Definition: otbTransform.h:87
itk::SmartPointer< const Self > ConstPointer
Definition: otbTransform.h:47
virtual void SetParameters(const ParametersType &)
Definition: otbTransform.h:119
virtual void SetFixedParameters(const ParametersType &)
Definition: otbTransform.h:144
Superclass::ParametersType ParametersType
Definition: otbTransform.h:66
vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType
Definition: otbTransform.h:83
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const
Definition: otbTransform.h:122
itk::Vector< TScalarType, NInputDimensions > InputVectorType
Definition: otbTransform.h:74
Superclass::NumberOfParametersType NumberOfParametersType
Definition: otbTransform.h:68
virtual const JacobianType & GetJacobian(const InputPointType &) const
Definition: otbTransform.h:183
Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: otbTransform.h:91
virtual OutputPointType TransformPoint(const InputPointType &) const
Definition: otbTransform.h:96
virtual void SetParametersByValue(const ParametersType &p)
Definition: otbTransform.h:134
itk::SmartPointer< Self > Pointer
Definition: otbTransform.h:46
ParametersType m_Parameters
Definition: otbTransform.h:216
vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType
Definition: otbTransform.h:82
Superclass::ParametersValueType ParametersValueType
Definition: otbTransform.h:67
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Definition: otbTransform.h:108
itk::CovariantVector< TScalarType, NOutputDimensions > OutputCovariantVectorType
Definition: otbTransform.h:79
virtual NumberOfParametersType GetNumberOfParameters(void) const
Definition: otbTransform.h:192
TScalarType ScalarType
Definition: otbTransform.h:63
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:93
Transform Self
Definition: otbTransform.h:42
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:36
unsigned int GetInputSpaceDimension(void) const
Definition: otbTransform.h:57