00001 #ifndef __AbsRImageFilter__ 00002 #define __AbsRImageFilter__ 00003 00004 00005 00027 #include <stdio.h> 00028 00029 #include "AnImage.hpp" 00030 #include "RImage.hpp" 00031 00032 #include "AbsLimiter.hpp" 00033 00034 class AbsRImageFilter 00035 { 00036 protected: 00037 00038 double minPixelValue; 00039 double maxPixelValue; 00040 00041 int maskValue; // default 255 [1..255] 00042 int nMask; 00043 int* xm; 00044 int* ym; 00045 00046 // extended area 00047 int maskValueExt; // default 255 [1..255] 00048 int nMaskExt; 00049 int* xmExt; 00050 int* ymExt; 00051 00052 AbsLimiter* limiter; 00053 00054 protected: 00055 00057 00059 virtual void loadMask(AnImage& mask); 00060 virtual void loadMaskExt(AnImage& mask); 00062 virtual void unloadMask(){ delete[] xm; delete[] ym; nMask=0; } 00063 virtual void unloadMaskExt(){ delete[] xmExt; delete[] ymExt; nMaskExt=0; } 00064 00065 public: 00066 00067 AbsRImageFilter() 00068 {nMask=0; xm=0; ym=0; maskValue=1; nMaskExt=0; xmExt=0; ymExt=0; maskValueExt=1; 00069 minPixelValue=0.0; maxPixelValue=255.0; limiter=0;} 00070 virtual ~AbsRImageFilter(){} 00071 00072 virtual void setBoundaries(double minval, double maxval) 00073 {minPixelValue= minval; maxPixelValue= maxval;} 00074 00075 virtual AbsLimiter* getLimiter(){return limiter;} 00076 virtual void setLimiter(AbsLimiter* alimiter){ limiter= alimiter; } 00077 00078 virtual int getMaskValue(){return maskValue;} 00079 virtual void setMaskValue(int value){maskValue= value;} 00080 virtual int getMaskValueExt(){return maskValueExt;} 00081 virtual void setMaskValueExt(int value){maskValueExt= value;} 00082 00083 virtual void setMask(int n, int* xp, int* yp){ xm=xp; ym=yp; nMask=n; } 00084 virtual void setMaskExt(int n, int* xp, int* yp){ xmExt=xp; ymExt=yp; nMaskExt=n; } 00085 00086 virtual void setI0(RImage* Istart){} 00087 00089 virtual void prepare(RImage* src){} 00091 virtual void clear(){} 00092 00094 00098 virtual RImage* filter(RImage* src, RImage* dest=0)=0; 00099 00101 00106 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0) 00107 { 00108 return filter(src, dest); 00109 } 00110 00112 virtual RImage* mfilter(int n, RImage* src, RImage* dest=0); 00114 virtual RImage* mSelectedFilter(int n, AnImage* mask, RImage* src, RImage* dest=0); 00115 00116 virtual void report(FILE* file){} 00117 }; 00118 00119 00120 #endif