1 #ifndef __creaImageIOoutputModel_h_INCLUDED__
2 #define __creaImageIOoutputModel_h_INCLUDED__
3 #if defined (USE_XERCES)
4 #include <creaImageIOOutputModelParser.h>
7 #include <gdcmScanner.h>
13 #define OUTPUTMODEL_TAG_i ""
14 #define OUTPUTMODEL_TAG_0 "TAG_BEGIN"
15 #define OUTPUTMODEL_TAG_1 "TAG_END"
16 #define OUTPUTMODEL_TAG_2 "TAG_STEP"
17 #define OUTPUTMODEL_TAG_3 "DICOM_TAG"
18 #define OUTPUTMODEL_TAG_4 "ANCHOR"
19 #define OUTPUTMODEL_TAG(i) OUTPUTMODEL_TAG_ ## i
28 virtual ~OutputModel();
29 double orderFilesWithZspacing(std::vector<std::string> &im);
31 #if defined(USE_XERCES)
32 OutputModel(OutputModelParser *i_outparser);
34 // Test if we need to check the "dicom" tag if it exists on database
35 void setDB(const std::string i_db, const std::string i_table);
37 const std::string getTag();
41 OutputModelParser *m_outparser;
43 // dimensions of output
46 // index to indicate if one model is available to perform sorting
49 // index to indicate of a "DICOM" tag is selected to perform sorting
50 // not necessary a dicom tag
51 // for the moment only Gimmick Tag format accepted but should be GDCM2 format or GDCM1.3 too
61 //void getReadValues(const std::vector<std :: string> i_filenames, std::vector<T> &o_val);
62 double orderFiles(std::vector<std::string> im, std::vector<std::string> &out);
65 #if defined(USE_GDCM2)
69 void getScanValues(const std::vector<std :: string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
71 /*template<typename T>
75 // the initial value to start sorting
78 // the final value to end sorting
81 // step for the values
84 // if the sorting is not the same for the set of data, we include another OutputModel
85 // ex : if we want a step = 20 for the 100 first values, next a step = 10 for the next 100 and step = 1 for the lastest value
88 // indicates if the sorting tag is present in database or not
96 void getValues(const std::vector<std::string> i_filenames,const std::string i_tag, std::map< std::string, T> &o_val);
98 void getDBValues(const std::vector<std::string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
100 void sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort, int level);
102 bool checkModel(std::map<std::string, std::string> i_model, const std::string i_val);
111 std::map <std::string, T> values;
112 std::map<std::string, T> tags;
114 void setTag(T i_tag, const std::string name)
119 void sort (const std::map<std::string, T> i_values, std::vector<std::string> &o_sort)
121 std::map<std::string, T>::const_iterator it_val;
122 for(T index = tags[OUTPUTMODEL_TAG(0)]; index <= tags[OUTPUTMODEL_TAG(1)]; index += tags[OUTPUTMODEL_TAG(2)])
124 //std::map<std::string, T>::const_iterator it_val;
125 for(it_val = i_values.begin();it_val != i_values.end(); it_val++)
127 if(it_val->second.c_str() == index)
129 o_sort.push_back(it_val->first.c_str());
138 } // namespace creaImageIO
139 #endif //__creaImageIOoutputModel_h_INCLUDED__