1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #ifndef __interfMainPanel_h_INCLUDED_H__
27 #define __interfMainPanel_h_INCLUDED_H__
32 //#include "wxContourEventHandler.h"
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"
46 #include <wx/treebook.h>
48 #include <wx/button.h>
49 #include <wx/stattext.h>
50 #include <wx/splitter.h>
51 #include <wx/statline.h>
53 #include "vtkImageData.h"
55 class interfMainPanel : public wxPanel {
59 interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
60 ~interfMainPanel(void);
62 /** This method should be called the first time by the parent class
63 ** in creates all the panels the first time
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
69 static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler=NULL);
71 ** Gets the instance of the class
73 static interfMainPanel* getInstance();
75 ** Ressts the instance of the class
77 static void resetInstance();
80 ** Adds a new checkbox to the scrolledwindow using the checkboxsizer
81 ** @Params id of contour
84 void addContourCheckBox(std::string id);
87 ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
88 ** @Params id of contour
91 void removeContourCheckBox(std::string id);
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*)
100 void onActionButtonPressed1( wxCommandEvent& event );
103 ** Shows the panel in the
105 void showPanel(wxWindow* panel);
108 ** Hides the panel in the
113 ** Gets the Information panel
115 wxPanel* getInfoPanel();
118 ** This methods connect the event in the class interfNewContourMenu with the world of the appli
120 void onCreateContourSpline( );
121 void onCreateContourRectangle( );
122 void onCreateContourCircle( );
123 void onCreateContourLine( );
124 // RaC 09-09 ---------------------
125 void onCreateContourPoints( );
126 // RaC 09-09 ---------------------
128 // RaC 10-09 ---------------------
129 void onCreateContourPolygon( );
130 // RaC 10-09 ---------------------
132 void onCreateContoursBullEye(wxPanel* panBull);
133 /////////////////////////////////
134 void onDeleteContoursActSlice();
135 void onDeleteContour();
136 void onDeleteAllContours();
137 /////////////////////////
143 //////////////////////////
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 onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method);
156 void onMirrorPressed();
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 onJumpSlice(int step,int shift);
175 void onSpreadPressed();
176 void onConfigurationPressed();
179 void onSpreadAddAll();
180 void appendStringSpread(std::string val);
181 void onSpreadGo(int type);
182 void setStringSpread(std::string stringtemp);
183 void onInformationPressed();
184 void getInstantVector(std::vector<int>& tempVector);
185 std::vector<std::string> getOutlinesName(int slide);
186 void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
187 void setStringInfoPanel(wxString tmpString);
188 void setRowLabelInfoPanel(int z, wxString tempString);
189 int getNumberColsInformationPanel();
190 void appendColsInformationPanel(int _numberOfVariablesStatistics);
191 void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
192 void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
193 void SetScalarRange(int grayRangeMin,int grayRangeMax);
194 void onSaveResults(std::string directory,std::string namefile, std::string filename,
195 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
196 wxString getCellValue(int j,int i);
197 void onSnakePressed();
198 virtual bool Show(bool show);
199 void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
200 void SetContourGroup(int contourGroup);
201 void onFlipContours();
202 void FlipContours(int typeContourFlip, int flipDirection);
205 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
208 * Associates the current selected contour with a label
213 * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
214 * @param size Size in milimeters of the selected contour
215 * @param unit Measurement unit
217 void onCalibration(wxString size, int unit);
220 * Calculate the pixel value in milimeters
221 * @param realSize Size of the contour in milimeters
222 * @param sizePixel Size of the contour in pixels
224 double onePixelSize (double realSize,double sizePixel);
227 * Returns the value of a pixel in milimeters
229 double GetPixelValue();
230 //------------------------------------------------------------------------------------------------------------
235 static interfMainPanel* interfmainpanel;
238 static wxFrame* _newframe;
247 wxWindow* currentWindow;
248 wxSplitterWindow* splitterwindow;
251 wxPanel* infoPanelMask;
253 //CMRU 17-08-09 ------------------------------------------------------------------
256 * Panel with the calibration options
258 wxPanel* infoPanelCalibration;
261 * Panel who contains the calibration panel and the information panel mask
266 * Value of a pixel in milimeters
269 //--------------------------------------------------------------------------------
271 wxStaticText* statictext;
272 wxStaticText* statictext1;
273 wxStaticText* statictext2;
274 wxStaticText* statictext3;
275 wxStaticText* statictext4;
276 wxStaticText* statictext5;
277 wxStaticText* statictext6;
287 wxPanel *segmentPanel;
288 wxPanel *segmentationPanel;
289 wxPanel *segmentPanelITK;
290 wxPanel *configPanel;
291 wxPanel *spreadPanel;
292 interfSpreadPanel *panelSpread;
294 wxPanel *informationPanel;
297 interfTestPanel *panelTest;
300 interfFlipPanel *panelFlip;
302 wxPanel *mirrorPanel;
303 interfMirrorPanel *panelMirror;
305 wxPanel *thresholdPanel;
306 wxPanel *colorImageLayerPanel;
311 //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
313 interfToolsSpreadPanel* toolspread;
316 ** This method initializes the tools panel, with the bar and the panel where the contours can be added
318 ** @params size of the buttons panel
319 ** @params sizey of the buttons panel
320 ** @params evtHandler this is the class in charge of responding to the events of the buttons
322 wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
325 ** initialize a statictext component of the interface
327 wxStaticText* getText(wxWindow* parent, std::string nom);
329 ** initializes a button with data
331 wxButton* getButton(wxWindow* parent);
333 ** Puts the panel button and the text int the sizer
335 wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);