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