]> 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 "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 appendStringSpread(std::string val);
152         void onSpreadGo(int type);
153         void setStringSpread(std::string stringtemp);
154         void onInformationPressed();
155         void getInstantVector(std::vector<int>& tempVector);
156         std::vector<std::string> getOutlinesName(int slide);
157         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
158         void setStringInfoPanel(wxString tmpString);    
159         void setRowLabelInfoPanel(int z, wxString tempString);
160         int getNumberColsInformationPanel();
161         void appendColsInformationPanel(int _numberOfVariablesStatistics);
162         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
163         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
164         void SetScalarRange(int grayRangeMin,int grayRangeMax);
165         void onSaveResults(std::string directory,std::string namefile, std::string filename,
166                 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
167         wxString getCellValue(int j,int i);
168         void onSnakePressed();
169         virtual bool Show(bool show);
170         void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
171         void SetContourGroup(int contourGroup);
172
173 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
174         
175         /**
176         * Associates the current selected contour with a label
177         */
178         void onPrintLabel();
179         
180         
181         /**
182         * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
183         * @param size Size in milimeters of the selected contour
184         * @param unit Measurement unit
185         */
186         void onCalibration(wxString size, int unit);
187         
188         /**
189         * Calculate the pixel value in milimeters
190         * @param realSize Size of the contour in milimeters
191         * @param sizePixel Size of the contour in pixels
192         */
193         double onePixelSize (double realSize,double sizePixel);
194         
195         /**
196         * Returns the value of a pixel in milimeters
197         */
198         double GetPixelValue();
199 //------------------------------------------------------------------------------------------------------------
200
201 private:
202         
203
204         static interfMainPanel* interfmainpanel;
205
206
207         static wxFrame* _newframe;
208         wxPanel* menubar;
209         wxPanel* menubar1;
210         wxPanel* menubar2;
211         wxPanel* menubar3;
212         wxPanel* menubar4;
213         wxPanel* menubar5;
214         wxPanel* menubar6;
215
216         wxWindow* currentWindow;
217         wxSplitterWindow* splitterwindow;
218
219         wxPanel* infoPanel;
220         wxPanel* infoPanelMask;
221
222 //CMRU 17-08-09 ------------------------------------------------------------------
223         
224         /**
225         * Panel with the calibration options
226         */
227         wxPanel* infoPanelCalibration;
228         
229         /**
230         * Panel who contains the calibration panel and the information panel mask
231         */
232         wxPanel* panelAux;
233
234         /**
235         * Value of a pixel in milimeters
236         */
237         double _pixelValue; 
238 //--------------------------------------------------------------------------------
239
240         wxStaticText* statictext;
241         wxStaticText* statictext1;
242         wxStaticText* statictext2;
243         wxStaticText* statictext3;
244         wxStaticText* statictext4;
245         wxStaticText* statictext5;
246         wxStaticText* statictext6;
247
248         std::string PANEL;
249         std::string PANEL1;
250         std::string PANEL2;
251         std::string PANEL3;
252         std::string PANEL4;
253         std::string PANEL5;
254         std::string PANEL6;
255
256         wxPanel                         *segmentPanel;
257         wxPanel                         *segmentationPanel;
258         wxPanel                         *segmentPanelITK;
259         wxPanel                         *configPanel;
260         wxPanel                         *spreadPanel;
261         interfSpreadPanel       *panelSpread;
262         wxWindow                        *infoWin;
263         wxPanel                         *informationPanel;
264         
265         wxPanel                         *testPanel;
266         interfTestPanel         *panelTest;
267
268         wxPanel                         *mirrorPanel;
269         interfMirrorPanel       *panelMirror;   
270
271         wxPanel                         *thresholdPanel;
272         wxPanel                         *colorImageLayerPanel;
273         
274         bool axisshown;
275         bool refLineShown;
276         
277         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
278         //list of contours
279         interfToolsSpreadPanel* toolspread;
280
281         /**
282         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
283         **      and removed.
284         **      @params size of the buttons panel
285         **      @params sizey of the buttons panel
286         **      @params evtHandler this is the class in charge of responding to the events of the buttons
287         **/
288         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
289
290         /**
291         **      initialize a statictext component of the interface
292         **/
293         wxStaticText* getText(wxWindow* parent, std::string nom);
294         /**
295         ** initializes a button with data
296         **/
297         wxButton* getButton(wxWindow* parent);
298         /**
299         ** Puts the panel button and the text int the sizer
300         **/
301         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
302
303         
304 };
305
306 #endif
307