00001 #ifndef __ITopHatOp__ 00002 #define __ITopHatOp__ 00003 00004 00005 00026 #include <stdio.h> 00027 00028 #include "IMorphologicalOp.hpp" 00029 #include "StructuredElement.hpp" 00030 00031 class ITopHatOp : public IMorphologicalOp 00032 { 00033 protected: 00034 00035 bool blackHatTop; 00036 00037 bool maskFlag; 00038 int threshold1, threshold2; 00039 00040 bool background; 00041 bool crackArea; 00042 00043 IMorphologicalOp* op; 00044 00045 public: 00046 00047 ITopHatOp(int iter=5, bool aBlackHatTop=true); 00048 ITopHatOp(StructuredElement* aStructuredElement, int iter=5, bool aBlackHatTop=true); 00049 virtual ~ITopHatOp(){delete op;} 00050 00051 virtual void setMask(bool flag){maskFlag= flag;} 00052 virtual void setThreshold(int th1, int th2){threshold1= th1;threshold2= th2;} 00053 virtual int getLowThreshold(){return threshold1;} 00054 virtual int getUpperThreshold(){return threshold2;} 00055 00056 00057 virtual void setBackground( bool value ){background= value;} 00058 virtual void setCrackArea( bool value){crackArea= value;} 00059 00060 virtual void setIterations(int iter){op->setIterations(iter); } 00061 00062 virtual void setStructuredElement(StructuredElement* aStructuredElement) 00063 {op->setStructuredElement(aStructuredElement);} 00064 00065 virtual AnImage* filter(AnImage* src, AnImage* dest=0); 00066 00067 virtual void report(FILE* file){} 00068 }; 00069 00070 00071 #endif