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