]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfMainPanel.h
d6a40a97c5f2846f293c01a1971da8e6228c83c4
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #ifndef __interfMainPanel_h_INCLUDED_H__
27 #define __interfMainPanel_h_INCLUDED_H__
28
29 #pragma once
30
31 #include <wx/wx.h>
32 //#include "wxContourEventHandler.h"
33
34 #include "interfNewContourMenu.h"
35 #include "interfIOMenu.h"
36 #include "interfEditMenu.h"
37 #include "interfDeleteMenu.h"
38 #include "interfToolsMenu.h"
39 #include "interfToolsSpreadPanel.h"
40 #include "interfSegmentationMenu.h"
41 #include "interfMenuBar.h"
42 #include "interfToolsPanels.h"
43 #include "interfSegmentationPanels.h"
44 #include "interfImageToolsMenu.h"
45
46 #include <wx/treebook.h>
47 #include <wx/sizer.h>
48 #include <wx/button.h>
49 #include <wx/stattext.h>
50 #include <wx/splitter.h>
51 #include <wx/statline.h>
52
53 #include "vtkImageData.h"
54
55 class interfMainPanel : public wxPanel {
56
57 public:
58
59         interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
60         ~interfMainPanel(void);
61
62         /**     This method should be called the first time by the parent class
63         **      in creates all the panels the first time
64         **/
65         static interfMainPanel* getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler=NULL );
66         /**     This method should be called the first time by the parent class
67         **      in creates all the panels the first time
68         **/
69         static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler=NULL);
70         /**
71         **      Gets the instance of the class
72         **/
73         static interfMainPanel* getInstance();
74         /**
75         **      Ressts the instance of the class
76         **/
77         static void resetInstance();
78
79         /**
80         **      Adds a new checkbox to the scrolledwindow using the checkboxsizer
81         **      @Params id of contour
82         **
83         **/
84         void addContourCheckBox(std::string id);
85
86         /**
87         **      Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
88         **      @Params id of contour
89         **
90         **/
91         void removeContourCheckBox(std::string id);
92
93
94         /**
95         **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
96         **      of the button corresponding to the method that has to be executed,
97         **      it uses attribute eventHandler to call the methods define by the application.
98         **      see setEventHandler(wxEventHandler*)
99         **/
100         void onActionButtonPressed1( wxCommandEvent& event );
101
102         /**
103         **      Shows the panel in the
104         **/
105         void showPanel(wxWindow* panel);
106
107         /**
108         **      Hides the panel in the
109         **/
110         void hidePanel( );
111
112         /**
113         **      Gets the Information panel
114         **/
115         wxPanel* getInfoPanel();
116
117         /**
118         **      This methods connect the event in the class interfNewContourMenu with the world of the appli
119         **/
120         void onCreateContourSpline( );
121         void onCreateContourRectangle( );
122         void onCreateContourCircle( );
123         void onCreateContourLine( );
124         // RaC 09-09 ---------------------
125         void onCreateContourPoints( );
126         // RaC 09-09 ---------------------
127
128         // RaC 10-09 ---------------------
129         void onCreateContourPolygon( );
130         // RaC 10-09 ---------------------
131
132         void onCreateContoursBullEye(wxPanel* panBull);
133         /////////////////////////////////
134         void onDeleteContour();
135         void onDeleteContoursActSlice();
136         void onDeleteAllContours();
137         /////////////////////////
138         void onCopy();
139         void onPaste();
140         void onUndo();
141         void onRedo();
142
143         //////////////////////////
144         void onLoad();
145         void onSave();
146         void onImport();
147         void onTest();
148 /////////////////////////////7
149         void RefreshInterface();
150         vtkImageData* getImageData();
151         void getImageRange(double[2]);
152         void onSegmentationOneSlice(int isovalue,int sampling,int method);
153         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
154         int GetImageDataSizeZ();
155         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
156         void onMirrorPressed();
157         void onMirror();
158         void onMirrorAxisShow();
159         void onMirrorAxisHide();
160         void onMirrorChangeWidth(int width);
161         void onThresholdPressed();
162         void onColorLayerImagePressed();
163         void setLabelSegmentationPanelVTK(wxString tmpString);
164         void onSegmentationPressed();
165         void onSegmentationPressedITK();
166         void onRigidPressed();
167         void onWidthOfContour(double width);
168         int getColorWindow();
169         int getWindowLevel();
170         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
171         void onInterpolation(bool interpolate);
172         void onShowTextContour(bool show);
173         void onBeforAfterContour(bool before, bool after);
174         void onSpreadPressed();
175         void onConfigurationPressed();
176         void resetAppend();
177         void onSpreadAdd();
178         void onSpreadAddAll();
179         void appendStringSpread(std::string val);
180         void onSpreadGo(int type);
181         void setStringSpread(std::string stringtemp);
182         void onInformationPressed();
183         void getInstantVector(std::vector<int>& tempVector);
184         std::vector<std::string> getOutlinesName(int slide);
185         void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
186         void setStringInfoPanel(wxString tmpString);
187         void setRowLabelInfoPanel(int z, wxString tempString);
188         int getNumberColsInformationPanel();
189         void appendColsInformationPanel(int _numberOfVariablesStatistics);
190         void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
191         void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
192         void SetScalarRange(int grayRangeMin,int grayRangeMax);
193         void onSaveResults(std::string directory,std::string namefile, std::string filename,
194                 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
195         wxString getCellValue(int j,int i);
196         void onSnakePressed();
197         virtual bool Show(bool show);
198         void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
199         void SetContourGroup(int contourGroup);
200         void onFlipContours();
201         void FlipContours(int typeContourFlip, int flipDirection);
202
203         
204 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
205
206         /**
207         * Associates the current selected contour with a label
208         */
209         void onPrintLabel();
210
211         /**
212         * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
213         * @param size Size in milimeters of the selected contour
214         * @param unit Measurement unit
215         */
216         void onCalibration(wxString size, int unit);
217
218         /**
219         * Calculate the pixel value in milimeters
220         * @param realSize Size of the contour in milimeters
221         * @param sizePixel Size of the contour in pixels
222         */
223         double onePixelSize (double realSize,double sizePixel);
224
225         /**
226         * Returns the value of a pixel in milimeters
227         */
228         double GetPixelValue();
229 //------------------------------------------------------------------------------------------------------------
230
231 private:
232
233
234         static interfMainPanel* interfmainpanel;
235
236
237         static wxFrame* _newframe;
238         wxPanel* menubar;
239         wxPanel* menubar1;
240         wxPanel* menubar2;
241         wxPanel* menubar3;
242         wxPanel* menubar4;
243         wxPanel* menubar5;
244         wxPanel* menubar6;
245
246         wxWindow* currentWindow;
247         wxSplitterWindow* splitterwindow;
248
249         wxPanel* infoPanel;
250         wxPanel* infoPanelMask;
251
252 //CMRU 17-08-09 ------------------------------------------------------------------
253
254         /**
255         * Panel with the calibration options
256         */
257         wxPanel* infoPanelCalibration;
258
259         /**
260         * Panel who contains the calibration panel and the information panel mask
261         */
262         wxPanel* panelAux;
263
264         /**
265         * Value of a pixel in milimeters
266         */
267         double _pixelValue;
268 //--------------------------------------------------------------------------------
269
270         wxStaticText* statictext;
271         wxStaticText* statictext1;
272         wxStaticText* statictext2;
273         wxStaticText* statictext3;
274         wxStaticText* statictext4;
275         wxStaticText* statictext5;
276         wxStaticText* statictext6;
277
278         std::string PANEL;
279         std::string PANEL1;
280         std::string PANEL2;
281         std::string PANEL3;
282         std::string PANEL4;
283         std::string PANEL5;
284         std::string PANEL6;
285
286         wxPanel                         *segmentPanel;
287         wxPanel                         *segmentationPanel;
288         wxPanel                         *segmentPanelITK;
289         wxPanel                         *configPanel;
290         wxPanel                         *spreadPanel;
291         interfSpreadPanel       *panelSpread;
292         wxWindow                        *infoWin;
293         wxPanel                         *informationPanel;
294
295         wxPanel                         *testPanel;
296         interfTestPanel         *panelTest;
297
298         wxPanel                         *flipPanel;
299         interfFlipPanel         *panelFlip;
300         
301         wxPanel                         *mirrorPanel;
302         interfMirrorPanel       *panelMirror;
303
304         wxPanel                         *thresholdPanel;
305         wxPanel                         *colorImageLayerPanel;
306
307         bool axisshown;
308         bool refLineShown;
309
310         //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
311         //list of contours
312         interfToolsSpreadPanel* toolspread;
313
314         /**
315         **      This method initializes the tools panel, with the bar and the panel where the contours can be added
316         **      and removed.
317         **      @params size of the buttons panel
318         **      @params sizey of the buttons panel
319         **      @params evtHandler this is the class in charge of responding to the events of the buttons
320         **/
321         wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
322
323         /**
324         **      initialize a statictext component of the interface
325         **/
326         wxStaticText* getText(wxWindow* parent, std::string nom);
327         /**
328         ** initializes a button with data
329         **/
330         wxButton* getButton(wxWindow* parent);
331         /**
332         ** Puts the panel button and the text int the sizer
333         **/
334         wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);
335
336
337 };
338
339 #endif
340