2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
28 #ifndef __creaImageIOoutputModel_h_INCLUDED__
29 #define __creaImageIOoutputModel_h_INCLUDED__
30 #if defined (USE_XERCES)
31 #include <creaImageIOOutputModelParser.h>
33 #if defined(USE_GDCM2)
34 #include <gdcmScanner.h>
40 #define OUTPUTMODEL_TAG_i ""
41 #define OUTPUTMODEL_TAG_0 "TAG_BEGIN"
42 #define OUTPUTMODEL_TAG_1 "TAG_END"
43 #define OUTPUTMODEL_TAG_2 "TAG_STEP"
44 #define OUTPUTMODEL_TAG_3 "DICOM_TAG"
45 #define OUTPUTMODEL_TAG_4 "ANCHOR"
46 #define OUTPUTMODEL_TAG(i) OUTPUTMODEL_TAG_ ## i
55 virtual ~OutputModel();
56 double orderFilesWithZspacing(std::vector<std::string> &im);
58 #if defined(USE_XERCES)
59 OutputModel(OutputModelParser *i_outparser);
61 // Test if we need to check the "dicom" tag if it exists on database
62 void setDB(const std::string i_db, const std::string i_table);
64 const std::string getTag();
68 OutputModelParser *m_outparser;
70 // dimensions of output
73 // index to indicate if one model is available to perform sorting
76 // index to indicate of a "DICOM" tag is selected to perform sorting
77 // not necessary a dicom tag
78 // for the moment only Gimmick Tag format accepted but should be GDCM2 format or GDCM1.3 too
88 //void getReadValues(const std::vector<std :: string> i_filenames, std::vector<T> &o_val);
89 double orderFiles(std::vector<std::string> im, std::vector<std::string> &out);
92 #if defined(USE_GDCM2)
96 void getScanValues(const std::vector<std :: string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
98 /*template<typename T>
102 // the initial value to start sorting
105 // the final value to end sorting
108 // step for the values
111 // if the sorting is not the same for the set of data, we include another OutputModel
112 // 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
113 OutputModel *m_model;
115 // indicates if the sorting tag is present in database or not
123 void getValues(const std::vector<std::string> i_filenames,const std::string i_tag, std::map< std::string, T> &o_val);
125 void getDBValues(const std::vector<std::string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
127 void sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort, int level);
129 bool checkModel(std::map<std::string, std::string> i_model, const std::string i_val);
138 std::map <std::string, T> values;
139 std::map<std::string, T> tags;
141 void setTag(T i_tag, const std::string name)
146 void sort (const std::map<std::string, T> i_values, std::vector<std::string> &o_sort)
148 std::map<std::string, T>::const_iterator it_val;
149 for(T index = tags[OUTPUTMODEL_TAG(0)]; index <= tags[OUTPUTMODEL_TAG(1)]; index += tags[OUTPUTMODEL_TAG(2)])
151 //std::map<std::string, T>::const_iterator it_val;
152 for(it_val = i_values.begin();it_val != i_values.end(); it_val++)
154 if(it_val->second.c_str() == index)
156 o_sort.push_back(it_val->first.c_str());
165 } // namespace creaImageIO
166 #endif //__creaImageIOoutputModel_h_INCLUDED__