]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.h
9c3868d46186cde815975b6cb0955a127b985323
[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         vtkImageData* getImageData();
115         void getImageRange(double[2]);
116         void onSegmentationOneSlice(int isovalue,int sampling,int method);
117         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
118         int GetImageDataSizeZ();
119         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
120         void onMirrorPressed();
121         void onMirror();
122         void onMirrorAxisShow();
123         void onMirrorAxisHide();
124         void onMirrorChangeWidth(int width);
125         void onThresholdPressed();
126         void setLabelSegmentationPanelVTK(wxString tmpString);
127         void onSegmentationPressed();
128         void onSegmentationPressedITK();
129         void onRigidPressed();
130         void onWidthOfContour(double width);
131         int getColorWindow();
132         int getWindowLevel();
133         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
134         void onInterpolation(bool interpolate);
135         void onSpreadPressed();
136         void onConfigurationPressed();
137         void resetAppend();
138         void onSpreadAdd();
139         void appendStringSpread(std::string val);
140         void onSpreadGo(int type);
141         void setStringSpread(std::string stringtemp);
142         void onInformationPressed();
143         void getInstantVector(std::vector<int>& tempVector);
144         std::vector<std::string> getOutlinesName(int slide);
145         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
146         void setStringInfoPanel(wxString tmpString);    
147         void setRowLabelInfoPanel(int z, wxString tempString);
148         int getNumberColsInformationPanel();
149         void appendColsInformationPanel(int _numberOfVariablesStatistics);
150         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
151         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
152         void onSaveResults(std::string directory,std::string namefile, std::string filename,
153                 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
154         wxString getCellValue(int j,int i);
155         void onSnakePressed();
156         virtual bool Show(bool show);
157         void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
158         void SetContourGroup(int contourGroup);
159
160 private:
161         
162
163         static interfMainPanel* interfmainpanel;
164
165
166         static wxFrame* _newframe;
167         wxPanel* menubar;
168         wxPanel* menubar1;
169         wxPanel* menubar2;
170         wxPanel* menubar3;
171         wxPanel* menubar4;
172         wxPanel* menubar5;
173
174         wxWindow* currentWindow;
175         wxSplitterWindow* splitterwindow;
176
177         wxPanel* infoPanel;
178         wxPanel* infoPanelMask;
179
180         wxStaticText* statictext;
181         wxStaticText* statictext1;
182         wxStaticText* statictext2;
183         wxStaticText* statictext3;
184         wxStaticText* statictext4;
185         wxStaticText* statictext5;
186
187         std::string PANEL;
188         std::string PANEL1;
189         std::string PANEL2;
190         std::string PANEL3;
191         std::string PANEL4;
192         std::string PANEL5;
193
194         wxPanel* segmentPanel;
195         wxPanel* segmentationPanel;
196         wxPanel* segmentPanelITK;
197         wxPanel* configPanel;
198         wxPanel* spreadPanel;
199         interfSpreadPanel* panelSpread;
200         wxWindow* infoWin;
201         wxPanel* informationPanel;
202         
203         wxPanel* mirrorPanel;
204         interfMirrorPanel* panelMirror; 
205         wxPanel* thresholdPanel;
206         
207         bool axisshown;
208         bool refLineShown;
209         
210         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
211         //list of contours
212         interfToolsSpreadPanel* toolspread;
213
214         /**
215         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
216         **      and removed.
217         **      @params size of the buttons panel
218         **      @params sizey of the buttons panel
219         **      @params evtHandler this is the class in charge of responding to the events of the buttons
220         **/
221         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
222
223         /**
224         **      initialize a statictext component of the interface
225         **/
226         wxStaticText* getText(wxWindow* parent, std::string nom);
227         /**
228         ** initializes a button with data
229         **/
230         wxButton* getButton(wxWindow* parent);
231         /**
232         ** Puts the panel button and the text int the sizer
233         **/
234         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
235
236         
237 };
238
239 #endif
240