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_ActionCommnadsID.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);
263 //------------------------------------------------------------------------------------------------------------
265 //------------------------------------------------------------------------------------------------------------
266 void updateInstantOutlines();
267 void updateInstantImageData();
268 void updateInstantAxes();
269 void changeInstant();
270 void RefreshInterface();
273 //JCP 13-10-09 must be a public method
274 //void FillGridWithContoursInformation();
276 manualContourModel * factoryManualContourModel(int typeContour);
277 manualContourModel * factoryManualContourModel(PanelBullEyeOptions* panel);
278 std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
280 //------------------------------------------------------------------------------------------------------------
282 //------------------------------------------------------------------------------------------------------------
284 wxContourViewPanel * _theViewPanel;
285 OutlineModelManager * _modelManager;
286 ContourWorkspace * _workSpace;
287 wxInstantChooserPanel * _instantPanel;
288 wxContour_ButtonsBar * _buttonsBar;
290 wxVtkBaseView_SceneManager * _sceneManager;
292 Instant * _actualInstant;
293 wxContour_Grid * _gridPanel;
294 wxContour_DrawToolsPanel * _drawToolsPanel;
295 wxContour_OperationsToolsPanel * _operationsToolsPanel;
296 wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
297 wxContour_StandardToolsPanel * _standardToolsPanel;
298 wxContour_EdtionToolsPanel * _editionToolsPanel;
299 wxContour_ListViewPanel * _listViewPanel;
301 /*DECLARE_CLASS(wxContourMainFrame)
302 // any class wishing to process wxWindows events must use this macro
303 DECLARE_EVENT_TABLE()*/
304 bool _creatingContoursActive;
305 PerformingOperation * _performingOperation;
308 wxFrame *_spreadFrame;
309 wxFrame *_segmentationFrame;
310 wxFrame *_createContourFrame;
311 wxFrame *_deleteFrame;
312 wxFrame *_InformationContourFrame;
313 wxFrame *_interfaceConfigurationFrame;
315 wxTextCtrl * _wxtextctrlTest;
317 std::string fileNameContourROI;
319 wxRadioBox *methodRadiobox;
320 ContourPropagation *_contourPropagation;
323 wxStaticText *_staticTextSegmentation;
324 mBarRange *_mbarrange;
325 wxTextCtrl *_wxtextctrlSpread;
326 wxRadioBox *_informationRadiobox;
327 wxListCtrl *_wxlistctrl;
329 wxStaticText *_staticTextInformation;
330 mBarRange *_mbarrangeSliceInformation;
331 mBarRange *_mbarrangeRangeInformation;
332 wxSlider *_withOfContourLine;
333 wxSlider *_brithtnessWindowLevel;
334 wxSlider *_brithtnessColorLevel;
335 mBarRange *_mbarrangeDeleteAll;
336 wxCheckBox *_interpolationCheckBox;
337 wxRadioBox *_spreadMethodRadiobox;
338 wxRadioBox *_radiolstboxContourGroup;
339 wxStaticText *_staticTextSpread;
340 PanelBullEyeOptions *_panelBullEyeOptions;
341 int _numberOfVariablesStatistics;
345 std::string stundoredo;
348 void loadState(std::string filename);
350 #endif // __wxContourEventHandler_HEADER_FILE__