]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.h
1 #ifndef __wxContourViewPaneL_h_INCLUDED_H__
2 #define __wxContourViewPaneL_h_INCLUDED_H__
3
4
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
9
10 #include <wx/wxprec.h>
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14 #ifndef WX_PRECOMP
15 #include <wx/wx.h>
16 #endif
17
18 #include <wx/scrolwin.h>
19
20 //------------------------------------------------------------------------------------------------------------
21 // Includes
22 //------------------------------------------------------------------------------------------------------------
23
24 #include "mBarRange.h"
25 #include "wxMaracas_N_ViewersWidget.h"
26 #include "vtkImageData.h"
27 #include <manualContour.h>
28 #include "wxVtkBaseView.h"
29 #include <iostream>
30 #include <wx/event.h>
31 #include "wxVtkBaseView_SceneManager.h"
32 #include "manualContour.h"
33
34 #include <vtkImageMapToWindowLevelColors.h>
35
36
37 //------------------------------------------------------------------------------------------------------------
38 // Events declaration
39 //------------------------------------------------------------------------------------------------------------
40
41 BEGIN_DECLARE_EVENT_TYPES()
42         DECLARE_EVENT_TYPE(wxINSTANT_CHANGE,400)
43 END_DECLARE_EVENT_TYPES()
44
45
46 /** file wxContourViewPanel.h */
47
48 //------------------------------------------------------------------------------------------------------------
49 // Class definition
50 //------------------------------------------------------------------------------------------------------------
51
52 class wxContourViewPanel : public wxPanel {// public wxScrolledWindow {
53
54         public:
55
56         //------------------------------------------------------------------------------------------------------------
57         // Constructors & Destructors
58         //------------------------------------------------------------------------------------------------------------
59         
60         wxContourViewPanel( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos=wxDefaultPosition, const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1, int horzStart=1, int horzEnd=1 );
61
62         ~wxContourViewPanel();
63
64         //------------------------------------------------------------------------------------------------------------
65         // Creational and initialization methods
66         //------------------------------------------------------------------------------------------------------------
67         
68         void setWxEventHandler( wxEvtHandler * theEventHandler );
69
70         void createHorizontalBar(int horzStart, int horzEnd);
71
72         void createVerticalBar(int vertStart, int vertEnd);
73
74         void createViewPanel();
75
76         //------------------------------------------------------------------------------------------------------------
77         // Methods for capturing events from the horizontal bar
78         //------------------------------------------------------------------------------------------------------------
79         
80         /**
81         * Handles the event wxEVT_TSBAR from the horizontal bar 
82         */
83         void onBarrange_Horizontal(wxCommandEvent& event);
84         /**
85         * Handles the event wxEVT_TSBAR_ACTUAL from the horizontal bar  
86         */
87         void onActualChange_Bar_Horizontal(wxCommandEvent& event);
88         /**
89         * Handles the event wxEVT_TSBAR_START from the horizontal bar   
90         */
91         void onStartChange_Bar_Horizontal(wxCommandEvent& event);
92         /**
93         * Handles the event wxEVT_TSBAR_END from the horizontal bar     
94         */
95         void onEndChange_Bar_Horizontal(wxCommandEvent& event);
96         /**
97         * Handles the event wxEVT_SELECTION_END from the horizontal bar 
98         */
99         void onSelectionEnd_Horizontal(wxCommandEvent& event);
100         /**
101         * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar   
102         */
103         void onMovedBar_Horizontal(wxCommandEvent& event);
104
105
106         //------------------------------------------------------------------------------------------------------------
107         // Methods for capturing events from the vertical bar
108         //------------------------------------------------------------------------------------------------------------
109
110         /**
111         * Handles the event wxEVT_TSBAR from the vertical bar   
112         */
113         void onBarrange_Vertical(wxCommandEvent& event);
114         /**
115         * Handles the event wxEVT_TSBAR_ACTUAL from the vertical bar    
116         */
117         void onActualChange_Bar_Vertical(wxCommandEvent& event);
118         /**
119         * Handles the event wxEVT_TSBAR_START from the vertical bar     
120         */
121         void onStartChange_Bar_Vertical(wxCommandEvent& event);
122         /**
123         * Handles the event wxEVT_TSBAR_END from the vertical bar       
124         */
125         void onEndChange_Bar_Vertical(wxCommandEvent& event);
126         /**
127         * Handles the event wxEVT_SELECTION_END from the vertical bar   
128         */
129         void onSelectionEnd_Vertical(wxCommandEvent& event);
130         /**
131         * Handles the event wxEVT_TSBAR_MOVED from the vertical bar     
132         */
133         void onMovedBar_Vertical(wxCommandEvent& event);
134
135
136         //------------------------------------------------------------------------------------------------------------
137         //  Methods for sending events
138         //------------------------------------------------------------------------------------------------------------
139
140         //------------------------------------------------------------------------------------------------------------
141         //  Attributes getters and setters
142         //------------------------------------------------------------------------------------------------------------
143         
144         /**
145         * Sets the represented values of the vertical bar
146         * @param minRepresented In the minimum represented value of the bar
147         * @param maxRepresented In the maximum represented value of the bar
148         */
149         void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
150
151         /**
152         * Sets the represented values of the horizontal bar
153         * @param minRepresented In the minimum represented value of the bar
154         * @param maxRepresented In the maximum represented value of the bar
155         */
156         void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
157
158         /**
159         * Gets the StartVertical value
160         * @return The StartVertical
161         */
162         int getStartVertical();
163         /**
164         * Gets the EndVertical value
165         * @return The EndVertical
166         */
167         int getEndVertical();
168         /**
169         * Gets the ActualVertical value
170         * @return The ActualVertical
171         */
172         int getActualVertical();
173
174         /**
175         * Sets the StartVertical value
176         * @param nwValue The new value for the StartVertical
177         */
178         void setStartVertical( int nwValue);
179         /**
180         * Sets the EndVertical value
181         * @param nwValue The new value for the EndVertical
182         */
183         void setEndVertical( int nwValue);
184         /**
185         * Sets the ActualVertical value
186         * @param nwValue The new value for the ActualVertical
187         */
188         void setActualVertical( int nwValue);
189
190         /**
191         * Gets the StartHorizontal value
192         * @return The StartHorizontal
193         */
194         int getStartHorizontal();
195         /**
196         * Gets the EndHorizontal value
197         * @return The EndHorizontal
198         */
199         int getEndHorizontal();
200         /**
201         * Gets the ActualHorizontal value
202         * @return The ActualHorizontal
203         */
204         int getActualHorizontal();
205
206         /**
207         * Sets the StartHorizontal value
208         * @param nwValue The new value for the StartHorizontal
209         */
210         void setStartHorizontal( int nwValue);
211         /**
212         * Sets the EndHorizontal value
213         * @param nwValue The new value for the EndHorizontal
214         */
215         void setEndHorizontal( int nwValue);
216         /**
217         * Sets the ActualHorizontal value
218         * @param nwValue The new value for the ActualHorizontal
219         */
220         void setActualHorizontal( int nwValue);
221
222         /**
223         * Sets the horizontal concept values and name
224         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
225         * @param minRepresent The minRepresent value of the concept for setting at the horizontal bar
226         * @param maxRepresent The maxRepresent value of the concept for setting at the horizontal bar
227         * @param minShowed The minShowed value of the concept for setting at the horizontal bar
228         * @param maxShowed The maxShowed value of the concept for setting at the horizontal bar
229         * @param actualShow The actualShow value of the concept for setting at the horizontal bar
230         */
231         void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow ); 
232
233         /**
234         * Sets the vertical concept values and name
235         * @param theVerticalConcept The name of the concept for setting at the vertical bar
236         * @param minRepresent The minRepresent value of the concept for setting at the vertical bar
237         * @param maxRepresent The maxRepresent value of the concept for setting at the vertical bar
238         * @param minShowed The minShowed value of the concept for setting at the vertical bar
239         * @param maxShowed The maxShowed value of the concept for setting at the vertical bar
240         * @param actualShow The actualShow value of the concept for setting at the vertical bar
241         */
242         void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
243         
244         /**
245         * Sets the horizontal concept name
246         * @param theHorizontalConcept The name of the concept for setting at the horizontal bar
247         */
248         void setHorizontalConceptName( std::string theHorizontalConcept );
249
250         /**
251         * Gets the horizontal concept name
252         * @return _horizontalConcept The name of the concept for setting at the horizontal bar
253         */
254         std::string  getHorizontalConceptName(  );
255
256         /**
257         * Sets the vertical concept name
258         * @param theVerticalConcept The name of the concept for setting at the vertical bar
259         */
260         void setVerticalConceptName( std::string theVerticalConcept );
261
262         /**
263         * Gets the vertical concept name
264         * @return _verticalConcept The name of the concept for setting at the vertical bar
265         */
266         std::string  getVerticalConceptName(  );
267
268         //------------------------------------------------------------------------------------------------------------
269         //  Other functional methods
270         //------------------------------------------------------------------------------------------------------------
271
272         void getSpacing( double * spacing );
273
274         wxVtkBaseView* getWxVtkBaseView();
275
276         double getCurrentDeep();
277         
278         void    SetVisibleAxis(bool ok);
279         int             GetX();
280         int             GetY();
281         int             GetZ();
282         void    Refresh();
283
284
285 //this method should be deleted
286         wxVtkBaseView_SceneManager* getSceneManager();
287 ////////////7
288         void initializeScenceManager();
289         bool isEditableCControler(std::string theKeyName);
290         void removeFromScene(std::string theKeyName);
291
292 /////////////////////////////////////////////////////
293         void onChangeInstant(wxCommandEvent& event);
294     void onCreateMultipleROI (wxCommandEvent& event);
295         void onCreateROI (wxCommandEvent& event);
296         void onStopCreateROI (wxCommandEvent& event);
297         void onChangedDeep (wxCommandEvent& event);
298         void onActionButtonPressed(wxCommandEvent& event);
299
300         void removeSceneContours();
301         void addNameWrapperToScene();
302         
303         std::vector<std::string> getSelectedObjects();
304
305         void RefreshInterface();
306
307         vtkImageData* getImageData();
308
309         void configureViewControlTo(std::string theName,manualContourModel* manModelContour,double* spc,int typeofcontour);
310
311         int GetImageDataSizeZ();
312
313         void GetImageDataRange(double *range);
314
315         void SetWidthContour(double width );
316
317         int getColorWindow();
318
319         int getWindowLevel();
320
321         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
322
323         void onInterpolation(bool interpolate);
324
325         void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
326
327         void changeImage(vtkImageData* img);
328
329         void changeDeep();
330
331         void setImageSlice(int z);
332 private:
333         
334         //------------------------------------------------------------------------------------------------------------
335         // Attributtes
336         //------------------------------------------------------------------------------------------------------------
337         wxVtkBaseView_SceneManager* _sceneManager;
338         /*
339         * Represents the outer sizer of the ContourViewPanel
340         */
341         wxFlexGridSizer* outSizer;
342
343         /*
344         * Represents the panel for viewing
345         */
346         wxMaracas_N_ViewersWidget * theViewPanel;
347         /*
348         * Represents the vertical barrange
349         */
350         mBarRange * _verticalBar;
351
352         /*
353         * Represents the horizontal barrange
354         */
355         mBarRange * _horizontalBar;
356
357         vtkImageData * showingVID;      
358
359         std::string _verticalConceptName;
360
361         std::string _horizontalConceptName;
362
363         double last_spacing[3];
364
365         bool _useVerticalBar;
366
367         bool _useHorizontalBar;
368         
369         wxEvtHandler * _eventHandler;
370         
371 //EED
372
373         //------------------------------------------------------------------------------------------------------------
374         //  Private methods
375         //------------------------------------------------------------------------------------------------------------
376
377         
378         
379         wxVtkMPR2DView * GetwxVtkMPR2DView();
380
381
382 //      DECLARE_CLASS(wxContourViewPanel)
383         // any class wishing to process wxWindows events must use this macro
384         //DECLARE_EVENT_TABLE()
385
386 };
387 #endif // __wxContour_ViewPanel__
388