Go to the documentation of this file.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 #include "itkTransformBase.h"
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "vnl/vnl_vector_fixed.h"
00025 #include "itkArray.h"
00026 #include "itkArray2D.h"
00027
00028 #include "itkObjectFactory.h"
00029
00030
00031 namespace itk
00032 {
00033
00063 template <class TScalarType,
00064 unsigned int NInputDimensions=3,
00065 unsigned int NOutputDimensions=3>
00066 class ITK_EXPORT Transform : public TransformBase
00067 {
00068 public:
00070 typedef Transform Self;
00071 typedef TransformBase Superclass;
00072 typedef SmartPointer< Self > Pointer;
00073 typedef SmartPointer< const Self > ConstPointer;
00074
00076 itkNewMacro(Self);
00077
00079 itkTypeMacro( Transform, TransformBase );
00080
00082 itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
00083 itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
00085
00087 unsigned int GetInputSpaceDimension(void) const {return NInputDimensions;}
00088
00090 unsigned int GetOutputSpaceDimension(void) const {return NOutputDimensions;}
00091
00093 typedef TScalarType ScalarType;
00094
00096 typedef typename Superclass::ParametersType ParametersType;
00097 typedef typename Superclass::ParametersValueType ParametersValueType;
00098
00100 typedef Array2D< double > JacobianType;
00101
00103 typedef Vector<TScalarType, NInputDimensions> InputVectorType;
00104 typedef Vector<TScalarType, NOutputDimensions> OutputVectorType;
00105
00107 typedef CovariantVector<TScalarType, NInputDimensions> InputCovariantVectorType;
00108 typedef CovariantVector<TScalarType, NOutputDimensions> OutputCovariantVectorType;
00109
00111 typedef vnl_vector_fixed<TScalarType, NInputDimensions> InputVnlVectorType;
00112 typedef vnl_vector_fixed<TScalarType, NOutputDimensions> OutputVnlVectorType;
00113
00115 typedef Point<TScalarType, NInputDimensions> InputPointType;
00116 typedef Point<TScalarType, NOutputDimensions> OutputPointType;
00117
00120 #if _MSC_VER <= 1300
00121
00122
00123 typedef TransformBase InverseTransformBaseType;
00124 #else
00125 typedef Transform<
00126 TScalarType, NOutputDimensions, NInputDimensions > InverseTransformBaseType;
00127 #endif
00128 typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
00129
00131 virtual OutputPointType TransformPoint(const InputPointType & ) const
00132 { return OutputPointType(); }
00133
00135 virtual OutputVectorType TransformVector(const InputVectorType &) const
00136 { return OutputVectorType(); }
00137
00139 virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00140 { return OutputVnlVectorType(); }
00141
00143 virtual OutputCovariantVectorType TransformCovariantVector(
00144 const InputCovariantVectorType &) const
00145 { return OutputCovariantVectorType(); }
00146
00154 virtual void SetParameters( const ParametersType & )
00155 { itkExceptionMacro( << "Subclasses should override this method" ) }
00156
00164 virtual void SetParametersByValue ( const ParametersType & p )
00165 { this->SetParameters ( p ); }
00166
00168 virtual const ParametersType& GetParameters(void) const
00169 {
00170 itkExceptionMacro( << "Subclasses should override this method" );
00171
00172
00173 return this->m_Parameters;
00174 }
00176
00178 virtual void SetFixedParameters( const ParametersType & )
00179 { itkExceptionMacro( << "Subclasses should override this method" ) }
00180
00182 virtual const ParametersType& GetFixedParameters(void) const
00183 {
00184 itkExceptionMacro( << "Subclasses should override this method" );
00185
00186
00187 return this->m_FixedParameters;
00188 }
00190
00218 virtual const JacobianType & GetJacobian(const InputPointType &) const
00219 {
00220 itkExceptionMacro( << "Subclass should override this method" );
00221
00222
00223 return this->m_Jacobian;
00224 }
00226
00227
00229 virtual unsigned int GetNumberOfParameters(void) const
00230 { return this->m_Parameters.Size(); }
00231
00239 bool GetInverse(Self * itkNotUsed(inverseTransform) ) const {return false;}
00240
00247 virtual InverseTransformBasePointer GetInverseTransform() const { return NULL; }
00248
00250 virtual std::string GetTransformTypeAsString() const;
00251
00265 virtual bool IsLinear() const { return false; }
00266
00267 protected:
00268 Transform();
00269 Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00270 virtual ~Transform() {}
00271
00272
00273 mutable ParametersType m_Parameters;
00274 mutable ParametersType m_FixedParameters;
00275 mutable JacobianType m_Jacobian;
00276
00277 private:
00278 Transform(const Self&);
00279 void operator=(const Self&);
00280
00281
00282 };
00283
00284 }
00285
00286
00287 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00288 _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00289 namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00290 }
00291
00292 #if ITK_TEMPLATE_EXPLICIT
00293 # include "Templates/itkTransform+-.h"
00294 #endif
00295
00296 #if ITK_TEMPLATE_TXX
00297 # include "itkTransform.txx"
00298 #endif
00299
00300 #endif
00301