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