creaContours_lib
wxContourViewPanel.h
Go to the documentation of this file.
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>
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 
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 
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 
109  void onBarrange_Horizontal(wxCommandEvent& event);
113  void onActualChange_Bar_Horizontal(wxCommandEvent& event);
117  void onStartChange_Bar_Horizontal(wxCommandEvent& event);
121  void onEndChange_Bar_Horizontal(wxCommandEvent& event);
125  void onSelectionEnd_Horizontal(wxCommandEvent& event);
129  void onMovedBar_Horizontal(wxCommandEvent& event);
130 
131 
132  //------------------------------------------------------------------------------------------------------------
133  // Methods for capturing events from the vertical bar
134  //------------------------------------------------------------------------------------------------------------
135 
139  void onBarrange_Vertical(wxCommandEvent& event);
143  void onActualChange_Bar_Vertical(wxCommandEvent& event);
147  void onStartChange_Bar_Vertical(wxCommandEvent& event);
151  void onEndChange_Bar_Vertical(wxCommandEvent& event);
155  void onSelectionEnd_Vertical(wxCommandEvent& event);
159  void onMovedBar_Vertical(wxCommandEvent& event);
160 
161 
162  //------------------------------------------------------------------------------------------------------------
163  // Methods for sending events
164  //------------------------------------------------------------------------------------------------------------
165 
166  //------------------------------------------------------------------------------------------------------------
167  // Attributes getters and setters
168  //------------------------------------------------------------------------------------------------------------
169 
175  void setVerticalRepresentedValues( int minRepresented, int maxRepresented );
176 
182  void setHorizontalRepresentedValues( int minRepresented, int maxRepresented );
183 
188  int getStartVertical();
193  int getEndVertical();
198  int getActualVertical();
199 
204  void setStartVertical( int nwValue);
209  void setEndVertical( int nwValue);
214  void setActualVertical( int nwValue);
215 
220  int getStartHorizontal();
225  int getEndHorizontal();
230  int getActualHorizontal();
231 
236  void setStartHorizontal( int nwValue);
241  void setEndHorizontal( int nwValue);
246  void setActualHorizontal( int nwValue);
247 
257  void setHorizontalConcept( std::string theHorizontalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
258 
268  void setVerticalConcept( std::string theVerticalConcept, int minRepresent, int maxRepresent, int minShowed, int maxShowed, int actualShow );
269 
274  void setHorizontalConceptName( std::string theHorizontalConcept );
275 
280  std::string getHorizontalConceptName( );
281 
286  void setVerticalConceptName( std::string theVerticalConcept );
287 
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();
314  void initializeScenceManager();
315  bool isEditableCControler(std::string theKeyName);
316  void removeFromScene(std::string theKeyName);
317 
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  //------------------------------------------------------------------------------------------------------------
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 
388 
389  double last_spacing[3];
390 
392 
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