]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.h
*** empty log message ***
[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();
140
141         void onThresholdChange();
142
143         void onThresholdInstantChange(double 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,
206                 int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
207
208         wxString getCellValue(int j,int i);
209
210         void onSnakePressed();
211
212         virtual bool Show(bool show);
213
214 private:
215         
216
217         static interfMainPanel* interfmainpanel;
218
219
220         static wxFrame* _newframe;
221         wxPanel* menubar;
222         wxPanel* menubar1;
223         wxPanel* menubar2;
224         wxPanel* menubar3;
225         wxPanel* menubar4;
226         wxPanel* menubar5;
227
228         wxWindow* currentWindow;
229         wxSplitterWindow* splitterwindow;
230
231         wxPanel* infoPanel;
232
233         wxStaticText* statictext;
234         wxStaticText* statictext1;
235         wxStaticText* statictext2;
236         wxStaticText* statictext3;
237         wxStaticText* statictext4;
238         wxStaticText* statictext5;
239
240         std::string PANEL;
241         std::string PANEL1;
242         std::string PANEL2;
243         std::string PANEL3;
244         std::string PANEL4;
245         std::string PANEL5;
246
247         wxPanel* segmentPanel;
248         wxPanel* segmentationPanel;
249         wxPanel* segmentPanelITK;
250         wxPanel* configPanel;
251         wxPanel* spreadPanel;
252         interfSpreadPanel* panelSpread;
253         wxWindow* infoWin;
254         wxPanel* informationPanel;
255         
256         wxPanel* mirrorPanel;
257         interfMirrorPanel* panelMirror; 
258         wxPanel* thresholdPanel;
259         interfThresholdPanel* panelThreshold;
260
261         bool axisshown;
262         bool refLineShown;
263         
264         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
265         //list of contours
266         interfToolsSpreadPanel* toolspread;
267
268         /**
269         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
270         **      and removed.
271         **      @params size of the buttons panel
272         **      @params sizey of the buttons panel
273         **      @params evtHandler this is the class in charge of responding to the events of the buttons
274         **/
275         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
276
277         /**
278         **      initialize a statictext component of the interface
279         **/
280         wxStaticText* getText(wxWindow* parent, std::string nom);
281         /**
282         ** initializes a button with data
283         **/
284         wxButton* getButton(wxWindow* parent);
285         /**
286         ** Puts the panel button and the text int the sizer
287         **/
288         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
289
290         
291 };
292
293 #endif
294