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>
20 //------------------------------------------------------------------------------------------------------------
22 //------------------------------------------------------------------------------------------------------------
23 #include "OutlineModelManager.h"
24 #include "ContourWorkspace.h"
25 #include "wxContourViewPanel.h"
26 #include "wxInstantChooserPanel.h"
27 #include "wxContour_ButtonsBar.h"
28 #include "wxContour_Grid.h"
29 #include "wxContour_DrawToolsPanel.h"
30 #include "wxContour_OperationsToolsPanel.h"
31 #include "wxContour_AutomaticFormsToolsPanel.h"
32 #include "wxContour_StandardToolsPanel.h"
33 #include "wxContour_EdtionToolsPanel.h"
34 #include "wxContour_ListViewPanel.h"
35 #include "wxContour_ActionCommandsID.h"
36 #include "PerformingOperation.h"
38 #include "ContourThing.h"
40 #include "ImageSourceThing.h"
41 #include "ImageSectionThing.h"
42 #include "InstantMembersNameList.h"
43 #include "OutlineGroup.h"
44 #include "SomeEnvironment.h"
45 #include "ContourWorkspace.h"
46 #include "ContourWrap_ViewControl.h"
49 #include "wxVtkBaseView_SceneManager.h"
52 #include "Contour/ContourPropagation.h"
53 #include "mBarRange.h"
56 /** file wxContourEventHandler.h */
60 class PanelBullEyeOptions : public wxPanel {
62 PanelBullEyeOptions(wxWindow* parent, wxSize size);
63 ~PanelBullEyeOptions ();
64 void onRefreshPanel( wxCommandEvent& event );
65 int GetNumberOfCrowns();
66 int GetNumberOfSections(int nCrown);
67 int GetRadioOfCrown(int nCrown);
68 double GetAngOfCrownSection(int nCrown,int section);
69 double GetAngDeltaOfCrownSection(int nCrown);
75 wxRadioBox *_radioboxBullEyeGenOpt;
76 wxSpinCtrl *_spinctrlBullEyeNumOfCrowns;
77 wxSpinCtrl *_spinctrlBullEyeNumOfSec;
78 wxSlider *_sliderBullEyeAngle;
79 std::vector<wxSpinCtrl *> _lstBullEyeDetailNumOfSec;
80 std::vector<wxSlider *> _lstBullEyeDetailRadio;
81 std::vector<wxSlider *> _lstBullEyeDetailAngle;
92 //------------------------------------------------------------------------------------------------------------
94 //------------------------------------------------------------------------------------------------------------
95 class wxContourEventHandler : public wxEvtHandler {
99 //------------------------------------------------------------------------------------------------------------
100 // Constructors & Destructors
101 //------------------------------------------------------------------------------------------------------------
102 wxContourEventHandler();
103 ~wxContourEventHandler();
105 //------------------------------------------------------------------------------------------------------------
106 // Configuration methods
107 //------------------------------------------------------------------------------------------------------------
108 bool configureEventsHandling();
110 //------------------------------------------------------------------------------------------------------------
111 // Methods for capturing events
112 //------------------------------------------------------------------------------------------------------------
113 void onProcessMessage( wxCommandEvent& event );
114 void onActionButtonPressed( wxCommandEvent& event );
115 void onChangedDeep ( wxCommandEvent& event );
116 void onChangeInstant( wxCommandEvent& event );
117 void onCreateMultipleROI( wxCommandEvent& event );
118 void onSelectMultipleROI( wxCommandEvent& event );
119 void onCreateROI( wxCommandEvent& event );
120 void onStopCreateROI( wxCommandEvent& event );
121 void onDeleterROI( wxCommandEvent& event );
122 void onSelectROI( wxCommandEvent& event );
123 void onUnSelectROI( wxCommandEvent& event );
124 void onManualHidedROI( wxCommandEvent& event );
125 void onManualShowedROI( wxCommandEvent& event );
126 void onEditingROI( wxCommandEvent& event );
127 void onMovingROI( wxCommandEvent& event );
129 //------------------------------------------------------------------------------------------------------------
130 // Model management methods
131 //------------------------------------------------------------------------------------------------------------
133 void createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append = false );
134 void createContour( int typeContour=1 );
135 void deleteContour( std::string theKeyName );
136 void deleteContours( std::vector<std::string> & keyNamesVector );
137 void deleteAllContours( );
138 void openContours( FILE *pFile, bool staticContour );
139 void openFileWithContours();
140 void saveFileWithContours();
141 void saveFileWithContours( std::string filename );
142 void saveFileWithContoursAutomatique();
144 void onSpreadInDepth( std::vector<std::string> & keyNamesVector );
145 void onAutomatiqueSegmentation( );
146 void onOutline_Union_Of( std::vector<std::string> & keyNamesVector );
147 void onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector );
148 void onOutline_Combination_Of( std::vector<std::string> & keyNamesVector );
149 void onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector );
150 void onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector );
151 void onCopyOutlines( std::vector<std::string> & keyNamesVector );
152 void onPasteOutlines( );
153 void onShowOutlines( std::vector<std::string> & keyNamesVector );
154 void onHideOutlines( std::vector<std::string> & keyNamesVector );
155 void onSelectOutlines( std::vector<std::string> & keyNamesVector );
156 void onEditOutlines( std::vector<std::string> & keyNamesVector );
159 void changeContourOfManager(std::string keyName, Instant *instant);
160 void changeContoursOfManager(std::vector<std::string> & keyNamesVector);
163 //------------------------------------------------------------------------------------------------------------
164 // Attributes getters and setters
165 //------------------------------------------------------------------------------------------------------------
166 void setModelManager( OutlineModelManager * theModelManager );
167 void setViewPanel( wxContourViewPanel * theViewPanel );
168 void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
169 void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
170 void setGrid( wxContour_Grid * theGridPanel );
171 void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel );
172 void setOperationsToolsPanel( wxContour_OperationsToolsPanel * theDrawToolsPanel );
173 void setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
174 void setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel );
175 void setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel );
176 void setListViewPanel( wxContour_ListViewPanel * theListViewPanel );
178 //------------------------------------------------------------------------------------------------------------
179 // Other functional methods
180 //------------------------------------------------------------------------------------------------------------
181 void executeActionCommand( const char toolCommand );
183 //------------------------------------------------------------------------------------------------------------
184 // Getting information methods
185 //------------------------------------------------------------------------------------------------------------
187 //------------------------------------------------------------------------------------------------------------
188 // Responding Spread Tools
189 //------------------------------------------------------------------------------------------------------------
190 void onSpreadReset( wxCommandEvent& event );
191 void onSpreadAdd( wxCommandEvent& event );
192 void onSpreadGo( wxCommandEvent& event );
194 void onSegmentationAllSlice( wxCommandEvent& event );
195 void onSegmentationOneSlice( wxCommandEvent& event );
196 void SegmentationOneSlice( int x, int y, int z );
199 void onTest( wxCommandEvent& event );
200 void onTestReset( wxCommandEvent& event );
201 void onTestAdd( wxCommandEvent& event );
202 void onTestGo( wxCommandEvent& event );
205 void onCreateContourSpline( wxCommandEvent& event );
206 void onCreateContourRectangle( wxCommandEvent& event );
207 void onCreateContourCircle( wxCommandEvent& event );
208 void onCreateContourBullEye( wxCommandEvent& event );
209 void onCreateContourFrame( );
210 void onDeleteFrame( );
211 void onDeleteContour( wxCommandEvent& event );
212 void onDeleteContoursActSlice( wxCommandEvent& event );
213 void onDeleteAllContours( wxCommandEvent& event );
214 void onInformationContourFrame();
215 void onInformationContourLabels( wxCommandEvent& event );
216 void onExtractInformation( wxCommandEvent& event );
217 void onSaveResults( wxCommandEvent& event );
218 void onInterfaceConfigurationFrame();
219 void onWidthOfContour(wxScrollEvent& event);
220 void onBrigthnessColorWindowLevel(wxScrollEvent& event);
221 void OnInterpolation(wxCommandEvent& event);
223 void onInterfaceTestFrame();
225 void SaveValuesXYZ(std::string directory,std::string namefile);
226 void SaveImageResult(std::string directory,std::string namefile);
229 ** JCP 13-10-08 This methods group the diferent kind of panels
231 wxPanel* getInformationPanel(wxWindow* parent);
232 wxPanel* getConfigurationPanel(wxWindow* parent);
233 wxPanel* getSegmentationPanel(wxWindow* parent);
234 wxPanel* getSegmentationPanelITK(wxWindow* parent);
235 wxPanel* getSpreadPanel(wxWindow* parent);
236 void onSegmentationAllSliceITK( wxCommandEvent& event );
237 void onSegmentationOneSliceITK( wxCommandEvent& event );
238 void onSnakePressed(wxWindow* parent);
240 void showAxis(bool show);
241 //JCP 13-10-09 Fill grid as public
242 void FillGridWithContoursInformation();
245 void createContourBullsEye(PanelBullEyeOptions* panel );
247 //void getValuesXYZ(std::vector<double *>* vectx, std::vector<double*>* vecty, std::vector<double*>* vectz, std::vector<int>* size);
250 ** This method gets the information of the contours in each slice
252 void getValuesXYZ(double ** vectx, double ** vecty, double ** vectz, std::vector<int>* size);
254 ** This method gets the mask and value images generated by the contours
256 void getMaskValue(vtkImageData* mask, vtkImageData* value);
257 /**This Method checks for the information panel, it initalizes all the values
258 ** in the controls so they can be retreived
260 void checkInformationPanel();
267 //------------------------------------------------------------------------------------------------------------
269 //------------------------------------------------------------------------------------------------------------
270 void updateInstantOutlines();
271 void updateInstantImageData();
272 void updateInstantAxes();
273 void changeInstant();
274 void RefreshInterface();
277 //JCP 13-10-09 must be a public method
278 //void FillGridWithContoursInformation();
280 manualContourModel * factoryManualContourModel(int typeContour);
281 manualContourModel * factoryManualContourModel(PanelBullEyeOptions* panel);
282 std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
284 //------------------------------------------------------------------------------------------------------------
286 //------------------------------------------------------------------------------------------------------------
288 wxContourViewPanel * _theViewPanel;
289 OutlineModelManager * _modelManager;
290 ContourWorkspace * _workSpace;
291 wxInstantChooserPanel * _instantPanel;
292 wxContour_ButtonsBar * _buttonsBar;
294 wxVtkBaseView_SceneManager * _sceneManager;
296 Instant * _actualInstant;
297 wxContour_Grid * _gridPanel;
298 wxContour_DrawToolsPanel * _drawToolsPanel;
299 wxContour_OperationsToolsPanel * _operationsToolsPanel;
300 wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
301 wxContour_StandardToolsPanel * _standardToolsPanel;
302 wxContour_EdtionToolsPanel * _editionToolsPanel;
303 wxContour_ListViewPanel * _listViewPanel;
305 /*DECLARE_CLASS(wxContourMainFrame)
306 // any class wishing to process wxWindows events must use this macro
307 DECLARE_EVENT_TABLE()*/
308 bool _creatingContoursActive;
309 PerformingOperation * _performingOperation;
312 wxFrame *_spreadFrame;
313 wxFrame *_segmentationFrame;
314 wxFrame *_createContourFrame;
315 wxFrame *_deleteFrame;
316 wxFrame *_InformationContourFrame;
317 wxFrame *_interfaceConfigurationFrame;
319 wxTextCtrl * _wxtextctrlTest;
321 std::string fileNameContourROI;
323 wxRadioBox *methodRadiobox;
324 ContourPropagation *_contourPropagation;
327 wxStaticText *_staticTextSegmentation;
328 mBarRange *_mbarrange;
329 wxTextCtrl *_wxtextctrlSpread;
330 wxRadioBox *_informationRadiobox;
331 wxListCtrl *_wxlistctrl;
333 wxStaticText *_staticTextInformation;
334 mBarRange *_mbarrangeSliceInformation;
335 mBarRange *_mbarrangeRangeInformation;
336 wxSlider *_withOfContourLine;
337 wxSlider *_brithtnessWindowLevel;
338 wxSlider *_brithtnessColorLevel;
339 mBarRange *_mbarrangeDeleteAll;
340 wxCheckBox *_interpolationCheckBox;
341 wxRadioBox *_spreadMethodRadiobox;
342 wxRadioBox *_radiolstboxContourGroup;
343 wxStaticText *_staticTextSpread;
344 PanelBullEyeOptions *_panelBullEyeOptions;
345 int _numberOfVariablesStatistics;
349 std::string stundoredo;
352 void loadState(std::string filename);
354 #endif // __wxContourEventHandler_HEADER_FILE__