]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.h
90bd7838f3480aa760bd7246abaef76d7b544a20
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.h
1 #ifndef __interfMainPanel_h_INCLUDED_H__
2 #define __interfMainPanel_h_INCLUDED_H__
3
4 #pragma once
5
6 #include <wx/wx.h>
7 //#include "wxContourEventHandler.h"
8
9 #include "interfNewContourMenu.h"
10 #include "interfIOMenu.h"
11 #include "interfEditMenu.h"
12 #include "interfDeleteMenu.h"
13 #include "interfToolsMenu.h"
14 #include "interfToolsSpreadPanel.h"
15 #include "interfSegmentationMenu.h"
16 #include "interfMenuBar.h"
17 #include "interfSegmentationPanels.h"
18 #include "interfToolsPanels.h"
19
20 #include <wx/treebook.h>
21 #include <wx/sizer.h>
22 #include <wx/button.h>
23 #include <wx/stattext.h>
24 #include <wx/splitter.h>
25 #include <wx/statline.h>
26
27 #include "vtkImageData.h"
28
29 class interfMainPanel : public wxPanel {
30
31 public:
32         
33         interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
34         ~interfMainPanel(void);
35
36         /**     This method should be called the first time by the parent class
37         **      in creates all the panels the first time
38         **/
39         static interfMainPanel* getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler=NULL );
40         /**     This method should be called the first time by the parent class
41         **      in creates all the panels the first time
42         **/
43         static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler=NULL);
44         /**
45         **      Gets the instance of the class
46         **/
47         static interfMainPanel* getInstance();
48         /**
49         **      Ressts the instance of the class
50         **/
51         static void resetInstance();
52
53         /**
54         **      Adds a new checkbox to the scrolledwindow using the checkboxsizer
55         **      @Params id of contour
56         **      
57         **/
58         void addContourCheckBox(std::string id);
59
60         /**
61         **      Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
62         **      @Params id of contour
63         **      
64         **/
65         void removeContourCheckBox(std::string id);
66
67
68         /**
69         **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
70         **      of the button corresponding to the method that has to be executed,
71         **      it uses attribute eventHandler to call the methods define by the application.
72         **      see setEventHandler(wxEventHandler*)
73         **/
74         void onActionButtonPressed1( wxCommandEvent& event );
75
76         /**
77         **      Shows the panel in the 
78         **/
79         void showPanel(wxWindow* panel);
80
81         /**
82         **      Hides the panel in the 
83         **/
84         void hidePanel( );
85
86         /**
87         **      Gets the Information panel
88         **/
89         wxPanel* getInfoPanel();
90         
91         /**
92         **      This methods connect the event in the class interfNewContourMenu with the world of the appli
93         **/
94         void onCreateContourSpline( );
95         void onCreateContourRectangle( );
96         void onCreateContourCircle( );
97         void onCreateContourLine( );
98         void onCreateContoursBullEye(wxPanel* panBull);
99         /////////////////////////////////
100         void onDeleteContour();
101         void onDeleteContoursActSlice();
102         void onDeleteAllContours();
103         /////////////////////////
104         void onCopy();
105         void onPaste();
106         void onUndo();
107         void onRedo();
108
109         //////////////////////////
110         void onLoad();
111         void onSave();
112 /////////////////////////////7
113         void RefreshInterface();
114
115         vtkImageData* getImageData();
116
117         void getImageRange(double[2]);
118
119         void onSegmentationOneSlice(int isovalue,int sampling,int method);
120
121         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
122
123         int GetImageDataSizeZ();
124
125         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
126
127         void onMirrorPressed();
128
129         void onMirror();
130
131         void onMirrorAxisShow();
132
133         void onMirrorAxisHide();
134
135         void onMirrorChangeWidth(int width);
136
137         void onThreshold();
138
139         void onThresholdChange();
140
141         void onThresholdInstantChange(double range[]);
142
143         void onThresholdRemove();
144
145         void onThresholdPressed();
146
147         void onThresholdInterpolation(bool interpolate);
148
149         void onThresholdChangeOpacity (int opacity);
150
151         void setLabelSegmentationPanelVTK(wxString tmpString);
152
153         void onSegmentationPressed();
154
155         void onSegmentationPressedITK();
156
157         void onRigidPressed();
158
159         void onWidthOfContour(double width);
160
161         int getColorWindow();
162         int getWindowLevel();
163
164         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
165
166         void onInterpolation(bool interpolate);
167
168         void onSpreadPressed();
169
170         void onConfigurationPressed();
171
172         void resetAppend();
173
174         void onSpreadAdd();
175
176         void appendStringSpread(std::string val);
177
178         void onSpreadGo(int type);
179
180         void setStringSpread(std::string stringtemp);
181
182         void onInformationPressed();
183
184         
185         void getInstantVector(std::vector<int>& tempVector);
186
187         std::vector<std::string> getOutlinesName(int slide);
188
189         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ);
190
191         void setStringInfoPanel(wxString tmpString);    
192
193         void setRowLabelInfoPanel(int z, wxString tempString);
194
195         int getNumberColsInformationPanel();
196         
197         void appendColsInformationPanel(int _numberOfVariablesStatistics);
198
199         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
200
201         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
202
203         void onSaveResults(std::string directory,std::string namefile, std::string filename,
204                 int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
205
206         wxString getCellValue(int j,int i);
207
208         void onSnakePressed();
209
210         virtual bool Show(bool show);
211
212 private:
213         
214
215         static interfMainPanel* interfmainpanel;
216
217
218         static wxFrame* _newframe;
219         wxPanel* menubar;
220         wxPanel* menubar1;
221         wxPanel* menubar2;
222         wxPanel* menubar3;
223         wxPanel* menubar4;
224         wxPanel* menubar5;
225
226         wxWindow* currentWindow;
227         wxSplitterWindow* splitterwindow;
228
229         wxPanel* infoPanel;
230
231         wxStaticText* statictext;
232         wxStaticText* statictext1;
233         wxStaticText* statictext2;
234         wxStaticText* statictext3;
235         wxStaticText* statictext4;
236         wxStaticText* statictext5;
237
238         std::string PANEL;
239         std::string PANEL1;
240         std::string PANEL2;
241         std::string PANEL3;
242         std::string PANEL4;
243         std::string PANEL5;
244
245         wxPanel* segmentPanel;
246         wxPanel* segmentationPanel;
247         wxPanel* segmentPanelITK;
248         wxPanel* configPanel;
249         wxPanel* spreadPanel;
250         interfSpreadPanel* panelSpread;
251         wxWindow* infoWin;
252         wxPanel* informationPanel;
253         
254         wxPanel* mirrorPanel;
255         interfMirrorPanel* panelMirror; 
256         wxPanel* thresholdPanel;
257         interfThresholdPanel* panelThreshold;
258
259         bool axisshown;
260         bool refLineShown;
261         
262         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
263         //list of contours
264         interfToolsSpreadPanel* toolspread;
265
266         /**
267         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
268         **      and removed.
269         **      @params size of the buttons panel
270         **      @params sizey of the buttons panel
271         **      @params evtHandler this is the class in charge of responding to the events of the buttons
272         **/
273         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
274
275         /**
276         **      initialize a statictext component of the interface
277         **/
278         wxStaticText* getText(wxWindow* parent, std::string nom);
279         /**
280         ** initializes a button with data
281         **/
282         wxButton* getButton(wxWindow* parent);
283         /**
284         ** Puts the panel button and the text int the sizer
285         **/
286         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
287
288         
289 };
290
291 #endif
292