Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

DistanceFMM.hpp

00001 #ifndef __DistanceFMM__
00002 #define __DistanceFMM__
00003 
00004 
00005 
00035 #include "AnImage.hpp"
00036 #include "RImage.hpp"
00037 #include "FImage.hpp"
00038 
00039 #include "AnImageOp.hpp"
00040 
00041 #include "Psi2DValue.hpp"
00042 #include "DomainOfAction.hpp"
00043 #include "CandidateHeapList.hpp"
00044 #include "NeigbourSet.hpp"
00045 
00046 
00047 class DistanceFMM : public AnImageOp
00048 {
00049 protected:
00050 
00051 int                                     maskFlag;       // 1= mask area, -1 not mask, 0 = both
00052 
00053 int                                     iteration;
00054 
00055 double                          selectedDistance;
00056 
00057 double                          root2;
00058 
00059 double                          slowness;
00060 NeigbourSet*                    neigbourSet;
00061 
00062 CandidateHeapList*              candidateList;
00063 
00064 protected:
00065 
00066 int                                     iterMax;
00067 int                                     width;
00068 int                                     height;
00069 
00071 DomainOfAction*                 dmap;                           
00072 
00074 int                                     xSelected, ySelected;
00075 
00076 protected:
00077 
00079 
00088 virtual double                  getPotential(int i, int j)  
00089                                 {return (dmap->getLabel(i,j) != Unknown ? (slowness) : 1e12); }
00090 
00091 // selection
00092 virtual Psi2DValue*             select();
00093 virtual void                    getSelectionNeighbour(int x, int y);
00094 
00095 
00096 
00097 // resolving the quadratic system (See Sethian & Kimmel)
00098 virtual void                    resolve(int x, int y);  
00099 
00100 public:
00101 
00102 DistanceFMM(int amaskFlag=1);
00103 virtual ~DistanceFMM(){ delete dmap; delete candidateList; delete neigbourSet; }
00104 
00105 virtual void                    setMaskActivity(int amaskFlag){ maskFlag= amaskFlag; }
00106 
00107 virtual double                  getDistance(int x, int y){return dmap->getValue(x, y);}
00108 virtual StatePsi                        getLabel(int x, int y){return dmap->getLabel(x, y);}
00109 
00111 virtual void                    setData(int w, int h, int x0, int y0);
00112 virtual void                    setData(int w, int h, int n, int* xMask, int* yMask);
00113 virtual void                    setData(AnImage* im);
00114         
00115 
00116 virtual int                             getMaxIterations(){ return iterMax; } 
00117 virtual int                             numberOfIteration(){ return iteration; }
00118 virtual void                    setIteration(int i){ iteration=i; }
00119 
00121 virtual bool                    iterate();
00122 
00124 
00133 virtual bool    iterate(int* x, int* y)                         
00134                                         { 
00135                                         bool rc= iterate();
00136 
00137                                         *x= xSelected;
00138                                         *y= ySelected;
00139 
00140                                         return rc;
00141                                         }
00142 
00144 
00154 virtual bool                    iterate(int* x, int* y, double* rate)                                   
00155                                         { 
00156                                         bool rc= iterate(x,y);
00157 
00158                                         *rate= dmap->getValue(xSelected,ySelected);
00159 
00160                                         return rc;
00161                                         }
00162 
00164 virtual RImage*                 compute(RImage* dest=0);
00165 
00167 virtual void                    sortedArea(AnImage* mask, 
00168                                                                    int* npoints, int** xposition, int** yposition, bool inside=true); 
00170 virtual void                    sortedArea(AnImage* mask, int* npoints, 
00171                                                                 int** xposition, int** yposition, double** rating, bool inside=true);
00172 
00174 virtual AnImage*                filter(AnImage* mask, AnImage* dest=0);
00175 virtual AnImage*                selectedFilter(AnImage* mask, AnImage* src, AnImage* dest=0);
00176 
00178 virtual FImage*         ffilter(AnImage* mask, FImage* dest=0, bool dmapFlag=false);
00179 virtual RImage*         rfilter(AnImage* mask, RImage* dest=0, bool dmapFlag=false);
00180 
00182 virtual AnImage*                singlePath(AnImage* src, int x0, int y0, int x1, int y1, AnImage* dest=0);
00183 
00184 virtual void                    report(){}
00185 };
00186 
00187 #endif
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com