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

Clustering.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*/
00021 /*---------------------------------------------------------------------------*/
00022 #include <iostream>
00023 #include <string>  
00024 #include <vector>
00025 #include <fstream>
00026 
00027 #include <cstdio>
00028 #include <cstdlib>
00029 #include <cmath>
00030 #include <cassert>
00031 #include <ctime>
00032 
00033 #include "./TimeGaussMIX_MDL.hh"
00034  
00035  
00037 void usage(std::string argv0) {
00038     std::cout << "\nusage:                              " << ">"
00039               << argv0 
00040               << "inputImageFileName outputImageFileName nbBands nbLines nbColumns " << std::endl; 
00041     std::cout << "option for spatial window:    "
00042               << " offsetLines offsetColumns OriginalNbColumns"<< std::endl;
00043     std::cout << "option for subsampling :       " 
00044               << "sub_sampleLines sub_sampleColumns "<< std::endl;
00045     std::cout << "option for initializing :      "
00046               << "nb of initial Gaussians"<< std::endl;
00047   }
00048 
00071 int main(int argc, char *argv []){   
00072  
00073  
00074   
00075  
00076 std::string ifn1;
00077 std::string ifn2;
00078 unsigned long   int         nb_bands       = 0;
00079 unsigned long   int         dimx           = 0;
00080 unsigned long   int         dimy           = 0;
00081 unsigned long   int         ofx            = 0;
00082 unsigned long   int         ofy            = 0;
00083 unsigned long   int         Dy             = 0;
00084 unsigned long   int         subx           = 1;
00085 unsigned long   int         suby           = 1;
00086 int                         nb_init        =-1;
00087 switch (argc-1) {
00088         case 11: nb_init                = atoi(argv[11]);
00089         case 10: suby                   = atoi(argv[10]);
00090         case 9:  subx                   = atoi(argv[9]);
00091         case 8:  Dy                     = atoi(argv[8]);
00092         case 7:  ofy                    = atoi(argv[7]);
00093         case 6:  ofx                    = atoi(argv[6]);
00094         case 5:  dimy                   = atoi(argv[5]);
00095         case 4:  dimx                   = atoi(argv[4]);
00096         case 3:  nb_bands               = atoi(argv[3]);
00097         case 2:  ifn2                   = std::string(argv[2]);
00098         case 1:  ifn1                   = std::string(argv[1]); break;
00099         case 0:
00100         default: usage(argv[0]); return -1;
00101     }
00102     if ((argc-1) < 5) { usage(argv[0]); return -1;}
00103     if ((argc-1) == 5) {Dy=dimy;} 
00104     std::cout << "> " << argv[0] 
00105               << " " << ifn1 
00106               << " " << ifn2 
00107               << " " << nb_bands 
00108               << " " << dimx 
00109               << " " << dimy 
00110               << " " << ofx
00111               << " " << ofy  
00112               << " " << Dy 
00113               << " " << subx  
00114               << " " << suby
00115               << " " << nb_init<< std::endl;
00116          
00117 /*******MDL clasiffications for image time series **********************************************************/
00118         srand((unsigned)time(NULL));
00119         time_t tdeb, t1,t2,t3;
00120         time(&tdeb);
00121         t1=tdeb;
00122         Temporal_MDL_classifier test;
00123         test.Initialise((char *)ifn1.c_str(),(char *)ifn2.c_str(),dimx,dimy,nb_bands,ofx,ofy,Dy,subx,suby,nb_init);
00124         time(&tdeb);
00125         t2=tdeb;
00126         cout<< "Inatializing time duration : "<<t2-t1<<" seconds."<<endl;
00127         test.Cluster_optimiser();
00128         time(&t3);
00129         cout<< "Processing time duration : "<<t3-t2<<" seconds."<<endl;
00130         return 0;
00131 }

Generated on Thu Feb 17 11:01:08 2005 for Gaussian Mixture Modeling by the MDL principle by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002