Orfeo Toolbox  3.16
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 
71 
75 
79 
81  typedef vnl_vector_fixed< TScalarType, NInputDimensions > InputVnlVectorType;
82  typedef vnl_vector_fixed< TScalarType, NOutputDimensions > OutputVnlVectorType;
83 
87 
90  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
91 
92  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;
93 
95  virtual OutputPointType TransformPoint(const InputPointType & ) const
96  { return OutputPointType(); }
97 
99  virtual OutputVectorType TransformVector(const InputVectorType &) const
100  { return OutputVectorType(); }
101 
103  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
104  { return OutputVnlVectorType(); }
105 
107  virtual OutputCovariantVectorType TransformCovariantVector(
108  const InputCovariantVectorType &) const
109  { return OutputCovariantVectorType(); }
110 
118  virtual void SetParameters( const ParametersType & )
119  { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) }
120 
128  virtual void SetParametersByValue(const ParametersType & p)
129  { this->SetParameters (p); }
130 
132  virtual const ParametersType & GetParameters(void) const
133  {
134  return m_Parameters;
135  }
136 
138  virtual void SetFixedParameters( const ParametersType & )
139  { itkExceptionMacro( << "Subclasses should override this method (SetFixedParameters)" ) }
140 
142  virtual const ParametersType& GetFixedParameters(void) const
143  {
144  itkExceptionMacro( << "Subclasses should override this method (GetFixedParameters)" );
145  // Next line is needed to avoid errors due to:
146  // "function must return a value".
147  return this->m_FixedParameters;
148  }
149 
177  virtual const JacobianType & GetJacobian(const InputPointType &) const
178  {
179  itkExceptionMacro( << "Subclass should override this method (GetJacobian)" );
180  // Next line is needed to avoid errors due to:
181  // "function must return a value" .
182  return this->m_Jacobian;
183  }
184 
186  virtual unsigned int GetNumberOfParameters(void) const
187  { return this->m_Parameters.Size(); }
188 
189 protected:
191  {}
192 
193  Transform(unsigned int Dimension, unsigned int NumberOfParameters)
194  : Superclass::Transform(Dimension, NumberOfParameters)
195  {}
196 
197  virtual ~Transform() {}
198 
199  void PrintSelf(std::ostream& os, itk::Indent indent) const
200  {
201  Superclass::PrintSelf(os, indent);
202  os << indent << "Parameters : " << m_Parameters << std::endl;
203  os << indent << "FixedParameters : " << m_FixedParameters << std::endl;
204  os << indent << "Jacobian : " << m_Jacobian << std::endl;
205 
206  }
207 
208 
211 
213 private:
214  Transform(const Self &); //purposely not implemented
215  void operator=(const Self &); //purposely not implemented
216 };
217 } // end namespace otb
218 
219 #endif

Generated at Sun Feb 3 2013 00:52:10 for Orfeo Toolbox with doxygen 1.8.1.1