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