zxhproj v 2.2
zxhproj

zxhMetricJE.h

00001 
00002 /*=========================================================================
00003 
00004   Program:   ZXH Registration Software
00005   Author:    Xiahai Zhuang
00006   Module:    $RCSfle: zxhMetricJE.h    $
00007   Language:  C++
00008   Date:      $Date: From  2007-07 $
00009   Version:   $Revision: 2.0 $
00010   revision:
00011 =========================================================================*/
00012 #ifndef zxhMetricJE_h
00013 #define zxhMetricJE_h
00014 
00015 #include "zxhMetricBase.h"
00022 class zxhMetricJE :
00023     public zxhMetricBase
00024 {
00025 public:
00027     zxhMetricJE(void);
00029     ~zxhMetricJE(void);
00030 
00032     virtual std::string GetMetricType() {return "_JE_"; } ;
00033 
00035     const static int m_stc_iPaddedBins =4;
00036 
00038     virtual zxhMetricBase* Clone(zxhMetricBase*&pRet);
00039 
00041     virtual bool SetImage(zxhImageData*pImageTest,zxhImageData*pImageRef);
00042 
00044     virtual int     GetValue(zxhlfloat& fValue); //
00045 
00047     void    SetNumberOfHistogramBins(int i=64)          {m_iNumberOfHistogramBins=i;};
00048 
00050     int GetNumberOfHistogramBins()          {return m_iNumberOfHistogramBins;};
00051 
00053     virtual std::string GetPrintString();
00054 
00056     virtual bool        SetMetricFromStream(std::ifstream & ifs);
00057 
00059     virtual bool PreComputeImageGraylevel();
00060 protected:
00062     int m_iNumberOfHistogramBins;
00064     PixelTypeDefault m_aiImageTestGraySpan[2];
00065 
00067     PixelTypeDefault m_aiImageRefGraySpan[2];
00068 
00070     float   m_fEntropyT;
00071 
00073     float   m_fEntropyR;
00074 
00076     float   m_fEntropyJ;
00077 
00079     float   m_fTotalFreq; 
00080 
00082     float   *m_afHistogram;
00083 
00085     inline float    BSplinei(int iOrd,float u)
00086     { // -1,0,1,2
00087         float v;
00088         switch(iOrd)
00089         {
00090         case -1:
00091             v=1.0f-u;
00092             return v*v*v/6.0f;
00093         case 0:
00094             v=u*u;
00095             return 0.5f*u*v-v+2.0f/3.0f;
00096         case 1:
00097             v=u*u;
00098             return (-3.0f*u*v+3.0f*v+3.0f*u+1)/6;
00099         case 2:return u*u*u/6;
00100         }
00101         return -1;
00102     }
00103  
00105     int ComputeHistogramFromPDF4D(float * &afPDF,float&fTotalFreq,
00106                         float xfTestFrom,float xfTestTo,float yfTestFrom,float yfTestTo,
00107                         float zfTestFrom,float zfTestTo,float tfTestFrom,float tfTestTo);
00108 };
00109 
00110 #endif
00111 
 All Classes Namespaces Functions Variables Typedefs