1 #ifndef __wxContourEventHandler_h_INCLUDED_H__
2 #define __wxContourEventHandler_h_INCLUDED_H__
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
10 #include <wx/wxprec.h>
21 //------------------------------------------------------------------------------------------------------------
23 //------------------------------------------------------------------------------------------------------------
24 #include "OutlineModelManager.h"
25 #include "ContourWorkspace.h"
26 #include "wxContourViewPanel.h"
27 #include "wxInstantChooserPanel.h"
28 #include "wxContour_ButtonsBar.h"
29 #include "wxContour_Grid.h"
30 #include "wxContour_DrawToolsPanel.h"
31 #include "wxContour_OperationsToolsPanel.h"
32 #include "wxContour_AutomaticFormsToolsPanel.h"
33 #include "wxContour_StandardToolsPanel.h"
34 #include "wxContour_EdtionToolsPanel.h"
35 #include "wxContour_ListViewPanel.h"
36 #include "wxContour_ActionCommandsID.h"
37 #include "PerformingOperation.h"
39 #include "ContourThing.h"
41 #include "ImageSourceThing.h"
42 #include "ImageSectionThing.h"
43 #include "InstantMembersNameList.h"
44 #include "OutlineGroup.h"
45 #include "SomeEnvironment.h"
46 #include "ContourWorkspace.h"
47 #include "ContourWrap_ViewControl.h"
50 #include "wxVtkBaseView_SceneManager.h"
53 #include "Contour/ContourPropagation.h"
54 #include "mBarRange.h"
57 /** file wxContourEventHandler.h */
61 class PanelBullEyeOptions : public wxPanel {
63 PanelBullEyeOptions(wxWindow* parent, wxSize size);
64 ~PanelBullEyeOptions ();
65 void onRefreshPanel( wxCommandEvent& event );
66 int GetNumberOfCrowns();
67 int GetNumberOfSections(int nCrown);
68 int GetRadioOfCrown(int nCrown);
69 double GetAngOfCrownSection(int nCrown,int section);
70 double GetAngDeltaOfCrownSection(int nCrown);
76 wxRadioBox *_radioboxBullEyeGenOpt;
77 wxSpinCtrl *_spinctrlBullEyeNumOfCrowns;
78 wxSpinCtrl *_spinctrlBullEyeNumOfSec;
79 wxSlider *_sliderBullEyeAngle;
80 std::vector<wxSpinCtrl *> _lstBullEyeDetailNumOfSec;
81 std::vector<wxSlider *> _lstBullEyeDetailRadio;
82 std::vector<wxSlider *> _lstBullEyeDetailAngle;
93 //------------------------------------------------------------------------------------------------------------
95 //------------------------------------------------------------------------------------------------------------
96 class wxContourEventHandler : public wxEvtHandler {
100 //------------------------------------------------------------------------------------------------------------
101 // Constructors & Destructors
102 //------------------------------------------------------------------------------------------------------------
103 wxContourEventHandler();
104 ~wxContourEventHandler();
106 //------------------------------------------------------------------------------------------------------------
107 // Configuration methods
108 //------------------------------------------------------------------------------------------------------------
109 bool configureEventsHandling();
111 //------------------------------------------------------------------------------------------------------------
112 // Methods for capturing events
113 //------------------------------------------------------------------------------------------------------------
114 void onProcessMessage( wxCommandEvent& event );
115 void onActionButtonPressed( wxCommandEvent& event );
116 void onChangedDeep ( wxCommandEvent& event );
117 void onChangeInstant( wxCommandEvent& event );
118 void onCreateMultipleROI( wxCommandEvent& event );
119 void onSelectMultipleROI( wxCommandEvent& event );
120 void onCreateROI( wxCommandEvent& event );
121 void onStopCreateROI( wxCommandEvent& event );
122 void onDeleterROI( wxCommandEvent& event );
123 void onSelectROI( wxCommandEvent& event );
124 void onUnSelectROI( wxCommandEvent& event );
125 void onManualHidedROI( wxCommandEvent& event );
126 void onManualShowedROI( wxCommandEvent& event );
127 void onEditingROI( wxCommandEvent& event );
128 void onMovingROI( wxCommandEvent& event );
130 //------------------------------------------------------------------------------------------------------------
131 // Model management methods
132 //------------------------------------------------------------------------------------------------------------
134 void createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append = false );
135 void createContour( int typeContour=1 );
136 void deleteContour( std::string theKeyName );
137 void deleteContours( std::vector<std::string> keyNamesVector );
138 void deleteAllContours( );
139 void openContours( FILE *pFile, bool staticContour );
140 void openFileWithContours();
141 void saveFileWithContours();
142 void saveFileWithContours( std::string filename );
143 void saveFileWithContoursAutomatique();
145 void onSpreadInDepth( std::vector<std::string> & keyNamesVector );
146 void onAutomatiqueSegmentation( );
147 void onOutline_Union_Of( std::vector<std::string> & keyNamesVector );
148 void onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector );
149 void onOutline_Combination_Of( std::vector<std::string> & keyNamesVector );
150 void onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector );
151 void onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector );
152 void onCopyOutlines( std::vector<std::string> & keyNamesVector );
153 void onPasteOutlines( );
154 void onShowOutlines( std::vector<std::string> & keyNamesVector );
155 void onHideOutlines( std::vector<std::string> & keyNamesVector );
156 void onSelectOutlines( std::vector<std::string> & keyNamesVector );
157 void onEditOutlines( std::vector<std::string> & keyNamesVector );
160 void changeContourOfManager(std::string keyName, Instant *instant);
161 void changeContoursOfManager(std::vector<std::string> & keyNamesVector);
164 //------------------------------------------------------------------------------------------------------------
165 // Attributes getters and setters
166 //------------------------------------------------------------------------------------------------------------
167 void setModelManager( OutlineModelManager * theModelManager );
168 void setViewPanel( wxContourViewPanel * theViewPanel );
169 void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
170 void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
171 void setGrid( wxContour_Grid * theGridPanel );
172 void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel );
173 void setOperationsToolsPanel( wxContour_OperationsToolsPanel * theDrawToolsPanel );
174 void setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
175 void setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel );
176 void setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel );
177 void setListViewPanel( wxContour_ListViewPanel * theListViewPanel );
179 //------------------------------------------------------------------------------------------------------------
180 // Other functional methods
181 //------------------------------------------------------------------------------------------------------------
182 void executeActionCommand( const char toolCommand );
184 //------------------------------------------------------------------------------------------------------------
185 // Getting information methods
186 //------------------------------------------------------------------------------------------------------------
188 //------------------------------------------------------------------------------------------------------------
189 // Responding Spread Tools
190 //------------------------------------------------------------------------------------------------------------
191 void onSpreadReset( wxCommandEvent& event );
192 void onSpreadAdd( wxCommandEvent& event );
193 void onSpreadGo( wxCommandEvent& event );
195 void onSegmentationAllSlice( wxCommandEvent& event );
196 void onSegmentationOneSlice( wxCommandEvent& event );
197 void SegmentationOneSlice( int x, int y, int z );
200 void onTest( wxCommandEvent& event );
201 void onTestReset( wxCommandEvent& event );
202 void onTestAdd( wxCommandEvent& event );
203 void onTestGo( wxCommandEvent& event );
206 void onCreateContourSpline( wxCommandEvent& event );
207 void onCreateContourRectangle( wxCommandEvent& event );
208 void onCreateContourCircle( wxCommandEvent& event );
209 void onCreateContourBullEye( wxCommandEvent& event );
210 void onCreateContourFrame( );
211 void onDeleteFrame( );
212 void onDeleteContour( wxCommandEvent& event );
213 void onDeleteContoursActSlice( wxCommandEvent& event );
214 void onDeleteAllContours( wxCommandEvent& event );
215 void onInformationContourFrame();
216 void onInformationContourLabels( wxCommandEvent& event );
217 void onExtractInformation( wxCommandEvent& event );
218 void onSaveResults( wxCommandEvent& event );
219 void onInterfaceConfigurationFrame();
220 void onWidthOfContour(wxScrollEvent& event);
221 void onBrigthnessColorWindowLevel(wxScrollEvent& event);
222 void OnInterpolation(wxCommandEvent& event);
224 void onInterfaceTestFrame();
226 void SaveValuesXYZ(std::string directory,std::string namefile);
227 void SaveImageResult(std::string directory,std::string namefile);
230 ** JCP 13-10-08 This methods group the diferent kind of panels
232 wxPanel* getInformationPanel(wxWindow* parent);
233 wxPanel* getConfigurationPanel(wxWindow* parent);
234 wxPanel* getSegmentationPanel(wxWindow* parent);
235 wxPanel* getSegmentationPanelITK(wxWindow* parent);
236 wxPanel* getSpreadPanel(wxWindow* parent);
237 void onSegmentationAllSliceITK( wxCommandEvent& event );
238 void onSegmentationOneSliceITK( wxCommandEvent& event );
239 void onSnakePressed(wxWindow* parent);
241 void showAxis(bool show);
242 //JCP 13-10-09 Fill grid as public
243 void FillGridWithContoursInformation();
246 void createContourBullsEye(PanelBullEyeOptions* panel );
248 //void getValuesXYZ(std::vector<double *>* vectx, std::vector<double*>* vecty, std::vector<double*>* vectz, std::vector<int>* size);
251 ** This method gets the information of the contours in each slice
253 void getValuesXYZ(double ** vectx, double ** vecty, double ** vectz, std::vector<int>* size);
255 ** This method gets the mask and value images generated by the contours
257 void getMaskValue(vtkImageData* mask, vtkImageData* value);
258 /**This Method checks for the information panel, it initalizes all the values
259 ** in the controls so they can be retreived
261 void checkInformationPanel();
268 //------------------------------------------------------------------------------------------------------------
270 //------------------------------------------------------------------------------------------------------------
271 void updateInstantOutlines();
272 void updateInstantImageData();
273 void updateInstantAxes();
274 void changeInstant();
275 void RefreshInterface();
278 //JCP 13-10-09 must be a public method
279 //void FillGridWithContoursInformation();
281 manualContourModel * factoryManualContourModel(int typeContour);
282 manualContourModel * factoryManualContourModel(PanelBullEyeOptions* panel);
283 std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
285 //------------------------------------------------------------------------------------------------------------
287 //------------------------------------------------------------------------------------------------------------
289 wxContourViewPanel * _theViewPanel;
290 OutlineModelManager * _modelManager;
291 ContourWorkspace * _workSpace;
292 wxInstantChooserPanel * _instantPanel;
293 wxContour_ButtonsBar * _buttonsBar;
295 wxVtkBaseView_SceneManager * _sceneManager;
297 Instant * _actualInstant;
298 wxContour_Grid * _gridPanel;
299 wxContour_DrawToolsPanel * _drawToolsPanel;
300 wxContour_OperationsToolsPanel * _operationsToolsPanel;
301 wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
302 wxContour_StandardToolsPanel * _standardToolsPanel;
303 wxContour_EdtionToolsPanel * _editionToolsPanel;
304 wxContour_ListViewPanel * _listViewPanel;
306 /*DECLARE_CLASS(wxContourMainFrame)
307 // any class wishing to process wxWindows events must use this macro
308 DECLARE_EVENT_TABLE()*/
309 bool _creatingContoursActive;
310 PerformingOperation * _performingOperation;
313 wxFrame *_spreadFrame;
314 wxFrame *_segmentationFrame;
315 wxFrame *_createContourFrame;
316 wxFrame *_deleteFrame;
317 wxFrame *_InformationContourFrame;
318 wxFrame *_interfaceConfigurationFrame;
320 wxTextCtrl * _wxtextctrlTest;
322 std::string fileNameContourROI;
324 wxRadioBox *methodRadiobox;
325 ContourPropagation *_contourPropagation;
328 wxStaticText *_staticTextSegmentation;
329 mBarRange *_mbarrange;
330 wxTextCtrl *_wxtextctrlSpread;
331 wxRadioBox *_informationRadiobox;
332 wxListCtrl *_wxlistctrl;
334 wxStaticText *_staticTextInformation;
335 mBarRange *_mbarrangeSliceInformation;
336 mBarRange *_mbarrangeRangeInformation;
337 wxSlider *_withOfContourLine;
338 wxSlider *_brithtnessWindowLevel;
339 wxSlider *_brithtnessColorLevel;
340 mBarRange *_mbarrangeDeleteAll;
341 wxCheckBox *_interpolationCheckBox;
342 wxRadioBox *_spreadMethodRadiobox;
343 wxRadioBox *_radiolstboxContourGroup;
344 wxStaticText *_staticTextSpread;
345 PanelBullEyeOptions *_panelBullEyeOptions;
346 int _numberOfVariablesStatistics;
350 std::string stundoredo;
353 void loadState(std::string filename);
355 std::string intToString(int num);
357 #endif // __wxContourEventHandler_HEADER_FILE__