OTB  5.0.0
Orfeo Toolbox
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 "vnl/vnl_vector_fixed.h"
23 
24 
25 namespace otb
26 {
34 template< class TScalarType,
35  unsigned int NInputDimensions = 3,
36  unsigned int NOutputDimensions = 3 >
37 class ITK_EXPORT Transform : public itk::Transform<TScalarType, // Data type for scalars
38  NInputDimensions, // Number of dimensions in the input space
39  NOutputDimensions> // Number of dimensions in the output space
40 {
41 public:
43  typedef Transform Self;
44  typedef itk::Transform<TScalarType,
45  NInputDimensions,
46  NOutputDimensions> Superclass;
49 
51  itkTypeMacro(Transform, itk::Transform);
52 
54  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
55  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
57 
59  unsigned int GetInputSpaceDimension(void) const { return NInputDimensions; }
60 
62  unsigned int GetOutputSpaceDimension(void) const { return NOutputDimensions; }
63 
65  typedef TScalarType ScalarType;
66 
68  typedef typename Superclass::ParametersType ParametersType;
69  typedef typename Superclass::ParametersValueType ParametersValueType;
70  typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
71 
74 
78 
82 
84  typedef vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType;
85  typedef vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType;
86 
90 
93  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
94 
95  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;
96 
100  { return OutputPointType(); }
101 
102  using Superclass::TransformVector;
105  { return OutputVectorType(); }
106 
109  { return OutputVnlVectorType(); }
110 
111  using Superclass::TransformCovariantVector;
114  const InputCovariantVectorType &) const
115  { return OutputCovariantVectorType(); }
116 
117 
125  virtual void SetParameters( const ParametersType & )
126  { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) }
127 
129  {
130  itkExceptionMacro(<< "Subclasses should override this method (ComputeJacobianWithRespectToParamters)" );
131  }
132 
140  virtual void SetParametersByValue(const ParametersType & p)
141  { this->SetParameters (p); }
142 
144  virtual const ParametersType & GetParameters(void) const
145  {
146  return m_Parameters;
147  }
148 
150  virtual void SetFixedParameters( const ParametersType & )
151  { itkExceptionMacro( << "Subclasses should override this method (SetFixedParameters)" ) }
152 
154  virtual const ParametersType& GetFixedParameters(void) const
155  {
156  itkExceptionMacro( << "Subclasses should override this method (GetFixedParameters)" );
157  // Next line is needed to avoid errors due to:
158  // "function must return a value".
159  return this->m_FixedParameters;
160  }
162 
190  virtual const JacobianType & GetJacobian(const InputPointType &) const
191  {
192  itkExceptionMacro( << "Subclass should override this method (GetJacobian)" );
193  // Next line is needed to avoid errors due to:
194  // "function must return a value" .
195  return this->m_Jacobian;
196  }
198 
201  { return this->m_Parameters.Size(); }
202 
203 protected:
205  {}
206 
207  Transform(NumberOfParametersType numberOfParameters)
208  : Superclass::Transform(numberOfParameters)
209  {}
210 
211  virtual ~Transform() {}
212 
213  void PrintSelf(std::ostream& os, itk::Indent indent) const
214  {
215  Superclass::PrintSelf(os, indent);
216 #if 0
217  os << indent << "Parameters : " << m_Parameters << std::endl;
218  os << indent << "FixedParameters : " << m_FixedParameters << std::endl;
219  os << indent << "Jacobian : " << m_Jacobian << std::endl;
220 #endif
221  }
222 
223 
226 
228 private:
229  Transform(const Self &); //purposely not implemented
230  void operator=(const Self &); //purposely not implemented
231 };
232 } // end namespace otb
233 
234 #endif
void PrintSelf(std::ostream &os, itk::Indent indent) const
Definition: otbTransform.h:213
itk::Point< TScalarType, NInputDimensions > InputPointType
Definition: otbTransform.h:88
ParametersType m_FixedParameters
Definition: otbTransform.h:225
vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType
unsigned int GetOutputSpaceDimension(void) const
Definition: otbTransform.h:62
virtual const ParametersType & GetFixedParameters(void) const
Definition: otbTransform.h:154
itk::Transform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Definition: otbTransform.h:46
virtual OutputVectorType TransformVector(const InputVectorType &) const
Definition: otbTransform.h:104
itk::CovariantVector< TScalarType, NInputDimensions > InputCovariantVectorType
Definition: otbTransform.h:80
itk::Array2D< double > JacobianType
Definition: otbTransform.h:73
itk::Vector< TScalarType, NOutputDimensions > OutputVectorType
Definition: otbTransform.h:77
JacobianType m_Jacobian
Definition: otbTransform.h:227
virtual const ParametersType & GetParameters(void) const
Definition: otbTransform.h:144
virtual ~Transform()
Definition: otbTransform.h:211
Transform(NumberOfParametersType numberOfParameters)
Definition: otbTransform.h:207
itk::Point< TScalarType, NOutputDimensions > OutputPointType
Definition: otbTransform.h:89
itk::SmartPointer< const Self > ConstPointer
Definition: otbTransform.h:48
virtual void SetParameters(const ParametersType &)
Definition: otbTransform.h:125
IdentifierType NumberOfParametersType
virtual void SetFixedParameters(const ParametersType &)
Definition: otbTransform.h:150
virtual OutputVnlVectorType TransforVector(const InputVnlVectorType &) const
Definition: otbTransform.h:108
Superclass::ParametersType ParametersType
Definition: otbTransform.h:68
vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType
Definition: otbTransform.h:85
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const
Definition: otbTransform.h:128
itk::Vector< TScalarType, NInputDimensions > InputVectorType
Definition: otbTransform.h:76
Superclass::NumberOfParametersType NumberOfParametersType
Definition: otbTransform.h:70
virtual const JacobianType & GetJacobian(const InputPointType &) const
Definition: otbTransform.h:190
Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: otbTransform.h:93
virtual OutputPointType TransformPoint(const InputPointType &) const
Definition: otbTransform.h:99
virtual void SetParametersByValue(const ParametersType &p)
Definition: otbTransform.h:140
itk::SmartPointer< Self > Pointer
Definition: otbTransform.h:47
ParametersType m_Parameters
Definition: otbTransform.h:224
vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType
vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType
Definition: otbTransform.h:84
Superclass::ParametersValueType ParametersValueType
Definition: otbTransform.h:69
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Definition: otbTransform.h:113
itk::CovariantVector< TScalarType, NOutputDimensions > OutputCovariantVectorType
Definition: otbTransform.h:81
virtual NumberOfParametersType GetNumberOfParameters(void) const
Definition: otbTransform.h:200
TScalarType ScalarType
Definition: otbTransform.h:65
Superclass::InverseTransformBasePointer InverseTransformBasePointer
Definition: otbTransform.h:95
Transform Self
Definition: otbTransform.h:43
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:37
unsigned int GetInputSpaceDimension(void) const
Definition: otbTransform.h:59