Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __cmtkXform_h_included_
00034 #define __cmtkXform_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <Base/cmtkMetaInformationObject.h>
00039 #include <Base/cmtkAnatomicalOrientationBase.h>
00040 #include <Base/cmtkVector.h>
00041 #include <Base/cmtkFixedVector.h>
00042 #include <Base/cmtkBitVector.h>
00043 #include <Base/cmtkMatchedLandmarkList.h>
00044
00045 #include <System/cmtkSmartPtr.h>
00046
00047 namespace
00048 cmtk
00049 {
00050
00053
00056 class Xform :
00058 public MetaInformationObject
00059 {
00060 public:
00062 typedef Xform Self;
00063
00065 typedef SmartPointer<Self> SmartPtr;
00066
00068 typedef SmartConstPointer<Self> SmartConstPtr;
00069
00071 typedef FixedVector<3,Types::Coordinate> SpaceVectorType;
00072
00074 Types::Coordinate *m_Parameters;
00075
00077 size_t m_NumberOfParameters;
00078
00080 Xform( const Xform& other )
00081 : MetaInformationObject( other ),
00082 m_NumberOfParameters( other.m_NumberOfParameters ),
00083 m_ParameterVector( other.m_ParameterVector )
00084 {
00085 this->m_Parameters = this->m_ParameterVector->Elements;
00086 this->m_MetaInformation[cmtk::META_SPACE] = cmtk::AnatomicalOrientationBase::ORIENTATION_STANDARD;
00087 }
00088
00090 Xform()
00091 : m_Parameters( NULL ),
00092 m_NumberOfParameters( 0 )
00093 {
00094 this->m_MetaInformation[cmtk::META_SPACE] = cmtk::AnatomicalOrientationBase::ORIENTATION_STANDARD;
00095 }
00096
00098 virtual ~Xform() {}
00099
00101 virtual bool InDomain( const Self::SpaceVectorType& ) const { return true; }
00102
00104 virtual Types::Coordinate GetGlobalScaling() const { return 0.0; }
00105
00107 virtual Self::SpaceVectorType Apply ( const Self::SpaceVectorType& ) const = 0;
00108
00110 virtual void ApplyInPlace ( Self::SpaceVectorType& ) const = 0;
00111
00114 virtual bool ApplyInverse ( const Self::SpaceVectorType&, Self::SpaceVectorType&, const Types::Coordinate = 0.01 ) const = 0;
00115
00118 virtual bool ApplyInverseInPlace( Self::SpaceVectorType&, const Types::Coordinate = 0.01 ) const = 0;
00119
00122 virtual bool ApplyInverseInPlaceWithInitial( Self::SpaceVectorType& v, const Self::SpaceVectorType&, const Types::Coordinate error = 0.01 ) const
00123 {
00124 return this->ApplyInverseInPlace( v, error );
00125 }
00126
00128 Self::SmartPtr Clone () const
00129 {
00130 return Self::SmartPtr( this->CloneVirtual() );
00131 }
00132
00134 virtual size_t ParamVectorDim () const
00135 {
00136 return this->m_NumberOfParameters;
00137 }
00138
00144 virtual size_t VariableParamVectorDim () const
00145 {
00146 return this->ParamVectorDim();
00147 }
00148
00154 virtual void SetParamVector ( CoordinateVector& v );
00155
00159 virtual void CopyParamVector ( const Xform* other )
00160 {
00161 *(this->m_ParameterVector) = *(other->m_ParameterVector);
00162 this->m_Parameters = this->m_ParameterVector->Elements;
00163 }
00164
00166 virtual void SetParamVector ( const CoordinateVector& v );
00167
00169 virtual void SetParameter ( const size_t idx, const Types::Coordinate p )
00170 {
00171 this->m_Parameters[idx] = p;
00172 }
00173
00175 virtual Types::Coordinate GetParameter ( const size_t idx ) const
00176 {
00177 return this->m_Parameters[idx];
00178 }
00179
00181 virtual CoordinateVector& GetParamVector( CoordinateVector& v, const size_t targetOffset = 0 ) const;
00182
00184 virtual Types::Coordinate GetParamStep( const size_t, const Self::SpaceVectorType&, const Types::Coordinate step_mm = 1 ) const
00185 {
00186 return step_mm;
00187 }
00188
00190 virtual Types::Coordinate GetJacobianDeterminant ( const Self::SpaceVectorType& ) const = 0;
00191
00196 virtual Types::Coordinate GetLandmarksMSD( const MatchedLandmarkList* ll ) const;
00197
00199 virtual void GetVolumeOfInfluence( const size_t idx, const Self::SpaceVectorType&, const Self::SpaceVectorType&, Self::SpaceVectorType&, Self::SpaceVectorType&, const int = -1 ) const;
00200
00201 protected:
00207 CoordinateVector::SmartPtr m_ParameterVector;
00208
00211 void AllocateParameterVector( const size_t numberOfParameters );
00212
00214 virtual Self* CloneVirtual () const = 0;
00215 };
00216
00218
00219 }
00220
00221 #endif // #ifdef __cmtkXform_h_included_