itkTransform.h
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
00099 typedef Array2D< double > JacobianType;
00100
00102 typedef Vector<TScalarType, NInputDimensions> InputVectorType;
00103 typedef Vector<TScalarType, NOutputDimensions> OutputVectorType;
00104
00106 typedef CovariantVector<TScalarType, NInputDimensions> InputCovariantVectorType;
00107 typedef CovariantVector<TScalarType, NOutputDimensions> OutputCovariantVectorType;
00108
00110 typedef vnl_vector_fixed<TScalarType, NInputDimensions> InputVnlVectorType;
00111 typedef vnl_vector_fixed<TScalarType, NOutputDimensions> OutputVnlVectorType;
00112
00114 typedef Point<TScalarType, NInputDimensions> InputPointType;
00115 typedef Point<TScalarType, NOutputDimensions> OutputPointType;
00116
00119 #if _MSC_VER <= 1300
00120
00121
00122 typedef TransformBase InverseTransformBaseType;
00123 #else
00124 typedef Transform<
00125 TScalarType, NOutputDimensions, NInputDimensions > InverseTransformBaseType;
00126 #endif
00127 typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
00128
00130 virtual OutputPointType TransformPoint(const InputPointType & ) const
00131 { return OutputPointType(); }
00132
00134 virtual OutputVectorType TransformVector(const InputVectorType &) const
00135 { return OutputVectorType(); }
00136
00138 virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
00139 { return OutputVnlVectorType(); }
00140
00142 virtual OutputCovariantVectorType TransformCovariantVector(
00143 const InputCovariantVectorType &) const
00144 { return OutputCovariantVectorType(); }
00145
00153 virtual void SetParameters( const ParametersType & )
00154 { itkExceptionMacro( << "Subclasses should override this method" ) }
00155
00163 virtual void SetParametersByValue ( const ParametersType & p )
00164 { this->SetParameters ( p ); }
00165
00167 virtual const ParametersType& GetParameters(void) const
00168 {
00169 itkExceptionMacro( << "Subclasses should override this method" );
00170
00171
00172 return this->m_Parameters;
00173 }
00175
00177 virtual void SetFixedParameters( const ParametersType & )
00178 { itkExceptionMacro( << "Subclasses should override this method" ) }
00179
00181 virtual const ParametersType& GetFixedParameters(void) const
00182 {
00183 itkExceptionMacro( << "Subclasses should override this method" );
00184
00185
00186 return this->m_FixedParameters;
00187 }
00189
00217 virtual const JacobianType & GetJacobian(const InputPointType &) const
00218 {
00219 itkExceptionMacro( << "Subclass should override this method" );
00220
00221
00222 return this->m_Jacobian;
00223 }
00225
00226
00228 virtual unsigned int GetNumberOfParameters(void) const
00229 { return this->m_Parameters.Size(); }
00230
00238 bool GetInverse(Self * itkNotUsed(inverseTransform) ) const {return false;}
00239
00246 virtual InverseTransformBasePointer GetInverseTransform() const { return NULL; }
00247
00249 virtual std::string GetTransformTypeAsString() const;
00250
00264 virtual bool IsLinear() const { return false; }
00265
00266 protected:
00267 Transform();
00268 Transform(unsigned int Dimension, unsigned int NumberOfParameters);
00269 virtual ~Transform() {}
00270
00271
00272 mutable ParametersType m_Parameters;
00273 mutable ParametersType m_FixedParameters;
00274 mutable JacobianType m_Jacobian;
00275
00276 private:
00277 Transform(const Self&);
00278 void operator=(const Self&);
00279
00280
00281 };
00282
00283 }
00284
00285
00286 #define ITK_TEMPLATE_Transform(_, EXPORT, x, y) namespace itk { \
00287 _(3(class EXPORT Transform< ITK_TEMPLATE_3 x >)) \
00288 namespace Templates { typedef Transform< ITK_TEMPLATE_3 x > Transform##y; } \
00289 }
00290
00291 #if ITK_TEMPLATE_EXPLICIT
00292 # include "Templates/itkTransform+-.h"
00293 #endif
00294
00295 #if ITK_TEMPLATE_TXX
00296 # include "itkTransform.txx"
00297 #endif
00298
00299 #endif
00300