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