]> 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         // RaC 09-09 ---------------------
99         void onCreateContourPoints( );
100         // RaC 09-09 ---------------------
101
102         // RaC 10-09 ---------------------
103         void onCreateContourPolygon( );
104         // RaC 10-09 ---------------------
105         
106         void onCreateContoursBullEye(wxPanel* panBull);
107         /////////////////////////////////
108         void onDeleteContour();
109         void onDeleteContoursActSlice();
110         void onDeleteAllContours();
111         /////////////////////////
112         void onCopy();
113         void onPaste();
114         void onUndo();
115         void onRedo();
116
117         //////////////////////////
118         void onLoad();
119         void onSave();
120         void onImport();
121         void onTest();
122 /////////////////////////////7
123         void RefreshInterface();
124         vtkImageData* getImageData();
125         void getImageRange(double[2]);
126         void onSegmentationOneSlice(int isovalue,int sampling,int method);
127         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
128         int GetImageDataSizeZ();
129         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
130         void onMirrorPressed();
131         void onMirror();
132         void onMirrorAxisShow();
133         void onMirrorAxisHide();
134         void onMirrorChangeWidth(int width);
135         void onThresholdPressed();
136         void setLabelSegmentationPanelVTK(wxString tmpString);
137         void onSegmentationPressed();
138         void onSegmentationPressedITK();
139         void onRigidPressed();
140         void onWidthOfContour(double width);
141         int getColorWindow();
142         int getWindowLevel();
143         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
144         void onInterpolation(bool interpolate);
145         void onSpreadPressed();
146         void onConfigurationPressed();
147         void resetAppend();
148         void onSpreadAdd();
149         void appendStringSpread(std::string val);
150         void onSpreadGo(int type);
151         void setStringSpread(std::string stringtemp);
152         void onInformationPressed();
153         void getInstantVector(std::vector<int>& tempVector);
154         std::vector<std::string> getOutlinesName(int slide);
155         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
156         void setStringInfoPanel(wxString tmpString);    
157         void setRowLabelInfoPanel(int z, wxString tempString);
158         int getNumberColsInformationPanel();
159         void appendColsInformationPanel(int _numberOfVariablesStatistics);
160         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
161         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
162         void SetScalarRange(int grayRangeMin,int grayRangeMax);
163         void onSaveResults(std::string directory,std::string namefile, std::string filename,
164                 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
165         wxString getCellValue(int j,int i);
166         void onSnakePressed();
167         virtual bool Show(bool show);
168         void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
169         void SetContourGroup(int contourGroup);
170
171 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
172         
173         /**
174         * Associates the current selected contour with a label
175         */
176         void onPrintLabel();
177         
178         
179         /**
180         * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
181         * @param size Size in milimeters of the selected contour
182         * @param unit Measurement unit
183         */
184         void onCalibration(wxString size, int unit);
185         
186         /**
187         * Calculate the pixel value in milimeters
188         * @param realSize Size of the contour in milimeters
189         * @param sizePixel Size of the contour in pixels
190         */
191         double onePixelSize (double realSize,double sizePixel);
192         
193         /**
194         * Returns the value of a pixel in milimeters
195         */
196         double GetPixelValue();
197 //------------------------------------------------------------------------------------------------------------
198
199 private:
200         
201
202         static interfMainPanel* interfmainpanel;
203
204
205         static wxFrame* _newframe;
206         wxPanel* menubar;
207         wxPanel* menubar1;
208         wxPanel* menubar2;
209         wxPanel* menubar3;
210         wxPanel* menubar4;
211         wxPanel* menubar5;
212
213         wxWindow* currentWindow;
214         wxSplitterWindow* splitterwindow;
215
216         wxPanel* infoPanel;
217         wxPanel* infoPanelMask;
218
219 //CMRU 17-08-09 ------------------------------------------------------------------
220         
221         /**
222         * Panel with the calibration options
223         */
224         wxPanel* infoPanelCalibration;
225         
226         /**
227         * Panel who contains the calibration panel and the information panel mask
228         */
229         wxPanel* panelAux;
230
231         /**
232         * Value of a pixel in milimeters
233         */
234         double _pixelValue; 
235 //--------------------------------------------------------------------------------
236
237         wxStaticText* statictext;
238         wxStaticText* statictext1;
239         wxStaticText* statictext2;
240         wxStaticText* statictext3;
241         wxStaticText* statictext4;
242         wxStaticText* statictext5;
243
244         std::string PANEL;
245         std::string PANEL1;
246         std::string PANEL2;
247         std::string PANEL3;
248         std::string PANEL4;
249         std::string PANEL5;
250
251         wxPanel* segmentPanel;
252         wxPanel* segmentationPanel;
253         wxPanel* segmentPanelITK;
254         wxPanel* configPanel;
255         wxPanel* spreadPanel;
256         interfSpreadPanel* panelSpread;
257         wxWindow* infoWin;
258         wxPanel* informationPanel;
259         
260         wxPanel* mirrorPanel;
261         interfMirrorPanel* panelMirror; 
262         wxPanel* thresholdPanel;
263         
264         bool axisshown;
265         bool refLineShown;
266         
267         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
268         //list of contours
269         interfToolsSpreadPanel* toolspread;
270
271         /**
272         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
273         **      and removed.
274         **      @params size of the buttons panel
275         **      @params sizey of the buttons panel
276         **      @params evtHandler this is the class in charge of responding to the events of the buttons
277         **/
278         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
279
280         /**
281         **      initialize a statictext component of the interface
282         **/
283         wxStaticText* getText(wxWindow* parent, std::string nom);
284         /**
285         ** initializes a button with data
286         **/
287         wxButton* getButton(wxWindow* parent);
288         /**
289         ** Puts the panel button and the text int the sizer
290         **/
291         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
292
293         
294 };
295
296 #endif
297