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