00001 #ifndef vipl_dilate_disk_h_ 00002 #define vipl_dilate_disk_h_ 00003 //: 00004 // \file 00005 // \brief morphological dilation with circular element 00006 // 00007 // This image processing class is implemented using the vipl filters, 00008 // which means that it can be used with any image class (IUE or not, 00009 // TargetJr or not, vil or vil1 or not) of any pixel data type. 00010 // 00011 // Dilation is a morphological operation that replaces a pixel with the 00012 // maximum value of its surrounding pixels, in a certain neighbourhood. 00013 // Here, the neighbourhood is circular, with an arbitrary (float) radius, 00014 // which is to be be passed to the constructor. 00015 // 00016 // Note that the function max(DataIn,DataIn) is being used; for 00017 // non-scalar data types (like colour pixels) an appropriate max() function 00018 // must thus be supplied. 00019 // 00020 // Note also the implicit use of DataOut::DataOut(DataIn), 00021 // which you probably will have to provide when DataIn and DataOut 00022 // are not the same type. It could even be argued that these types should 00023 // always be the same! 00024 // 00025 // \author Peter Vanroose, K.U.Leuven (ESAT/PSI) 00026 // \date 15 November 1997. 00027 // 00028 // \verbatim 00029 // Modifications: 00030 // 12/97 updated by Tboult to use new codegen form and have valid (public 00031 // agreed) ctor and to use preop and postop to define/destroy the mask. 00032 // Peter Vanroose, Aug.2000 - adapted to vxl 00033 // \endverbatim 00034 // 00035 // \example examples/example_dilate_disk.cxx 00036 00037 #include <vipl/filter/vipl_filter_2d.h> // parent class 00038 00039 //: morphological dilation with circular element 00040 template <class ImgIn,class ImgOut,class DataIn,class DataOut,VCL_DFL_TYPE_PARAM_STLDECL(PixelItr, vipl_trivial_pixeliter) > 00041 class vipl_dilate_disk : public vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr> 00042 { 00043 // -+-+- data members: -+-+- 00044 private: 00045 float radius_; 00046 public: 00047 float radius() const { return radius_;} 00048 float & ref_radius() { return radius_;} 00049 void put_radius(float v){ radius_ = v;} 00050 00051 private: 00052 bool** mask_; 00053 public: 00054 bool** mask() const { return mask_;} 00055 protected: 00056 bool**& ref_mask() { return mask_;} 00057 void put_mask(bool** v) { mask_ = v;} 00058 00059 // -+-+- constructors/destructors: -+-+- 00060 public: 00061 inline vipl_dilate_disk(float r=1) 00062 : vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr>(), radius_(r), mask_(0) {} 00063 inline vipl_dilate_disk(vipl_dilate_disk const& A) 00064 : vipl_filter_2d<ImgIn,ImgOut,DataIn,DataOut,PixelItr>(A), radius_(A.radius()), mask_(0) {} 00065 inline ~vipl_dilate_disk() {} 00066 00067 // -+-+- required method for filters: -+-+- 00068 bool section_applyop(); 00069 // -+-+- optional method for filters, compute mask only once in preop, free in postop: -+-+- 00070 bool preop(); 00071 bool postop(); 00072 }; 00073 00074 #ifdef INSTANTIATE_TEMPLATES 00075 #include "vipl_dilate_disk.txx" 00076 #endif 00077 00078 #endif // vipl_dilate_disk_h_
1.5.1