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