00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkTransform_h
00018 #define __itkTransform_h
00019
00020
00021
00022
00023 #include "itkConfigure.h"
00024
00025 #ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
00026 #include "itkThreadSafeTransform.h"
00027 #else
00028
00029 #include "itkTransformBase.h"
00030 #include "itkPoint.h"
00031 #include "itkVector.h"
00032 #include "itkCovariantVector.h"
00033 #include "vnl/vnl_vector_fixed.h"
00034 #include "itkArray.h"
00035 #include "itkArray2D.h"
00036
00037 #include "itkObjectFactory.h"
00038
00039
00040 namespace itk
00041 {
00042
00072 template <class TScalarType,
00073 unsigned int NInputDimensions=3,
00074 unsigned int NOutputDimensions=3>
00075 class ITK_EXPORT Transform : public TransformBase
00076 {
00077 public:
00079 typedef Transform Self;
00080 typedef TransformBase Superclass;
00081 typedef SmartPointer< Self > Pointer;
00082 typedef SmartPointer< const Self > ConstPointer;
00083
00085 itkNewMacro(Self);
00086
00088 itkTypeMacro( Transform, TransformBase );
00089
00091 itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
00092 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
00094
00096 unsigned int GetInputSpaceDimension(void) const {return NInputDimensions;}
00097
00099 unsigned int GetOutputSpaceDimension(void) const {return NOutputDimensions;}
00100
00102 typedef TScalarType ScalarType;
00103
00105 typedef typename Superclass::ParametersType ParametersType;
00106
00108 typedef Array2D< double > JacobianType;
00109
00111 typedef Vector<TScalarType, NInputDimensions> InputVectorType;
00112 typedef Vector<TScalarType, NOutputDimensions> OutputVectorType;
00113
00115 typedef CovariantVector<TScalarType, NInputDimensions> InputCovariantVectorType;
00116 typedef CovariantVector<TScalarType, NOutputDimensions> OutputCovariantVectorType;
00117
00119 typedef vnl_vector_fixed<TScalarType, NInputDimensions> InputVnlVectorType;
00120 typedef vnl_vector_fixed<TScalarType, NOutputDimensions> OutputVnlVectorType;
00121
00123 typedef Point<TScalarType, NInputDimensions> InputPointType;
00124 typedef Point<TScalarType, NOutputDimensions> OutputPointType;
00125
00127 virtual OutputPointType TransformPoint(const InputPointType & ) const
00128 { return OutputPointType(); }
00129
00131 virtual OutputVectorType TransformVector(const InputVectorType &) const
00132 { return OutputVectorType(); }
00133
00135 virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00136 { return OutputVnlVectorType(); }
00137
00139 virtual OutputCovariantVectorType TransformCovariantVector(
00140 const InputCovariantVectorType &) const
00141 { return OutputCovariantVectorType(); }
00142
00150 virtual void SetParameters( const ParametersType & )
00151 { itkExceptionMacro( << "Subclasses should override this method" ) };
00152
00160 virtual void SetParametersByValue ( const ParametersType & p )
00161 { this->SetParameters ( p ); };
00162
00164 virtual const ParametersType& GetParameters(void) const
00165 { itkExceptionMacro( << "Subclasses should override this method" );
00166 return m_Parameters; };
00168
00170 virtual void SetFixedParameters( const ParametersType & )
00171 { itkExceptionMacro( << "Subclasses should override this method" ) };
00172
00174 virtual const ParametersType& GetFixedParameters(void) const
00175 { itkExceptionMacro( << "Subclasses should override this method" );
00176 return m_Parameters; };
00178
00206 virtual const JacobianType & GetJacobian(const InputPointType &) const
00207 { itkExceptionMacro( << "Subclass should override this method" );
00208 return m_Jacobian; };
00210
00211
00213 virtual unsigned int GetNumberOfParameters(void) const
00214 { return m_Parameters.Size(); }
00215
00218 bool GetInverse(Self*) const {return false;}
00219
00221 virtual std::string GetTransformTypeAsString() const;
00222
00236 virtual bool IsLinear() const { return false; }
00237
00238 protected:
00239 Transform();
00240 Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00241 virtual ~Transform() {};
00242
00243
00244 mutable ParametersType m_Parameters;
00245 mutable ParametersType m_FixedParameters;
00246 mutable JacobianType m_Jacobian;
00247
00248 private:
00249 Transform(const Self&);
00250 void operator=(const Self&);
00251
00252
00253 };
00254
00255 }
00256
00257
00258 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00259 _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00260 namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00261 }
00262
00263 #if ITK_TEMPLATE_EXPLICIT
00264 # include "Templates/itkTransform+-.h"
00265 #endif
00266
00267 #if ITK_TEMPLATE_TXX
00268 # include "itkTransform.txx"
00269 #endif
00270
00271 #endif
00272
00273 #endif
00274