1 #ifndef __creaImageIOoutputModel_h_INCLUDED__
2 #define __creaImageIOoutputModel_h_INCLUDED__
3 #if defined (USE_XERCES)
4 #include <creaImageIOOutputModelParser.h>
7 #include <gdcmScanner.h>
11 #define OUTPUTMODEL_TAG_i ""
12 #define OUTPUTMODEL_TAG_0 "TAG_BEGIN"
13 #define OUTPUTMODEL_TAG_1 "TAG_END"
14 #define OUTPUTMODEL_TAG_2 "TAG_STEP"
15 #define OUTPUTMODEL_TAG_3 "DICOM_TAG"
16 #define OUTPUTMODEL_TAG_4 "ANCHOR"
17 #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);
37 // Test if we need to check the "dicom" tag if it exists on database
38 void setDB(const std::string i_db, const std::string i_table);
40 const std::string getTag();
45 OutputModelParser *m_outparser;
47 // dimensions of output
50 // index to indicate if one model is available to perform sorting
53 // index to indicate of a "DICOM" tag is selected to perform sorting
54 // not necessary a dicom tag
55 // for the moment only Gimmick Tag format accepted but should be GDCM2 format or GDCM1.3 too
65 //void getReadValues(const std::vector<std :: string> i_filenames, std::vector<T> &o_val);
66 double orderFiles(std::vector<std::string> im, std::vector<std::string> &out);
69 #if defined(USE_GDCM2)
73 void getScanValues(const std::vector<std :: string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
75 /*template<typename T>
79 // the initial value to start sorting
82 // the final value to end sorting
85 // step for the values
88 // if the sorting is not the same for the set of data, we include another OutputModel
89 // 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
92 // indicates if the sorting tag is present in database or not
100 void getValues(const std::vector<std::string> i_filenames,const std::string i_tag, std::map< std::string, T> &o_val);
102 void getDBValues(const std::vector<std::string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
104 void sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort, int level);
106 bool checkModel(std::map<std::string, std::string> i_model, const std::string i_val);
113 std::map <std::string, T> values;
114 std::map<std::string, T> tags;
116 void setTag(T i_tag, const std::string name)
121 void sort (const std::map<std::string, T> i_values, std::vector<std::string> &o_sort)
123 for(T index = tags[OUTPUTMODEL_TAG(0)]; index <= tags[OUTPUTMODEL_TAG(1)]; index += tags[OUTPUTMODEL_TAG(2)])
125 std::map<std::string, T>::const_iterator it_val = i_values.begin();
126 for(;it_val != values.end(); it_val++)
128 if(it_val->second.c_str() == index)
130 o_sort.push_back(it_val->first.c_str());
137 } // namespace creaImageIO
138 #endif //__creaImageIOoutputModel_h_INCLUDED__