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