creaImageIO_lib
creaImageIOWxDescriptorPanel.h
Go to the documentation of this file.
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # pour la Santé)
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
9 #
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.
16 #
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
21 # liability.
22 #
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 # ------------------------------------------------------------------------
26 */
27 
28 
29 #ifndef __creaImageIOWxDescriptorPanel_h_INCLUDED__
30 #define __creaImageIOWxDescriptorPanel_h_INCLUDED__
31 
32 #ifdef USE_WXWIDGETS
33 #include <creaWx.h>
34 #include <string>
35 #include <map>
36 #include <vector>
38 #include <wx/listctrl.h>
39 #include <wx/statline.h>
40 
41 
42 #define ID_DESCRIPTOR 1500
43 #define ID_LEVEL_CTRL ID_DESCRIPTOR+1
44 #define ID_LEVEL_ADD ID_DESCRIPTOR+2
45 #define ID_GR_CTRL ID_DESCRIPTOR+3
46 #define ID_EL_CTRL ID_DESCRIPTOR+4
47 #define ID_NAME_CTRL ID_DESCRIPTOR+5
48 #define ID_ATTRIBUTE_CTRL ID_DESCRIPTOR+6
49 #define ID_ATTRIBUTE_ADD ID_DESCRIPTOR+7
50 #define ID_REMOVE_ADD ID_DESCRIPTOR+8
51 #define ID_DSCP_APPLY ID_DESCRIPTOR+9
52 
53 namespace creaImageIO
54 {
55 
59  //=====================================================================
60  //=====================================================================
65 
66  class WxDescriptorPanel : public wxDialog
67  {
68  public:
70  WxDescriptorPanel(wxWindow *parent, const std::string path);
72 
73  // Get file to load Descriptor
74  const std::string& GetDescriptor(){ return m_DscpFile;}
75 
76  private :
77 
78  // WxControls
79  wxTextCtrl *LevelCtrl; //TextCtrl to enter level's name
80  wxTextCtrl *GRCtrl; // TextCtrl to enter DICOM Group value
81  wxTextCtrl *ELCtrl; // TextCtrl to enter DICOM element value
82  wxTextCtrl *ResultCtrl; //TextCtrl to visualize Descriptor
83  wxComboBox *AttributeCombo; // Combox to choose Attribute values
84 
86  void OnAddAttribute(wxCommandEvent& event);
87 
89  void onAddAttribute( const std::string &att, const std::string &name_att, std::string level = "");
90 
92  void OnAddLevel(wxCommandEvent& event);
93 
95  void onAddLevel(const std::string &level);
96 
98  void OnDicomAttribute(wxCommandEvent& event);
99 
101  void OnRemove(wxCommandEvent& event);
102 
104  void OnNew(wxCommandEvent& event);
105 
107  void OnLoad(wxCommandEvent& event);
108 
110  void OnOK(wxCommandEvent& event);
111 
113  void OnApply(wxCommandEvent& event);
114 
116  void OnCancel(wxCommandEvent& event);
117 
119  void CreateDescriptor(int type);
120 
122  bool addLevel(const std::string &name);
123 
125  bool addAtribute(const std::string &level, const std::string &name);
126 
128  bool RemoveAttribute(const std::string &level, const std::string &name);
129 
131  bool RemoveLevel(const std::string &name);
132 
134  void createDescriptorFile();
135 
137  void loadDescriptor(const std::string i_name);
138 
140  std::string findLevel();
141 
143  std::string OwnAttribute(const std::string name);
144 
146  const std::string saveDescriptor();
147 
149  int lv;
150 
152  long InsertPt;
153 
155  std::string m_DscpFile;
156 
158  std::string outDscp;
159 
160  // Vector of attributes
161  std::vector<std::string> VLevel;
162 
163  // map of level, attributes
164  std::map<std::string, std::vector<std::string> > DscpTree;
165 
166  // map of own application attributes
167  std::map<std::string, std::string> ownatt;
168 
169  // List of added level
170  std::map<int, std::string> lvlist;
171 
172  // DB Gimmick path
173  std::string m_path;
174 
175  }; // class WxDescriptorPanel
176  //=====================================================================
177 
178 
179 } // EO namespace creaImageIO
180 
181 
182 #endif // USE_WIDGETS
183 // EOF
184 #endif
185