![]() |
CASToR
1.0
Tomographic Reconstruction (PET/SPECT)
|
00001 00009 #ifndef GOPTIONS_HH 00010 #define GOPTIONS_HH 1 00011 00012 // ===================================================================== 00013 // --------------------------------------------------------------------- 00014 // --------------------------------------------------------------------- 00015 // ===================================================================== 00023 #define KEYWORD_MANDATORY true 00024 00025 #define KEYWORD_OPTIONAL false 00026 00027 #define KEYWORD_MANDATORY_NOT_FOUND 1 00028 00029 #define KEYWORD_OPTIONAL_NOT_FOUND 2 00030 00032 // ===================================================================== 00033 // --------------------------------------------------------------------- 00034 // --------------------------------------------------------------------- 00035 // ===================================================================== 00036 // Functions for command line parameters reading 00037 // Functions parsing a string composed of several numbers separated by commas. 00050 template<typename T> int ReadStringOption(const string& a_input, T* ap_return, int a_nbElts, const string& sep, const string& a_option); 00051 00052 // ===================================================================== 00053 // --------------------------------------------------------------------- 00054 // --------------------------------------------------------------------- 00055 // ===================================================================== 00056 // Functions for ASCII file input reading 00077 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, bool a_mandatoryFlag); 00078 00105 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag); 00106 00134 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T** a2p_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag); 00135 00164 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, bool a_mandatoryFlag, string a_firstTag, string a_lastTag); 00165 00200 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T** a2p_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag, string a_firstTag, string a_lastTag); 00201 00202 // ===================================================================== 00203 // --------------------------------------------------------------------- 00204 // --------------------------------------------------------------------- 00205 // ===================================================================== 00206 // Functions for data conversion 00215 int ConvertFromString(const string& a_str, string* a_result); 00216 00226 int ConvertFromString(const string& a_str, float* a_result); 00227 00237 int ConvertFromString(const string& a_str, double* a_result); 00238 00248 int ConvertFromString(const string& a_str, long double* a_result); 00249 00259 int ConvertFromString(const string& a_str, int* a_result); 00260 00270 int ConvertFromString(const string& a_str, int64_t* a_result); 00271 00281 int ConvertFromString(const string& a_str, uint8_t* a_result); 00282 00292 int ConvertFromString(const string& a_str, uint16_t* a_result); 00293 00303 int ConvertFromString(const string& a_str, uint32_t* a_result); 00304 00314 int ConvertFromString(const string& a_str, bool* a_result); 00315 00316 00325 bool FLTNBIsEqual(FLTNB a, FLTNB b, FLTNB a_eps); 00326 00327 00334 string GetFileFromPath(const string& a_pathToFile); 00335 00342 string GetPathOfFile(const string& a_pathToFile); 00343 00350 string ConvertAllSlashOccurrencesToBackSlash(const string& a_path); 00351 00352 #endif