|
Open PaperOpt
|
00001 #pragma once 00002 #ifndef OUTPUT_H 00003 #define OUTPUT_H 00004 00005 #include <vector> 00006 #include <string> 00007 #include <iostream> 00008 #include <fstream> 00009 #include <sstream> 00010 #include <time.h> 00011 00012 #ifdef ENABLEHDF 00013 #include "hdf5.h" 00014 #include "h5cpp.h" 00015 #endif 00016 00017 00018 using namespace std; 00019 00020 namespace IO{ 00021 00022 enum fileType{HDF, BINARY}; 00030 class Output 00031 { 00032 public: 00038 Output(string resultsDirectory); 00039 ~Output(void); 00040 00047 void writeResultsStart(string description, string date, vector<float>& rLambda); 00048 00056 void writeFloatList(std::vector<float>& rList, std::string listName, int upTo); 00057 00062 void writeResultsEnd(); 00063 00064 00078 void writeImageResults(int resX, int resY, int nrLambda,double pixelSizeX, double pixelSizeY, double* pRefl, double* pReflP, double* pReflS); 00079 00092 void writeARSResults(int nrTheta, int nrPhi, int nrLambda, double* pRefl, double* pReflP, double* pReflS, double* pReflSurf, double* pReflSurfP,double* pReflSurfS); 00093 00100 void writeElrephoResults(const std::vector<float>& rLambdas, double* pReflTot); 00101 00102 00103 00111 void writeARSGlobeResults(int nrTheta, int nrPhi, int nrLambda, double* pRefl); 00112 00121 void writePLRResults(int nrDistances,double distance ,int nrLambda, int* pReflectance ); 00122 00123 00124 void writeScatEventResults(int nrDistances,double distance ,int nrLambda, int* pReflectance ); 00125 00126 00127 00128 private: 00135 string intToString(int number); 00136 00137 void writeImageResultsToBinary(int resX, int resY, int nrLambda, double* refl, double* reflP, double* reflS, 00138 string file1, string file2, string file3); 00139 void writeARSResultsToBinary(int nrTheta, int nrPhi, int nrLambda, double* refl, double* reflP, double* reflS, double* reflSurf, double* reflSurfP,double* reflSurfS, 00140 string file1, string file2, string file3, string file4, string file5, string file6); 00141 00142 void writeElrephoToBinary(int nrLambda, const vector<float>& rLambdas, double* reflTot, string fileName); 00143 00144 void writePLRToBinary(int nrDistances,double distance ,int nrLambda, int* pReflectance , string fileName); 00145 00146 00147 void writeTableElement(vector<string>& rColumns, int nrRows, string fileName); 00148 void writeBinaryFileTag(string& rFileName); 00149 #ifdef ENABLEHDF 00150 void writeImageResultsToHDF(int resX, int resY,int nrLambda, double* refl, double* reflP, double* reflS, string fileName); 00151 void writeARSResultsToHDF(int nrTheta, int nrPhi, int nrLambda, double* refl, double* reflP, double* reflS, double* reflSurf, double* reflSurfP,double* reflSurfS, string filename); 00152 00153 00154 //TODO: MODIFY THESE SO THEY OUTPUT TABLES INSTEAD OF ARRAYS IF POSSIBLE. 00155 void writeElrephoToHDF(int nrLambda, const vector<float>& rLambdas, double* reflTot, string fileName); 00156 void writeARSGlobeToHDF(int nrTheta, int nrPhi, int nrLambda, double* refl,string fileName); 00157 void writePLRToHDF(int nrDistances,double distance, int nrLambda, int* pReflectance , string fileName); 00158 void writeSCATEVENTToHDF(int nrDistances,double distance, int nrLambda, int* pReflectance , string fileName); 00159 00160 00161 #endif 00162 bool isBigendian; 00163 string mResultsDirectory; //Directory where output will be placed. 00164 00165 //Results are writted to the file this ofstream is linked to. 00166 ofstream xmlFile; 00167 string mBinaryDirectory; 00168 }; 00169 } 00170 00171 #endif