00001 #ifndef __HJFastSweepingOp__ 00002 #define __HJFastSweepingOp__ 00003 00004 00005 00031 #include <stdio.h> 00032 #include <math.h> 00033 00034 #include "AbsRImageFilter.hpp" 00035 00036 00037 class HJFastSweepingOp : public AbsRImageFilter 00038 { 00039 private: 00040 00041 int maxIter; 00042 00043 double a,b,c, R; // HJ model 00044 double h; 00045 00046 int width, height; 00047 00048 int count; 00049 double psiCandidate[4]; 00050 00051 //tmp 00052 double pi_2; 00053 double ab_c2; // (a*b-c^2) 00054 double m2_ab_c2; // m^2*(a*b-c^2) 00055 double asx_csy; 00056 double bsy_csx; 00057 00058 double borneSxLow, borneSxUp, borneSyLow, borneSyUp; 00059 00060 protected: 00061 00062 void init(RImage* psi); 00063 void updatePsi(RImage* psiNew, int i, int j); 00064 void updatePsi(RImage* psi, int i, int j, int sx, int sy); 00065 void solvePsi(RImage* psi, int i, int j, int sx, int sy, double m); 00066 00067 public: 00068 00069 HJFastSweepingOp(double ax=1.0, double bx=1.0, double cx=0.0, double Rx=1.0) 00070 { a=ax; b=bx; c=cx; R=Rx; count=0; h=1.0; pi_2= 2.0*atan(1.0); maxIter=1;} 00071 virtual ~HJFastSweepingOp(){} 00072 00073 // single shot filtering 00074 virtual RImage* filter(RImage* src, RImage* dest=0); 00075 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00076 00077 virtual void report(FILE* file){ fprintf(file,"HJ Fast Sweeping Operator\n"); } 00078 }; 00079 00080 00081 #endif