00001 #ifndef Impala_Core_Feature_DumpFeatureTableHistogram_h 00002 #define Impala_Core_Feature_DumpFeatureTableHistogram_h 00003 00004 #include "Core/Feature/FeatureTable.h" 00005 #include "Core/Feature/FeatureDefinition.h" 00006 #include "Core/Matrix/MatSum.h" 00007 00008 namespace Impala 00009 { 00010 namespace Core 00011 { 00012 namespace Feature 00013 { 00014 00015 void 00016 DumpFeatureTableHistogram(FeatureTable* table, FeatureDefinition fdef, int id) 00017 { 00018 ILOG_FUNCTION("Impala.Core.Feature.DumpFeatureTableHistogram"); 00019 String filename = fdef.AsString() + ".histogramdump" + MakeString(id); 00020 //ILOG_INFO("dumping table "<<filename); 00021 //ILOG_INFO("table size: "<<table->Size()); 00022 Array::Array2dScalarReal64* data = table->GetColumn2()->GetStorage(); 00023 Array::Array2dScalarReal64* hist = Matrix::MatSumColumns(data); 00024 //ILOG_INFO("hist size(): "<< hist->CW() <<", "<< hist->CH()); 00025 std::ofstream ofs(filename.c_str()); 00026 if(ofs.is_open()) 00027 { 00028 for(int i=0 ; i<hist->CW() ; ++i) 00029 { 00030 //ILOG_INFO(hist->Value(i, 0)); 00031 ofs << MakeString(hist->Value(i, 0)) <<" "; 00032 } 00033 ofs.close(); 00034 } 00035 else 00036 ILOG_ERROR("couldn't dump "<<filename); 00037 } 00038 00039 } // namespace 00040 } // namespace 00041 } // namespace 00042 00043 #endif