Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Neighborhood_System.hpp

00001 #define __cplusplus__
00002 #ifndef __NEIGHBORHOOD__
00003 #define __NEIGHBORHOOD__
00004 
00005 #include<iostream>
00006 #include<istream>
00007 #include<fstream>
00008 #include<string>
00009 #include<vector>
00010 #include<sstream>
00011 #include <cmath>
00012 
00013 using namespace std;
00014 
00015 
00022 class Weighted_Neighbor{
00023 
00024   
00025 public:
00026 
00028   uint Index; 
00030   double Weight ;  
00031 
00032 
00034   Weighted_Neighbor();  
00035 
00037   Weighted_Neighbor(uint i, double w); 
00038 
00040   ~Weighted_Neighbor();
00041 
00042 };
00043 
00044 
00045 // Abstract neighborhood system
00046 
00054 class Neighborhood_System{
00055   
00056 
00057 protected :
00059   uint NbPts; 
00060   
00061 public :
00062   //  Neighborhood_System();
00063   virtual ~Neighborhood_System(); 
00064 
00066   virtual void GetNeighbors(uint site, vector< Weighted_Neighbor * > & neighs);
00067 
00069   uint LMAX();
00070 
00072   virtual void Info();
00073 
00074   // Get the number of the sites
00075   uint Get_N();
00076 
00078   //virtual void WriteToFile(string filename);
00079 
00080 
00082   virtual void ReadFromFile(string filename); 
00083 
00084 
00085 };
00086 
00087 
00088 // Generic Neighborhood system
00089 
00099 class Generic_Neighborhood_System : public Neighborhood_System{
00100 
00101 
00102 
00104   vector< vector <Weighted_Neighbor *> > neighbors; 
00105 
00106 public :
00107   
00109   Generic_Neighborhood_System();
00110 
00112   ~Generic_Neighborhood_System();
00113 
00115   void DeleteAll(); 
00116 
00117   void GetNeighbors(uint site, vector< Weighted_Neighbor * > & neighs); 
00118 
00119   void ReadFromFile(string filename); 
00120 
00122   
00123   void WriteToFile(string filename, bool save_weights);
00124 
00126   void WriteToFile(string filename); 
00127 
00128   
00129   void Info();
00130 
00131 };
00132 
00160 class Image_Local_Neighborhood : public Neighborhood_System{
00161 
00163   uint Nlines; 
00165   uint Ncols;  
00166 
00168   int   dlmin;
00170   int  dlmax; 
00172   int  dcmin;  
00174   int   dcmax ; 
00175 
00177   vector<double> weights;
00178 
00180   vector< vector <Weighted_Neighbor *> > neighbors; 
00181 
00182   void precompute_neighbors();
00183   void Compute_Neighbors(uint site, vector< Weighted_Neighbor * > & neighs);
00184 
00185 public :
00186 
00188   Image_Local_Neighborhood (); 
00190   Image_Local_Neighborhood (uint Nl, uint Nc);
00191 
00193   ~Image_Local_Neighborhood ();
00194 
00196   void DeleteAll();
00197 
00199   void SetWeights(vector<int> window, vector<double> wghts);
00200 
00201   void GetNeighbors(uint site, vector< Weighted_Neighbor * > & neighs);
00202 
00204   void ReadFromFile(string filename);
00206   void WriteToFile(string filename);
00208   void DumpAsGeneric();
00209   void Info();
00210 };
00211 
00212 #endif

Generated on Thu Jan 12 11:54:58 2006 for NEM by  doxygen 1.4.4