Orfeo Toolbox  4.2
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 
96  virtual OutputPointType TransformPoint(const InputPointType & ) const
97  { return OutputPointType(); }
98 
100  virtual OutputVectorType TransformVector(const InputVectorType &) const
101  { return OutputVectorType(); }
102 
104  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
105  { return OutputVnlVectorType(); }
106 
108  virtual OutputCovariantVectorType TransformCovariantVector(
109  const InputCovariantVectorType &) const
110  { return OutputCovariantVectorType(); }
111 
119  virtual void SetParameters( const ParametersType & )
120  { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) }
121 
122  virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const
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 
192  virtual NumberOfParametersType GetNumberOfParameters(void) const
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

Generated at Sat Aug 30 2014 16:30:02 for Orfeo Toolbox with doxygen 1.8.3.1