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 # ------------------------------------------------------------------------
29 #ifndef __creaImageIOWxDescriptorPanel_h_INCLUDED__
30 #define __creaImageIOWxDescriptorPanel_h_INCLUDED__
37 #include <creaImageIOWxGimmickView.h>
38 #include <wx/listctrl.h>
39 #include <wx/statline.h>
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
59 //=====================================================================
60 //=====================================================================
61 /// Gimmick DB are based on descriptors with a tree structure .
62 /// Each level contains attributes (DICOM or other) to identify data
63 /// WxDescriptorPanel allows creation, modification and save of descriptors.
66 class WxDescriptorPanel : public wxDialog
70 WxDescriptorPanel(wxWindow *parent, const std::string path);
73 // Get file to load Descriptor
74 const std::string& GetDescriptor(){ return m_DscpFile;}
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
85 /// Add an attribute (DICOM or own)
86 void OnAddAttribute(wxCommandEvent& event);
88 /// Add an attribute (DICOM or own)
89 void onAddAttribute( const std::string &att, const std::string &name_att, std::string level = "");
92 void OnAddLevel(wxCommandEvent& event);
95 void onAddLevel(const std::string &level);
97 /// Find a DICOM attribute from group and element values
98 void OnDicomAttribute(wxCommandEvent& event);
100 /// Remove a value (level or attribute)
101 void OnRemove(wxCommandEvent& event);
103 /// Create a new descriptor
104 void OnNew(wxCommandEvent& event);
106 /// Load an exsitant descriptor
107 void OnLoad(wxCommandEvent& event);
109 /// Save a descriptor
110 void OnOK(wxCommandEvent& event);
112 /// Save a descriptor and use it
113 void OnApply(wxCommandEvent& event);
116 void OnCancel(wxCommandEvent& event);
118 /// Create a descriptor structure
119 void CreateDescriptor(int type);
122 bool addLevel(const std::string &name);
125 bool addAtribute(const std::string &level, const std::string &name);
127 /// remove an attribute
128 bool RemoveAttribute(const std::string &level, const std::string &name);
131 bool RemoveLevel(const std::string &name);
133 /// Create a descriptor file
134 void createDescriptorFile();
136 /// load a descriptor file
137 void loadDescriptor(const std::string i_name);
139 /// find a level'name
140 std::string findLevel();
142 /// determine values for own attributes
143 std::string OwnAttribute(const std::string name);
145 /// save a descriptor in a file
146 const std::string saveDescriptor();
151 /// Insert point in result control
154 /// Output file for Descriptor
155 std::string m_DscpFile;
157 /// Output Descriptor
160 // Vector of attributes
161 std::vector<std::string> VLevel;
163 // map of level, attributes
164 std::map<std::string, std::vector<std::string> > DscpTree;
166 // map of own application attributes
167 std::map<std::string, std::string> ownatt;
169 // List of added level
170 std::map<int, std::string> lvlist;
175 }; // class WxDescriptorPanel
176 //=====================================================================
179 } // EO namespace creaImageIO
182 #endif // USE_WIDGETS