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