CINNICtest.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "CINNIC/CINNIC.H"
00048 #include "CINNIC/cascadeHold.H"
00049 #include "Util/log.H"
00050 #include "Util/readConfig.H"
00051 #include <fstream>
00052 #include <iostream>
00053 #include <sstream>
00054 #include <stdlib.h>
00055 #include <sys/types.h>
00056 #include <time.h>
00057
00058
00059 ContourNeuronCreate<float> CINNICreate;
00060
00061 CINNIC skeptic;
00062
00063 std::istream* argInput;
00064
00065 const char* configFile;
00066
00067 readConfig configIn(25);
00068
00069
00070
00071
00072
00073
00074
00075
00076 int main(int argc, char* argv[])
00077 {
00078 time_t t1,t2;
00079 (void) time(&t1);
00080
00081 if(argc > 3)
00082 {
00083 configFile = argv[3];
00084 }
00085 else
00086 {
00087 configFile = "contour.conf";
00088 }
00089 skeptic.filename = "noName";
00090 LINFO("LOADING CONFIG FILE");
00091 configIn.openFile(configFile);
00092
00093
00094
00095
00096 LINFO("Starting CINNIC test\n");
00097 CINNICreate.CreateNeuron(configIn);
00098 LINFO("CINNIC template Neuron copied, ready for use");
00099 int choice = 0;
00100
00101 if(argc > 2)
00102 {
00103 skeptic.savefilename = argv[2];
00104 }
00105 else
00106 {
00107 skeptic.savefilename = "noname";
00108 }
00109 if(argc > 1)
00110 {
00111 LINFO("argc %d", argc);
00112 argInput = new std::istringstream(argv[1]);
00113 skeptic.Ninput = Image<byte>(100,100, NO_INIT);
00114 skeptic.Ninput = Raster::ReadGray(argv[1], RASFMT_PNM);
00115
00116 skeptic.filename = argv[1];
00117 LINFO("Image Loaded");
00118 skeptic.RunSimpleImage(CINNICreate,skeptic.Ninput,configIn);
00119 LINFO("done!");
00120 }
00121 else
00122 {
00123 std::ofstream outfile("kernel_set.dat",std::ios::out);
00124 choice = 0;
00125 while((choice < 9) && (choice > -1))
00126 {
00127 std::cout << "\n";
00128 std::cout << "iLab Global Dominanation Project (c) 2001\n";
00129 std::cout << "1 - Alpha Angle\n"
00130 << "2 - Beta Angle\n"
00131 << "3 - Distance\n"
00132 << "4 - Polarity\n"
00133 << "5 - Alpha/Beta Combo\n"
00134 << "6 - Alpha/Beta/Distance Combo\n"
00135 << "7 - coLinearity\n"
00136 << "8 - Visual ABD Combo\n"
00137 << "9 - QUIT\n\n"
00138 << "Choice: ";
00139 std::cin >> choice;
00140 if(choice == 8){skeptic.viewNeuronTemplate(CINNICreate,configIn);}
00141 if(choice < 8)
00142 {
00143 for (int i = 0; i < AnglesUsed; i++)
00144 {
00145 std::cout << "\n";
00146 outfile << "\n";
00147 for (int j = 0; j < AnglesUsed; j++)
00148 {
00149 std::cout << "\n\nNeuron:" << NeuralAngles[i] << " Other:" << NeuralAngles[j];
00150 for (int l = YSize; l >= 0; --l)
00151 {
00152 std::cout << "\n";
00153 outfile << "\n";
00154 for (int k = 0; k <= XSize; k++)
00155 {
00156 if(choice == 1)
00157 {
00158 printf("%f ",CINNICreate.FourDNeuralMap[i][j][k][l].ang2);
00159 outfile << CINNICreate.FourDNeuralMap[i][j][k][l].ang2 << "\t";
00160 }
00161 if(choice == 2)
00162 {
00163 printf("%f ",CINNICreate.FourDNeuralMap[i][j][k][l].ang);
00164 outfile << CINNICreate.FourDNeuralMap[i][j][k][l].ang << "\t";
00165 }
00166 if(choice == 3)
00167 {
00168 printf("%f ",CINNICreate.FourDNeuralMap[i][j][k][l].dis);
00169 outfile << CINNICreate.FourDNeuralMap[i][j][k][l].dis << "\t";
00170 }
00171 if(choice == 4)
00172 {
00173 if(CINNICreate.FourDNeuralMap[i][j][k][l].pol)
00174 {
00175 std::cout << "1";
00176 }
00177 else
00178 {
00179 std::cout << "0";
00180 }
00181 std::cout << ":";
00182 if(CINNICreate.FourDNeuralMap[i][j][k][l].sender)
00183 {
00184 std::cout << "1";
00185 }
00186 else
00187 {
00188 std::cout << "0";
00189 }
00190 std::cout << " ";
00191 }
00192 if(choice == 5)
00193 {
00194 printf("%f ",CINNICreate.FourDNeuralMap[i][j][k][l].angAB);
00195 outfile << CINNICreate.FourDNeuralMap[i][j][k][l].angAB << "\t";
00196 }
00197 if(choice == 6)
00198 {
00199 printf("%f ",CINNICreate.FourDNeuralMap[i][j][k][l].angABD);
00200 outfile << CINNICreate.FourDNeuralMap[i][j][k][l].angABD << "\t";
00201 }
00202 if(choice == 7)
00203 {
00204 if(CINNICreate.FourDNeuralMap[i][j][k][l].coLinear)
00205 {
00206 std::cout << "1";
00207 }
00208 else
00209 {
00210 std::cout << "0";
00211 }
00212 std::cout << " ";
00213 }
00214 }
00215 }
00216 }
00217 }
00218 }
00219 }
00220 }
00221 (void) time(&t2);
00222 long int tl = (long int) t2-t1;
00223 printf("\n*************************************\n");
00224 printf("Time to execute, %ld seconds\n",tl);
00225 printf("*************************************\n\n");
00226
00227
00228
00229 return 1;
00230 }
00231
00232
00233
00234
00235
00236