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 "interfSegmentationPanels.h"
18 #include "interfToolsPanels.h"
20 #include <wx/treebook.h>
22 #include <wx/button.h>
23 #include <wx/stattext.h>
24 #include <wx/splitter.h>
25 #include <wx/statline.h>
27 #include "vtkImageData.h"
29 class interfMainPanel : public wxPanel {
33 interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons");
34 ~interfMainPanel(void);
36 /** This method should be called the first time by the parent class
37 ** in creates all the panels the first time
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
43 static interfMainPanel* getInstance(wxWindow* parent, wxEvtHandler * evtHandler=NULL);
45 ** Gets the instance of the class
47 static interfMainPanel* getInstance();
49 ** Ressts the instance of the class
51 static void resetInstance();
54 ** Adds a new checkbox to the scrolledwindow using the checkboxsizer
55 ** @Params id of contour
58 void addContourCheckBox(std::string id);
61 ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
62 ** @Params id of contour
65 void removeContourCheckBox(std::string id);
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*)
74 void onActionButtonPressed1( wxCommandEvent& event );
77 ** Shows the panel in the
79 void showPanel(wxWindow* panel);
82 ** Hides the panel in the
87 ** Gets the Information panel
89 wxPanel* getInfoPanel();
92 ** This methods connect the event in the class interfNewContourMenu with the world of the appli
94 void onCreateContourSpline( );
95 void onCreateContourRectangle( );
96 void onCreateContourCircle( );
97 void onCreateContourLine( );
98 // RaC 09-09 ---------------------
99 void onCreateContourPoints( );
100 // RaC 09-09 ---------------------
102 // RaC 10-09 ---------------------
103 void onCreateContourPolygon( );
104 // RaC 10-09 ---------------------
106 void onCreateContoursBullEye(wxPanel* panBull);
107 /////////////////////////////////
108 void onDeleteContour();
109 void onDeleteContoursActSlice();
110 void onDeleteAllContours();
111 /////////////////////////
117 //////////////////////////
122 /////////////////////////////7
123 void RefreshInterface();
124 vtkImageData* getImageData();
125 void getImageRange(double[2]);
126 void onSegmentationOneSlice(int isovalue,int sampling,int method);
127 void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
128 int GetImageDataSizeZ();
129 void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
130 void onMirrorPressed();
132 void onMirrorAxisShow();
133 void onMirrorAxisHide();
134 void onMirrorChangeWidth(int width);
135 void onThresholdPressed();
136 void setLabelSegmentationPanelVTK(wxString tmpString);
137 void onSegmentationPressed();
138 void onSegmentationPressedITK();
139 void onRigidPressed();
140 void onWidthOfContour(double width);
141 int getColorWindow();
142 int getWindowLevel();
143 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
144 void onInterpolation(bool interpolate);
145 void onSpreadPressed();
146 void onConfigurationPressed();
149 void appendStringSpread(std::string val);
150 void onSpreadGo(int type);
151 void setStringSpread(std::string stringtemp);
152 void onInformationPressed();
153 void getInstantVector(std::vector<int>& tempVector);
154 std::vector<std::string> getOutlinesName(int slide);
155 void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax);
156 void setStringInfoPanel(wxString tmpString);
157 void setRowLabelInfoPanel(int z, wxString tempString);
158 int getNumberColsInformationPanel();
159 void appendColsInformationPanel(int _numberOfVariablesStatistics);
160 void setCellValueInfoPanel(int z,int tmpIntA,wxString tempString);
161 void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString);
162 void SetScalarRange(int grayRangeMin,int grayRangeMax);
163 void onSaveResults(std::string directory,std::string namefile, std::string filename,
164 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
165 wxString getCellValue(int j,int i);
166 void onSnakePressed();
167 virtual bool Show(bool show);
168 void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ);
169 void SetContourGroup(int contourGroup);
171 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
174 * Associates the current selected contour with a label
180 * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour
181 * @param size Size in milimeters of the selected contour
182 * @param unit Measurement unit
184 void onCalibration(wxString size, int unit);
187 * Calculate the pixel value in milimeters
188 * @param realSize Size of the contour in milimeters
189 * @param sizePixel Size of the contour in pixels
191 double onePixelSize (double realSize,double sizePixel);
194 * Returns the value of a pixel in milimeters
196 double GetPixelValue();
197 //------------------------------------------------------------------------------------------------------------
202 static interfMainPanel* interfmainpanel;
205 static wxFrame* _newframe;
213 wxWindow* currentWindow;
214 wxSplitterWindow* splitterwindow;
217 wxPanel* infoPanelMask;
219 //CMRU 17-08-09 ------------------------------------------------------------------
222 * Panel with the calibration options
224 wxPanel* infoPanelCalibration;
227 * Panel who contains the calibration panel and the information panel mask
232 * Value of a pixel in milimeters
235 //--------------------------------------------------------------------------------
237 wxStaticText* statictext;
238 wxStaticText* statictext1;
239 wxStaticText* statictext2;
240 wxStaticText* statictext3;
241 wxStaticText* statictext4;
242 wxStaticText* statictext5;
251 wxPanel* segmentPanel;
252 wxPanel* segmentationPanel;
253 wxPanel* segmentPanelITK;
254 wxPanel* configPanel;
255 wxPanel* spreadPanel;
256 interfSpreadPanel* panelSpread;
258 wxPanel* informationPanel;
260 wxPanel* mirrorPanel;
261 interfMirrorPanel* panelMirror;
262 wxPanel* thresholdPanel;
267 //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in
269 interfToolsSpreadPanel* toolspread;
272 ** This method initializes the tools panel, with the bar and the panel where the contours can be added
274 ** @params size of the buttons panel
275 ** @params sizey of the buttons panel
276 ** @params evtHandler this is the class in charge of responding to the events of the buttons
278 wxPanel* initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler);
281 ** initialize a statictext component of the interface
283 wxStaticText* getText(wxWindow* parent, std::string nom);
285 ** initializes a button with data
287 wxButton* getButton(wxWindow* parent);
289 ** Puts the panel button and the text int the sizer
291 wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text);