zxhproj v 2.2
zxhproj

zxhMetricFFD2Base.h

00001 
00002 /*=========================================================================
00003 
00004   Program:   ZXH Registration Software
00005   Author:    Xiahai Zhuang
00006   Module:    $RCSfle: zxhMetricFFD2Base.h    $
00007   Language:  C++
00008   Date:      $Date: From  2008-10 $
00009   Version:   $Revision: 2.0 $
00010   revision:
00011 =========================================================================*/
00012 #ifndef zxhMetricFFD2Base_h
00013 #define zxhMetricFFD2Base_h
00014 
00015 #include "zxh.h"
00016 #include "zxhMetricFFDBase.h"
00017 #include <time.h>
00018 #include <math.h>
00028 class zxhMetricFFD2Base :   public zxhMetricFFDBase
00029 {
00030 public:
00032     zxhMetricFFD2Base(void);
00034     ~zxhMetricFFD2Base(void);
00035 
00037     virtual std::string GetMetricType() {return zxhMetricFFDBase::GetMetricType()+"_FFD2_"; } ;
00038 
00040     virtual zxhMetricFFDBase* Clone( zxhMetricFFDBase * & pRet );
00041 
00042     /* Re-implemented */
00043     ;
00045     virtual int GetValueByFFDGrid(zxhlfloat&fValue,int aiCtrPnt[ImageDimensionMax])
00046     {
00047         std::cerr<<"error: FFD2 does not use GetValueByFFDGrid\n" ;
00048         return -1 ;
00049     };
00056     virtual int ComputeConstanceForFFDGradient()
00057     {
00058         //int num=this->ComputeConstanceForGradient();
00059         this->InitMetricFFDConstant();
00060         bool b = this->ComputeAllControlPointDerivativeBySumLocalEstimation();
00061         if( m_fWeightFFDBendingEnergy>0 )
00062             b= b& this->AddAllCtrPntOnTargetForceForBendingEnergy() ;
00063         return (b==true? 1: 0 );
00064     }; 
00066     virtual int GetDiffByFFDGrid(float * afPD, // output partial differentiation 
00067                                     zxhTransformFFDBase * pFFDGrid,
00068                                     int * aiCtrPnt,
00069                                     zxhTransformFFDBase * pDifferential )
00070     {return this->GetDerivativeFFDGrid(afPD,pFFDGrid,aiCtrPnt,pDifferential); } ;
00072     virtual int GetDerivativeFFDGrid(float * afPD, // output partial differentiation
00073                                      zxhTransformFFDBase * pFFDGrid,
00074                                      int * aiCtrPnt,
00075                                      zxhTransformFFDBase * pDifferential);
00076 
00077 
00078 
00079     /***   methods for ComputeConstanceForFFDGradient    ***/
00080 protected:
00081 
00084     virtual bool    EvaluateAllPixelOnTargetForceForMetric() = 0;
00085 
00089     virtual bool    ComputeAllControlPointDerivativeBySumLocalEstimation();
00090 
00092     virtual void InitMetricFFDConstant() ;
00093 
00094 
00095     /*  variables */
00096 protected:
00099     zxhImageDataT<float>    m_imgVoxelForceConst[ImageDimensionMax];
00100 
00101 };
00102 
00103 
00104 #endif
00105 
00106 
00107 
00108 
 All Classes Namespaces Functions Variables Typedefs