Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

Morphology.H

Go to the documentation of this file.
00001 
00016 #ifndef MORPHOLOGY_H
00017 #define MORPHOLOGY_H
00018 
00019 #include <TensorArray.H>
00020 #include <wrapGL.H>
00021 #include <Vector.H>
00022 
00023 namespace xchen
00024 {
00025   typedef TensorArray<bool, 2> BitMap;           // binary image.
00026   
00027   class Morphology 
00028   {
00029       static iE2 const neighbors8[8];
00030       static iE2 const neighbors4[4];             // currently on this cross kernel is used. 
00031       
00032       BitMap original_image, dilated_image;       // dilated_image is for Dilate(step).
00033       set<iE2> central_pnts;                      // all central pnts from all regions, finally will be only one from each region.
00034       set<iE2> front;                             // current front of dilation. 
00035       vector< vector<iE2> > pnts_by_region;       // group all central points from the same region into one set,so that we can select one best point from them.
00036 
00037       void init_dataset_for_dilate();
00038       
00039   public:
00040       Morphology() { }
00041       Morphology(BitMap const& image) : original_image(image)   { init_dataset_for_dilate(); }
00042       void SetImage(BitMap const& image)                        { original_image = image; init_dataset_for_dilate(); }
00043 
00045       set<iE2>const& operator()()                       { Dilate(); ClassifyPointsByRegion(); SelectUniquePointOfRegion(); return GetCurrentCentralPoints(); }
00046       
00047       set<iE2>const& GetCurrentFront() const            { return front; }
00048       set<iE2>const& GetCurrentCentralPoints() const    { return central_pnts; }
00049       
00050       void Dilate() { while( Dilate(1000) ); }                                 
00051       bool Dilate(int step);                                                   
00052 
00053       void ClassifyPointsByRegion() { while( ClassifyPointsByRegion(1000) ); } 
00054       bool ClassifyPointsByRegion(int step);                                   
00055 
00056       void SelectUniquePointOfRegion();                                        
00057   };
00058 
00059 }
00060 
00061 #endif
00062 
00063 
00064 

Generated on Wed Apr 7 21:40:49 2004 by doxygen1.2.18