00001 #define __cplusplus__ 00002 #ifndef __HMRFALGO__ 00003 #define __HMRFALGO__ 00004 00005 #include<iostream> 00006 #include<istream> 00007 #include<fstream> 00008 #include<string> 00009 #include<vector> 00010 #include<sstream> 00011 #include <cmath> 00012 00013 00014 #include <Seg_Algorithm.hpp> 00015 #include <HMRF.hpp> 00016 00017 00018 using namespace std; 00019 00020 00029 class HMRF_Algorithm : public Seg_Algorithm{ 00030 00031 protected : 00033 Spatial_Data *SpatData; 00034 00036 HMRF *Model; 00037 00039 void Update_Density(); 00040 00042 vector<double> logdens; 00043 00044 public : 00046 virtual ~HMRF_Algorithm(); 00047 00049 uint Get_N(); 00050 00052 uint Get_K(); 00053 00055 virtual void Run(uint nbiter); 00057 void E_Step(); 00059 void M_Step(); 00060 00062 void Info(); 00063 00065 void Compute_MAP_Labels(vector<uint> & Labels); 00066 00067 virtual void Compute_fuzzy(uint i,vector<double> &probs); 00068 00070 void Init_Labels(vector<uint> const & labs); 00072 void Init_KMeans(); 00074 void Init_Random(); 00076 void Init_fuzzy(vector<double> const & t); 00077 00079 void Write_fuzzy(string filename); 00080 00081 // Stopping criteria 00083 void Compute_CLCrit(); 00085 void Compute_FuzzyCrit(); 00087 void Compute_HardCrit(); 00088 00089 00090 }; 00091 00092 00093 #endif