zxhproj v 2.2
zxhproj

zxhTransformAffine Class Reference

zxhTransformAffine.h: interface for the zxhTransformAffine class. Y = Mskew x {Mscale x Mrotate x (X-Center) + Translate + Center} = K x {S x R x (X-C) + L + C} Kind 1- old (not used) rotate (clockwise is positive) by center,scaling,translate, X'= cos(fDegZ)*cos(fDegY)*(fFixx - fCx)*fScalingX + (sin(fDegZ)*cos(fDegX) + cos(fDegZ)*(sin(fDegY))*(sin(fDegX)))*(fFixy - fCy)*fScalingY + ((sin(fDegZ))*(sin(fDegX)) + cos(fDegZ)*(-sin(fDegY))*cos(fDegX))*(fFixz - fCz)*fScalingZ + fCx*fScalingX + fTx; Y'= (-sin(fDegZ))*cos(fDegY)*(fFixx - fCx) *fScalingX + (cos(fDegZ)*cos(fDegX) + (-sin(fDegZ))*(sin(fDegY))*(sin(fDegX)))*(fFixy - fCy) *fScalingY + (cos(fDegZ)*(sin(fDegX)) + (sin(fDegZ))*(sin(fDegY))*cos(fDegX))*(fFixz - fCz)*fScalingZ + fCy*fScalingY + fTy; Z'= sin(fDegY)*(fFixx - fCx)*fScalingX + cos(fDegY)*(-sin(fDegX))*(fFixy - fCy)*fScalingY + cos(fDegY)*cos(fDegX)*(fFixz - fCz)*fScalingZ + fCz*fScalingZ + fTz; for 4thDimension(temporal), only scaling, then translating independent from spatial dimension differs from itk++, fDegX..Z need *(-1), fC*fScaling% while in itk++ no *fScaling% adding skew info More...

#include <zxhTransformAffine.h>

Inheritance diagram for zxhTransformAffine:
zxhTransformBase zxhGradientBase zxhTransformMatrix zxhTransformMultipleAffines zxhTransformLocalAffines zxhTransformLocalAffines2

List of all members.

Public Member Functions

 zxhTransformAffine ()
 constructor
virtual ~zxhTransformAffine ()
 deconstructor
virtual bool SetTransformFromFile (const char *pFile)
 from file
virtual bool SetTransformFromStream (std::ifstream &ifs)
 from stream
virtual bool SetTransformIdentity ()
 set transformation as a identity transform, affine doesn't change centre
virtual bool SetTransformAlignByCentre (int iCentre)
virtual bool SetTransformAlignByCentre (std::string sCentre)
virtual std::string GetPrintString ()
virtual std::string GetTransformType ()
virtual zxhTransformBaseClone (zxhTransformBase *&pRet)
float * GetRotation ()
 get and set transformation parameters:rotation in degree
float * GetCenter ()
 rotation center(mm)
float * GetScaling ()
 scaling factor
float * GetTranslation ()
 translation(mm)
float * GetSkewxy ()
 skew x-y and y-x
float * GetSkewyz ()
 skew y-z and z-y
float * GetSkewzx ()
 skew z-x and x-z
void GetRotationValue (float rotation[ImageDimensionMax])
void GetCenterValue (float center[ImageDimensionMax])
void GetTranslationValue (float tranlsation[ImageDimensionMax])
void GetScalingValue (float scaling[ImageDimensionMax])
void GetSkewValue (float skewxy[2], float skewyz[2], float skewxz[2])
void SetRotation (float afRotate[ImageDimensionMax])
 set
void SetCenter (float afCenter[ImageDimensionMax])
 set
void SetScaling (float afScaling[ImageDimensionMax])
 set
void SetTranslation (float afTranslate[ImageDimensionMax])
 set
void SetSkewxy (float afSkewxy[2])
 set
void SetSkewyz (float afSkewyz[2])
 set
void SetSkewzx (float afSkewzx[2])
 set
virtual void TransformWorldToWorld (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax])
virtual void InverseTransformWorld (float fVectorToWorld[ImageDimensionMax], float fVectorFromWorld[ImageDimensionMax])
 inverse transform, currently only for 3D
virtual bool GetJacobianMatrixWorld (float fWorld[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax])
virtual bool GetJacobianMatrix (float fVector[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax])
 pJacobian[i*4+0..3] = dX/dx.dy.dz.dt
virtual zxhTransformAffineoperator= (const zxhTransformAffine b)
 operators Do NOT use parameters to set them because this will cause problems when using localaffine
virtual bool SetTransformPara (float f)
 set
virtual bool GetAdd (zxhTransformBase *, zxhTransformBase *)
 A+B.
virtual bool Add (zxhTransformBase *)
 +
virtual bool GetSubtract (zxhTransformBase *, zxhTransformBase *)
 A-B.
virtual bool Subtract (zxhTransformBase *)
 

virtual bool GetMultiply (zxhTransformBase *, float)
 A*f.
virtual bool Multiply (float)
 *f
virtual bool GetMultiplyByPara (zxhTransformBase *, zxhTransformBase *)
 A*B.
virtual bool MultiplyByPara (zxhTransformBase *)
 *B
virtual bool GetCompareByPara (zxhTransformBase *, float f=0)
 threshold to -1 0 and 1 compare with f
virtual bool CompareByPara (float f=0)
 threshold to -1 0 and 1 compare with f
virtual float GetMagnitudeAsVector (void)
 transformation treated as vector
virtual float GetMaxAbsValueFromParameters (void)
virtual float GetPointMutiplyAsVector (zxhTransformBase *)
 get
virtual void UpdateMatrix ()
virtual void UpdateInvertMatrix ()
virtual int GetNoParameters ()
virtual bool SetParameterValue (int index, float f)
virtual float GetParameters (int index)
 0~3translate 4~7rotate 8~11scaling 12~15center 16~21 skew
virtual int GetDegreeOfFreedom ()
 get transforms DOF
virtual int GetDOFWithValue (float f)
 get parameter value >= f , dof
virtual float GetMaxLocalMagnitudeAndNormalisation (bool bNormalisationByLocalMagnitude)
 for optimization step length normalization
virtual bool AdvanceStep (zxhTransformBase *p, float f=1)
 for registration optimization
virtual float * GetMatrixPointer ()
virtual float * GetInvertMatrixPointer ()
virtual bool ComputeMetricGradient (zxhMetricBase *pMetric, zxhTransformBase *pInfluence=0)
virtual void InitialGradientDifferentialStep (zxhTransformAffine *pGrad, float TranslateScale, float RotateScale, float ScalingScale, float factor=1)
virtual void InitialGradientDifferentialStep (zxhTransformAffine *pGrad, float TranslateScale[], float RotateScale[], float ScalingScale[], float SkewScale, float factor=1)

Protected Attributes

float m_afRotate [ImageDimensionMax]
 先 XYZ轴的旋转度数(角度范围0-2pi)
float m_afTranslate [ImageDimensionMax]
 再 x,y,z方向的位移( )
float m_afCenter [ImageDimensionMax]
 center
float m_afScaling [ImageDimensionMax]
 scaling
float m_afSkewxy [2]
float m_afSkewyz [2]
float m_afSkewzx [2]
float m_afMatrix [4][4]
 transformation matrix
float m_afInvertMatrix [4][4]
 transformation inverse of matrix 4*4

Detailed Description

zxhTransformAffine.h: interface for the zxhTransformAffine class. Y = Mskew x {Mscale x Mrotate x (X-Center) + Translate + Center} = K x {S x R x (X-C) + L + C} Kind 1- old (not used) rotate (clockwise is positive) by center,scaling,translate, X'= cos(fDegZ)*cos(fDegY)*(fFixx - fCx)*fScalingX + (sin(fDegZ)*cos(fDegX) + cos(fDegZ)*(sin(fDegY))*(sin(fDegX)))*(fFixy - fCy)*fScalingY + ((sin(fDegZ))*(sin(fDegX)) + cos(fDegZ)*(-sin(fDegY))*cos(fDegX))*(fFixz - fCz)*fScalingZ + fCx*fScalingX + fTx; Y'= (-sin(fDegZ))*cos(fDegY)*(fFixx - fCx) *fScalingX + (cos(fDegZ)*cos(fDegX) + (-sin(fDegZ))*(sin(fDegY))*(sin(fDegX)))*(fFixy - fCy) *fScalingY + (cos(fDegZ)*(sin(fDegX)) + (sin(fDegZ))*(sin(fDegY))*cos(fDegX))*(fFixz - fCz)*fScalingZ + fCy*fScalingY + fTy; Z'= sin(fDegY)*(fFixx - fCx)*fScalingX + cos(fDegY)*(-sin(fDegX))*(fFixy - fCy)*fScalingY + cos(fDegY)*cos(fDegX)*(fFixz - fCz)*fScalingZ + fCz*fScalingZ + fTz; for 4thDimension(temporal), only scaling, then translating independent from spatial dimension differs from itk++, fDegX..Z need *(-1), fC*fScaling% while in itk++ no *fScaling% adding skew info

v2.1 define on world coordinate, hence the transformation on x/y/z direction is not on image grid direction anymore


Member Function Documentation

zxhTransformBase * zxhTransformAffine::Clone ( zxhTransformBase *&  pRet) [virtual]
bool zxhTransformAffine::ComputeMetricGradient ( zxhMetricBase pMetric,
zxhTransformBase pInfluence = 0 
) [virtual]

computer gradient, influence control status for optimisation if infl==0, then use m_fDifferentialStep

Implements zxhGradientBase.

Reimplemented in zxhTransformLocalAffines, and zxhTransformMultipleAffines.

virtual bool zxhTransformAffine::GetJacobianMatrix ( float  fVector[ImageDimensionMax],
float  pJacobian[ImageDimensionMax *ImageDimensionMax] 
) [inline, virtual]

pJacobian[i*4+0..3] = dX/dx.dy.dz.dt

Returns:
xJacobian[0][0..3] dX/dx.dy.dz.dt

Reimplemented from zxhTransformBase.

virtual bool zxhTransformAffine::GetJacobianMatrixWorld ( float  fWorld[ImageDimensionMax],
float  pJacobian[ImageDimensionMax *ImageDimensionMax] 
) [virtual]

Get partial differential of transformation [Y1 Y2 Y3]=T(x), with respect to the transformation parameter Ti with index return whether success, results (e.g. 3D, [d(Y1)/d(Ti) d(Y2)/d(Ti) d(Y3)/d(Ti)]) returned in g[4]

Reimplemented from zxhTransformBase.

Reimplemented in zxhTransformLocalAffines.

virtual int zxhTransformAffine::GetNoParameters ( ) [inline, virtual]

Get partial differential of transformation [Y1 Y2 Y3]=T(x), with respect to the transformation parameter Ti with index return whether success, results (e.g. 3D, [d(Y1)/d(Ti) d(Y2)/d(Ti) d(Y3)/d(Ti)]) returned in g[4]

Implements zxhTransformBase.

Reimplemented in zxhTransformMultipleAffines.

std::string zxhTransformAffine::GetPrintString ( void  ) [virtual]
virtual std::string zxhTransformAffine::GetTransformType ( ) [inline, virtual]
Returns:

Reimplemented from zxhTransformBase.

Reimplemented in zxhTransformLocalAffines, zxhTransformMatrix, and zxhTransformMultipleAffines.

void zxhTransformAffine::InitialGradientDifferentialStep ( zxhTransformAffine pGrad,
float  TranslateScale,
float  RotateScale,
float  ScalingScale,
float  factor = 1 
) [virtual]

This is to initialise the length of the gradient affine for optimisation in the registration, including influence and differential length in FE computing The resultant value corresponding to step length each iteration for each parameter Skew scale is simple set to the same as RotatScale How to set? e.g. if the capture range is 100mm for Translate, 50degree for rotate 0.5times for scaling, and we propose to use 100steps, then TranslateScale=100/100mm, RotateScale=50/100degree, ScalingScale=0.5/100

Reimplemented in zxhTransformMultipleAffines.

zxhTransformAffine & zxhTransformAffine::operator= ( const zxhTransformAffine  b) [virtual]

operators Do NOT use parameters to set them because this will cause problems when using localaffine

gradient parameter

bool zxhTransformAffine::SetParameterValue ( int  index,
float  f 
) [virtual]

set transformation parameter value, if the transformation model need pre-computation from parameters for efficiency such as affine, then re-implement this function to call the pre-computation method after set the value

Implements zxhTransformBase.

Reimplemented in zxhTransformMultipleAffines.

bool zxhTransformAffine::SetTransformAlignByCentre ( int  iCentre) [virtual]

set pretransformation by aligning the image size centre "centre" (2) or gray level centre "gcentre" (3) test and ref images should be set

Reimplemented in zxhTransformMultipleAffines.

void zxhTransformAffine::TransformWorldToWorld ( const float  fVectorFromWorld[ImageDimensionMax],
float  fVectorToWorld[ImageDimensionMax] 
) [virtual]
Returns:

rotate by center,scaling,translate

Implements zxhTransformBase.

Reimplemented in zxhTransformLocalAffines.

void zxhTransformAffine::UpdateMatrix ( ) [virtual]

Update transformation matrix for linear transformation Y = Mskew x {Mscale x Mrotate x (X-Center) + Translate + Center} = K x {S x R x (X-C) + L + C}

Update transformation matrix for linear transformation Y = Mskew x {Mscale x Mrotate x (X-Center) + Translate + Center} = K x {S x R x (X-C) + L + C} Y = KSRX + K(L+C) - KSRC (doubled checked on 2011-03-20, correct matrx)

Reimplemented in zxhTransformMatrix, and zxhTransformMultipleAffines.


Member Data Documentation

float zxhTransformAffine::m_afSkewxy[2] [protected]

skew angles only for 3D Skew angle in the x-y plane (in degrees) Skew angle in the y-x plane (in degrees)

float zxhTransformAffine::m_afSkewyz[2] [protected]

Skew angle in the y-z plane (in degrees) Skew angle in the z-y plane (in degrees)

float zxhTransformAffine::m_afSkewzx[2] [protected]

Skew angle in the z-x plane (in degrees) Skew angle in the x-z plane (in degrees)


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs