1 #ifndef __creaImageIOWxDescriptorPanel_h_INCLUDED__
2 #define __creaImageIOWxDescriptorPanel_h_INCLUDED__
9 #include <creaImageIOWxGimmickView.h>
10 #include <wx/listctrl.h>
11 #include <wx/statline.h>
14 #define ID_DESCRIPTOR 1500
15 #define ID_LEVEL_CTRL ID_DESCRIPTOR+1
16 #define ID_LEVEL_ADD ID_DESCRIPTOR+2
17 #define ID_GR_CTRL ID_DESCRIPTOR+3
18 #define ID_EL_CTRL ID_DESCRIPTOR+4
19 #define ID_NAME_CTRL ID_DESCRIPTOR+5
20 #define ID_ATTRIBUTE_CTRL ID_DESCRIPTOR+6
21 #define ID_ATTRIBUTE_ADD ID_DESCRIPTOR+7
22 #define ID_REMOVE_ADD ID_DESCRIPTOR+8
23 #define ID_DSCP_APPLY ID_DESCRIPTOR+9
31 //=====================================================================
32 //=====================================================================
33 /// Gimmick DB are based on descriptors with a tree structure .
34 /// Ecah level contains attributes (DICOM or other) to identify data
35 /// WxDescriptorPanel allows creation, modification and save of descriptors.
38 class WxDescriptorPanel : public wxDialog
42 WxDescriptorPanel(wxWindow *parent, const std::string path);
45 // Get file to load Descriptor
46 const std::string& GetDescriptor(){ return m_DscpFile;}
51 wxTextCtrl *LevelCtrl; //TextCtrl to enter level's name
52 wxTextCtrl *GRCtrl; // TextCtrl to enter DICOM Group value
53 wxTextCtrl *ELCtrl; // TextCtrl to enter DICOM element value
54 wxTextCtrl *ResultCtrl; //TextCtrl to visualize Descriptor
55 wxComboBox *AttributeCombo; // Combox to choose Attribute values
57 /// Add an attribute (DICOM or own)
58 void OnAddAttribute(wxCommandEvent& event);
60 /// Add an attribute (DICOM or own)
61 void onAddAttribute( const std::string &att, const std::string &name_att, std::string level = "");
64 void OnAddLevel(wxCommandEvent& event);
67 void onAddLevel(const std::string &level);
69 /// Find a DICOM attribute from group and element values
70 void OnDicomAttribute(wxCommandEvent& event);
72 /// Remove a value (level or attribute)
73 void OnRemove(wxCommandEvent& event);
75 /// Create a new descriptor
76 void OnNew(wxCommandEvent& event);
78 /// Load an exsitant descriptor
79 void OnLoad(wxCommandEvent& event);
82 void OnOK(wxCommandEvent& event);
84 /// Save a descriptor and use it
85 void OnApply(wxCommandEvent& event);
88 void OnCancel(wxCommandEvent& event);
90 /// Create a descriptor structure
91 void CreateDescriptor(int type);
94 bool addLevel(const std::string &name);
97 bool addAtribute(const std::string &level, const std::string &name);
99 /// remove an attribute
100 bool RemoveAttribute(const std::string &level, const std::string &name);
103 bool RemoveLevel(const std::string &name);
105 /// Create a descriptor file
106 void createDescriptorFile();
108 /// load a descriptor file
109 void loadDescriptor(const std::string i_name);
111 /// find a level'name
112 std::string findLevel();
114 /// determine values for own attributes
115 std::string OwnAttribute(const std::string name);
117 /// save a descriptor in a file
118 const std::string saveDescriptor();
123 /// Insert point in result control
126 /// Output file for Descriptor
127 std::string m_DscpFile;
129 /// Output Descriptor
132 // Vector of attributes
133 std::vector<std::string> VLevel;
135 // map of level, attributes
136 std::map<std::string, std::vector<std::string> > DscpTree;
138 // map of own application attributes
139 std::map<std::string, std::string> ownatt;
141 // List of added level
142 std::map<int, std::string> lvlist;
147 }; // class WxDescriptorPanel
148 //=====================================================================
151 } // EO namespace creaImageIO
154 #endif // USE_WIDGETS