1 #ifndef __interfMainPanel_h_INCLUDED_H__
2 #define __interfMainPanel_h_INCLUDED_H__
7 //#include "wxContourEventHandler.h"
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 "interfToolsPanels.h"
18 #include "interfSegmentationPanels.h"
19 #include "interfImageToolsMenu.h"
21 #include <wx/treebook.h>
23 #include <wx/button.h>
24 #include <wx/stattext.h>
25 #include <wx/splitter.h>
26 #include <wx/statline.h>
28 #include "vtkImageData.h"
30 class interfMainPanel : public wxPanel {
34 interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
35 ~interfMainPanel(void);
37 /** This method should be called the first time by the parent class
38 ** in creates all the panels the first time
40 static interfMainPanel* getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler=NULL );
41 /** This method should be called the first time by the parent class
42 ** in creates all the panels the first time
44 static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler=NULL);
46 ** Gets the instance of the class
48 static interfMainPanel* getInstance();
50 ** Ressts the instance of the class
52 static void resetInstance();
55 ** Adds a new checkbox to the scrolledwindow using the checkboxsizer
56 ** @Params id of contour
59 void addContourCheckBox(std::string id);
62 ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
63 ** @Params id of contour
66 void removeContourCheckBox(std::string id);
70 ** Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
71 ** of the button corresponding to the method that has to be executed,
72 ** it uses attribute eventHandler to call the methods define by the application.
73 ** see setEventHandler(wxEventHandler*)
75 void onActionButtonPressed1( wxCommandEvent& event );
78 ** Shows the panel in the
80 void showPanel(wxWindow* panel);
83 ** Hides the panel in the
88 ** Gets the Information panel
90 wxPanel* getInfoPanel();
93 ** This methods connect the event in the class interfNewContourMenu with the world of the appli
95 void onCreateContourSpline( );
96 void onCreateContourRectangle( );
97 void onCreateContourCircle( );
98 void onCreateContourLine( );
99 // RaC 09-09 ---------------------
100 void onCreateContourPoints( );
101 // RaC 09-09 ---------------------
103 // RaC 10-09 ---------------------
104 void onCreateContourPolygon( );
105 // RaC 10-09 ---------------------
107 void onCreateContoursBullEye(wxPanel* panBull);
108 /////////////////////////////////
109 void onDeleteContour();
110 void onDeleteContoursActSlice();
111 void onDeleteAllContours();
112 /////////////////////////
118 //////////////////////////
123 /////////////////////////////7
124 void RefreshInterface();
125 vtkImageData* getImageData();
126 void getImageRange(double[2]);
127 void onSegmentationOneSlice(int isovalue,int sampling,int method);
128 void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
129 int GetImageDataSizeZ();
130 void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
131 void onMirrorPressed();
133 void onMirrorAxisShow();
134 void onMirrorAxisHide();
135 void onMirrorChangeWidth(int width);
136 void onThresholdPressed();
137 void onColorLayerImagePressed();
138 void setLabelSegmentationPanelVTK(wxString tmpString);
139 void onSegmentationPressed();
140 void onSegmentationPressedITK();
141 void onRigidPressed();
142 void onWidthOfContour(double width);
143 int getColorWindow();
144 int getWindowLevel();
145 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
146 void onInterpolation(bool interpolate);
147 void onSpreadPressed();
148 void onConfigurationPressed();
151 void appendStringSpread(std::string val);
152 void onSpreadGo(int type);
153 void setStringSpread(std::string stringtemp);
154 void onInformationPressed();
155 void getInstantVector(std::vector<int>& tempVector);
156 std::vector<std::string> getOutlinesName(int slide);
157 void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
158 void setStringInfoPanel(wxString tmpString);
159 void setRowLabelInfoPanel(int z, wxString tempString);
160 int getNumberColsInformationPanel();
161 void appendColsInformationPanel(int _numberOfVariablesStatistics);
162 void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
163 void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
164 void SetScalarRange(int grayRangeMin,int grayRangeMax);
165 void onSaveResults(std::string directory,std::string namefile, std::string filename,
166 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
167 wxString getCellValue(int j,int i);
168 void onSnakePressed();
169 virtual bool Show(bool show);
170 void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
171 void SetContourGroup(int contourGroup);
173 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
176 * Associates the current selected contour with a label
182 * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
183 * @param size Size in milimeters of the selected contour
184 * @param unit Measurement unit
186 void onCalibration(wxString size, int unit);
189 * Calculate the pixel value in milimeters
190 * @param realSize Size of the contour in milimeters
191 * @param sizePixel Size of the contour in pixels
193 double onePixelSize (double realSize,double sizePixel);
196 * Returns the value of a pixel in milimeters
198 double GetPixelValue();
199 //------------------------------------------------------------------------------------------------------------
204 static interfMainPanel* interfmainpanel;
207 static wxFrame* _newframe;
216 wxWindow* currentWindow;
217 wxSplitterWindow* splitterwindow;
220 wxPanel* infoPanelMask;
222 //CMRU 17-08-09 ------------------------------------------------------------------
225 * Panel with the calibration options
227 wxPanel* infoPanelCalibration;
230 * Panel who contains the calibration panel and the information panel mask
235 * Value of a pixel in milimeters
238 //--------------------------------------------------------------------------------
240 wxStaticText* statictext;
241 wxStaticText* statictext1;
242 wxStaticText* statictext2;
243 wxStaticText* statictext3;
244 wxStaticText* statictext4;
245 wxStaticText* statictext5;
246 wxStaticText* statictext6;
256 wxPanel *segmentPanel;
257 wxPanel *segmentationPanel;
258 wxPanel *segmentPanelITK;
259 wxPanel *configPanel;
260 wxPanel *spreadPanel;
261 interfSpreadPanel *panelSpread;
263 wxPanel *informationPanel;
266 interfTestPanel *panelTest;
268 wxPanel *mirrorPanel;
269 interfMirrorPanel *panelMirror;
271 wxPanel *thresholdPanel;
272 wxPanel *colorImageLayerPanel;
277 //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
279 interfToolsSpreadPanel* toolspread;
282 ** This method initializes the tools panel, with the bar and the panel where the contours can be added
284 ** @params size of the buttons panel
285 ** @params sizey of the buttons panel
286 ** @params evtHandler this is the class in charge of responding to the events of the buttons
288 wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
291 ** initialize a statictext component of the interface
293 wxStaticText* getText(wxWindow* parent, std::string nom);
295 ** initializes a button with data
297 wxButton* getButton(wxWindow* parent);
299 ** Puts the panel button and the text int the sizer
301 wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);