zxhproj v 2.2
zxhproj

zxhMetricFFDBase Class Reference

special design interface for metric can be used in FFD transformation and gradient to compute gradient 2010-04-13 ADD 1) Compute the bending energy on ffd grid points ONLY: GetBendingEnergy 2) Compute derivative of current FFD: ComputeCtrPntOnTargetForceForBendingEnergy need derived class to implement the ComputeConstanceForFFDGradient with ComputeCtrPntOnTargetForceForBendingEnergy RMS CC NV not implement yet 3) Set WeightFFDBendingEnergy More...

#include <zxhMetricFFDBase.h>

Inheritance diagram for zxhMetricFFDBase:
zxhMetricFFD2Base zxhMetricMIFFD zxhMetricNV zxhMetricPhaseFFD zxhMetricRMS zxhMetricCCFFD2 zxhMetricMIFFD2 zxhMetricMIFFDSEMI zxhMetricCCFFD2ConstDiscretePath zxhMetricMIFFD2ConstDiscretePath zxhMetricMIFFD2MultiImage

List of all members.

Public Member Functions

 zxhMetricFFDBase (void)
 constructor
 ~zxhMetricFFDBase (void)
 deconstructor
virtual zxhMetricFFDBaseClone (zxhMetricFFDBase *&p)
virtual std::string GetMetricType ()
virtual zxhlfloat GetBendingEnergy (zxhTransformFFDBase *pTrans)
virtual bool ComputeCtrPntOnTargetForceForBendingEnergy (zxhTransformFFDBase *pTrans, zxhTransformFFDBase *gradient)
 adding the bending energy force to -> gradient; return success?
virtual int GetValueByFFDGrid (zxhlfloat &fValue, int aiCtrPnt[ImageDimensionMax])=0
virtual int ComputeConstanceForFFDGradient ()=0
 partial differentiation
virtual int GetDiffByFFDGrid (float *afPD, zxhTransformFFDBase *pFFDGrid, int *aiCtrPnt, zxhTransformFFDBase *pDifferential)
virtual int GetDiffByFFDGridOnFFDPhysicalVector (float *afPD, zxhTransformFFDBase *pFFDGrid, int *aiCtrPnt, zxhTransformFFDBase *pDifferential, float *vector)
 currently using finite difference(no AddFiniteDiffPenaltyByFFDGrid yet)
virtual int GetBendingEnergyDerivative (float *afPD, int *aiCtrPnt)
 as func name
virtual void SetPreComputeFFDsCurrPosition (float *afCurrCtrPntWorld, float *afFiniteDiffPosition)
virtual void SetWeightFFDBendingEnergy (float f)
virtual float GetWeightFFDBendingEnergy (void)
virtual void SetUsingFFDsSubVolume (bool b)
virtual bool GetUsingFFDsSubVolume (void)
void GetCtrPntDerivativeConst (zxhTransformFFDBase &ret) const
virtual zxhTransformFFDBaseGetCtrPntDerivativeConst ()
 use it carefully

Protected Member Functions

virtual void GetFFDControlPointSupportVolumeTest (float *afCtrVolumeTest, int aiCtrPnt[])
 afCtrVolumeWorld[2][ImageDimensionMax], do guarantee any roi or FOV; afCtrVolumePhys[2][ImageDimensionMax]
virtual void TransformPointToWorldPlusDisplacementAdvanceByBsplineFFDs (zxhImageDataT< float > *aPreComputeTransformPointToWorld, int dimension, int x, int y, int z, int t, float fux, float fuy, float fuz, float *pWorldRef)
virtual void TransformPointToWorldPlusDisplacementAdvanceByBsplineFFDs (zxhImageDataT< float > *aPreComputeTransformPointToWorld, int dimension, float x, float y, float z, float t, float fux, float fuy, float fuz, float *pWorldRef)
virtual void DisplacementAdvanceByBsplineFFDsUsingPreComputedWorld (int dimension, float ux, float uy, float uz, float *pAdWorld)
 Used only when no current transformation or aPreComputeTransformPointToWorld is zero field.
virtual int AddFiniteDiffPenaltyByFFDGrid (float *afPD, zxhTransformFFDBase *pFFDGrid, int *aiCtrPnt, zxhTransformFFDBase *pDifferential)
 Current only.
virtual bool AddAllCtrPntOnTargetForceForBendingEnergy ()
virtual void InitMetricFFDConstant ()
 constant variables for FFD related
virtual void SetFFDMetricBase ()=0
 this function is to remind of setting m_pMetricBase in non-abstract derived class

Protected Attributes

zxhMetricBasem_pMetricBase
 point to metric, not clone-able; MUST set in derived class
zxhTransformFFDBasem_pCtrPntDerivativeConst
 can be used as sum up of all penalty terms (weighted) or sum up of the cost function
zxhTransformFFDBasem_pCtrPntDerivativeBendingEnergyConst
 store: -(bending energy)*m_fWeightFFDBendingEnergy
float m_fWeightFFDBendingEnergy
float m_afCurrFFDsCtrPntWorld [ImageDimensionMax]
float m_afFiniteDiffPosition [ImageDimensionMax]
bool m_bFFDsSubVolume

Detailed Description

special design interface for metric can be used in FFD transformation and gradient to compute gradient 2010-04-13 ADD 1) Compute the bending energy on ffd grid points ONLY: GetBendingEnergy 2) Compute derivative of current FFD: ComputeCtrPntOnTargetForceForBendingEnergy need derived class to implement the ComputeConstanceForFFDGradient with ComputeCtrPntOnTargetForceForBendingEnergy RMS CC NV not implement yet 3) Set WeightFFDBendingEnergy


Member Function Documentation

bool zxhMetricFFDBase::AddAllCtrPntOnTargetForceForBendingEnergy ( ) [protected, virtual]

as func name adding the bending energy force to -> m_pCtrPntDerivativeConst and m_pCtrPntDerivativeBendingEnergyConst normally called in function computing constants such as ComputeConstanceForFFDGradient

int zxhMetricFFDBase::GetDiffByFFDGrid ( float *  afPD,
zxhTransformFFDBase pFFDGrid,
int *  aiCtrPnt,
zxhTransformFFDBase pDifferential 
) [virtual]

Diff = (forward-backward)/2steplength ( 2009-10-01) should compute the constant (call ComputeConstanceForFFDGradient) before calling this already including penalty terms (AddFiniteDiffPenaltyByFFDGrid)

for each dimension

2 forward

3 backward 2 steps

4 return to current position

compute the value

Reimplemented in zxhMetricFFD2Base, zxhMetricMIFFD, zxhMetricMIFFDSEMI, and zxhMetricNV.

int zxhMetricFFDBase::GetDiffByFFDGridOnFFDPhysicalVector ( float *  afPD,
zxhTransformFFDBase pFFDGrid,
int *  aiCtrPnt,
zxhTransformFFDBase pDifferential,
float *  vector 
) [virtual]

currently using finite difference(no AddFiniteDiffPenaltyByFFDGrid yet)

1 compute the current trans on current local volume : FreqCurr, PDFCurr = tatal - currentvolume

2 forward

3 backward

4 return to current position

compute the value

Reimplemented in zxhMetricMIFFD, and zxhMetricNV.

void zxhMetricFFDBase::GetFFDControlPointSupportVolumeTest ( float *  afCtrVolumeTest,
int  aiCtrPnt[] 
) [protected, virtual]

afCtrVolumeWorld[2][ImageDimensionMax], do guarantee any roi or FOV; afCtrVolumePhys[2][ImageDimensionMax]

Guarantee 1) within ROI; 2) from < to ; Not guarantee from coordinate is on the sampling grid

virtual int zxhMetricFFDBase::GetValueByFFDGrid ( zxhlfloat &  fValue,
int  aiCtrPnt[ImageDimensionMax] 
) [pure virtual]

for GetDiffByFFDGrid and GetDiffByFFDGridOnFFDPhysicalVector SHOULD be implemented in derived class when using zxhMetricFFDBase::GetDiffByFFDGrid and GetDiffByFFDGridOnFFDPhysicalVector To compute local similarity

Implemented in zxhMetricFFD2Base, zxhMetricMIFFD, zxhMetricNV, zxhMetricPhaseFFD, and zxhMetricRMS.

void zxhMetricFFDBase::SetPreComputeFFDsCurrPosition ( float *  afCurrCtrPntWorld,
float *  afFiniteDiffPosition 
) [virtual]

2010-12-23 revised by zxh : be projected onto world vector for usage in transformation to world

virtual void zxhMetricFFDBase::TransformPointToWorldPlusDisplacementAdvanceByBsplineFFDs ( zxhImageDataT< float > *  aPreComputeTransformPointToWorld,
int  dimension,
int  x,
int  y,
int  z,
int  t,
float  fux,
float  fuy,
float  fuz,
float *  pWorldRef 
) [inline, protected, virtual]

Pre computed transformation for FFDs computing derivative of control points (mainly for MI metric) [x,y,z,t] grid index of aPreComputeTransformPointToWorld/m_pImageTest [fux,fuy,fuz] offsets of the point in terms of the FFD grid for computing the weight


Member Data Documentation

float zxhMetricFFDBase::m_afCurrFFDsCtrPntWorld[ImageDimensionMax] [protected]

Setting this variable is for GetDiffByFFDGrid to call GetValueByFFDGrid (GetValueByFFDGrid may call some other function without giving control point's coordinate, e.g.ComputeHistogramFromPDF4DFFD)

float zxhMetricFFDBase::m_afFiniteDiffPosition[ImageDimensionMax] [protected]

Gradient of metric using finite difference negative: length backward, 0, positive: length forward will be projected onto world vector when setting it


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