]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/wxImageViewerWidget.h
#3128 creaMaracasVisu Feature New Normal - branch changeWx28to30 compilation with...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / wxImageViewerWidget.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 /*=========================================================================
27
28   Program:   wxMaracas
29   Module:    $RCSfile: wxImageViewerWidget.h,v $
30   Language:  C++
31   Date:      $Date: 2012/11/15 14:15:18 $
32   Version:   $Revision: 1.2 $
33
34   Copyright: (c) 2002, 2003
35   License:
36   
37      This software is distributed WITHOUT ANY WARRANTY; without even 
38      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
39      PURPOSE.  See the above copyright notice for more information.
40
41 =========================================================================*/
42
43 #ifndef __WX__IMAGE__VIEWER__WIDGET__
44 #define __WX__IMAGE__VIEWER__WIDGET__
45
46 //As it is extremely easy to use vtkImageViewer/ vtkImageViewer2, I gave up with
47 //vtkImagePlaneWidget
48 #include <wx/wx.h>
49
50 #include "InterfaceVtkPanelWidgets.h"
51 //  #include "vtk3DSurfaceWidget.h"  //EED pour avoir access a la classe "InterfaceVtkPanelWidgets"
52
53 #include "../manualContour.h"
54 #include "wxVTKRenderWindowInteractorEditContour.h"
55
56 #include "wxVTKRenderWindowInteractor.h"
57 #include "vtkImageViewer2.h"
58 #include "vtkImageData.h"
59 #include "vtkActor.h"
60 #include "vtkPoints.h"
61
62 class marZoomROIObserver;
63
64
65 class wxVtk2DView_TMP : public wxVtkBaseView{
66 public:
67         wxVtk2DView_TMP(vtkImageViewer2 *imageviewer2);
68         ~wxVtk2DView_TMP();
69         virtual vtkRenderer                     *GetRenderer(); 
70         virtual vtkRenderWindow         *GetRenWin();
71         virtual void                            Configure();
72         void                                            SetWxVTKRenderWindowInteractor( wxVTKRenderWindowInteractor *wxVTKiren);
73         virtual crea::wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor();
74
75 private:
76         wxVTKRenderWindowInteractor *_wxVTKiren;
77         vtkImageViewer2                         *_imageviewer2;
78 };
79
80
81 /**
82  * \brief Panel class composed of a vtk renderwindow with double click available 
83  * and add some buttons
84  */
85 class wxImageViewerWidget : public wxPanel{
86 public:
87
88     wxImageViewerWidget(
89         wxWindow                *parent,
90         wxWindowID              id              = -1,
91         const wxPoint   &pos    = wxDefaultPosition,
92         const wxSize&   size    = wxDefaultSize,
93         long                    style   = wxSUNKEN_BORDER, //wxTAB_TRAVERSAL,
94         const wxString& name    = wxPanelNameStr
95         );
96     ~wxImageViewerWidget( );
97     
98          virtual void ConstructVTK(vtkImageData *imageData);
99      virtual void ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata);
100                          void ExecuteEvent1(vtkObject *wdg, unsigned long event, void* calldata);
101                          void ExecuteEvent2(vtkObject *wdg, unsigned long event, void* calldata);
102                          void SetImage(vtkImageData* imagedata);
103                          void SetInterfaceVtkPanelWidgets(InterfaceVtkPanelWidgets * intVtkPanWid) { _intVtkPanWid = intVtkPanWid; };
104
105                          void    SetState(int state);
106                          void    SetStateManualContour(int state);
107                          void    CreateNewManualContour();
108                          int     GetNumberOfPointsSplineManualContour();
109                          double* GetVectorPointsXManualContour();
110                          double* GetVectorPointsYManualContour();
111                          void    EraseManualContour();
112                          void    SetZSlice(int z);
113                          int     GetZSlice();
114                          void    Render();
115
116
117         void AddObserver_1();
118         void AddObserver_2();
119
120 protected:
121         int                                                                              _state;
122         marZoomROIObserver                                              *_Observer;
123         vtkInteractorStyle2DMaracas                             *_interactorStyle2DMaracas;
124         vtkImageViewer2                                                 *_imageViewer;
125         InterfaceVtkPanelWidgets                                *_intVtkPanWid;
126         wxVTKRenderWindowInteractorEditContour  *_wxVTKiren;
127
128 private:
129     manualContourControler                                      *_manContControl;
130         manualContourModel                                              *_mContourModel;
131         manualViewContour                                               *_mViewContour;
132
133 };
134
135 //----------------------------------------------------------------------------
136
137 class wxImageViewerWidgetRoi : public wxImageViewerWidget{
138 public :
139         wxImageViewerWidgetRoi(
140         wxWindow* parent,
141         wxWindowID              id              = -1,
142         const wxPoint   &pos    = wxDefaultPosition,
143         const wxSize&   size    = wxDefaultSize,
144                           long          style   = wxSUNKEN_BORDER, //wxTAB_TRAVERSAL,
145         const wxString& name    = wxPanelNameStr
146         );
147     ~wxImageViewerWidgetRoi( );
148         void GetROI( int extent[6] );
149         virtual void ConstructVTK(vtkImageData *imageData);
150         void TransfromeCoordViewWorld(int &X, int &Y, int &Z);
151         bool GetRoiSelected();
152
153 private :
154     virtual void ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata);
155         bool                                            _bboxEnabled;
156         bool                                            _sliceEnabled;
157         bool                                            _RoiSelected;
158         vtkPoints                                       *_pts;
159         vtkActor                                        *_bboxActor;
160         vtkPolyDataMapper                       *_bboxMapper;
161     vtkPolyData                                 *_pd;
162 };
163 #endif // __WX__IMAGE__VIEWER__WIDGET__