]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.h
c28928b39e4519d3e97a88293c51f4639b9ab6e3
[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 GetImageDataRange(double *range);
126
127         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
128
129         void onMirrorPressed();
130
131         void onMirror();
132
133         void onMirrorAxisShow();
134
135         void onMirrorAxisHide();
136
137         void onMirrorChangeWidth(int width);
138
139         void onThreshold(int minVal, int maxVal);
140
141         void onThresholdChange(int minVal, int maxVal);
142
143         void onThresholdInstantChange(int range[]);
144
145         void onThresholdRemove();
146
147         void onThresholdPressed();
148
149         void onThresholdInterpolation(bool interpolate);
150
151         void onThresholdChangeOpacity (int opacity);
152
153         void setLabelSegmentationPanelVTK(wxString tmpString);
154
155         void onSegmentationPressed();
156
157         void onSegmentationPressedITK();
158
159         void onRigidPressed();
160
161         void onWidthOfContour(double width);
162
163         int getColorWindow();
164         int getWindowLevel();
165
166         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
167
168         void onInterpolation(bool interpolate);
169
170         void onSpreadPressed();
171
172         void onConfigurationPressed();
173
174         void resetAppend();
175
176         void onSpreadAdd();
177
178         void appendStringSpread(std::string val);
179
180         void onSpreadGo(int type);
181
182         void setStringSpread(std::string stringtemp);
183
184         void onInformationPressed();
185
186         
187         void getInstantVector(std::vector<int>& tempVector);
188
189         std::vector<std::string> getOutlinesName(int slide);
190
191         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ);
192
193         void setStringInfoPanel(wxString tmpString);    
194
195         void setRowLabelInfoPanel(int z, wxString tempString);
196
197         int getNumberColsInformationPanel();
198         
199         void appendColsInformationPanel(int _numberOfVariablesStatistics);
200
201         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
202
203         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
204
205         void onSaveResults(std::string directory,std::string namefile, std::string filename,int typeContourGroup);
206
207         wxString getCellValue(int j,int i);
208
209         void onSnakePressed();
210
211         virtual bool Show(bool show);
212
213 private:
214         
215
216         static interfMainPanel* interfmainpanel;
217
218
219         static wxFrame* _newframe;
220         wxPanel* menubar;
221         wxPanel* menubar1;
222         wxPanel* menubar2;
223         wxPanel* menubar3;
224         wxPanel* menubar4;
225         wxPanel* menubar5;
226
227         wxWindow* currentWindow;
228         wxSplitterWindow* splitterwindow;
229
230         wxPanel* infoPanel;
231
232         wxStaticText* statictext;
233         wxStaticText* statictext1;
234         wxStaticText* statictext2;
235         wxStaticText* statictext3;
236         wxStaticText* statictext4;
237         wxStaticText* statictext5;
238
239         std::string PANEL;
240         std::string PANEL1;
241         std::string PANEL2;
242         std::string PANEL3;
243         std::string PANEL4;
244         std::string PANEL5;
245
246         wxPanel* segmentPanel;
247         wxPanel* segmentationPanel;
248         wxPanel* segmentPanelITK;
249         wxPanel* configPanel;
250         wxPanel* spreadPanel;
251         interfSpreadPanel* panelSpread;
252         wxWindow* infoWin;
253         wxPanel* informationPanel;
254         
255         wxPanel* mirrorPanel;
256         interfMirrorPanel* panelMirror; 
257         wxPanel* thresholdPanel;
258         interfThresholdPanel* panelThreshold;
259
260         bool axisshown;
261         bool refLineShown;
262         
263         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
264         //list of contours
265         interfToolsSpreadPanel* toolspread;
266
267         /**
268         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
269         **      and removed.
270         **      @params size of the buttons panel
271         **      @params sizey of the buttons panel
272         **      @params evtHandler this is the class in charge of responding to the events of the buttons
273         **/
274         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
275
276         /**
277         **      initialize a statictext component of the interface
278         **/
279         wxStaticText* getText(wxWindow* parent, std::string nom);
280         /**
281         ** initializes a button with data
282         **/
283         wxButton* getButton(wxWindow* parent);
284         /**
285         ** Puts the panel button and the text int the sizer
286         **/
287         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
288
289         
290 };
291
292 #endif
293