]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h
06f663a90784a5acfdc739973aeb336a7bd8bb0f
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtk3DSurfaceWidget.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: vtk3DSurfaceWidget.h,v $
5   Language:  C++
6   Date:      $Date: 2009/03/24 10:49:21 $
7   Version:   $Revision: 1.2 $
8
9   Copyright: (c) 2002, 2003
10   License:
11   
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17 #ifndef __VTK3DSURFACEWIDGET__
18 #define __VTK3DSURFACEWIDGET__
19
20 #include "wxVTKRenderWindowInteractorEditContour.h"
21
22 #include "vtkImagePolyDataSeedConnectivity.h"
23 #include "vtkInteractorStyleCutter.h"
24 #include "marInterface.h"
25 #include "kernel/marInterfaceCT.h"
26 #include "InterfaceVtkPanelWidgets.h"
27
28 #include <vtkImageData.h>
29 #include <vtkProperty2D.h>
30 #include <vtkPolyData.h>
31 #include <vtkActor.h>
32 #include <vtkMarchingCubes.h>
33 #include <vtkPolyDataMapper.h>
34 #include <vtkRenderer.h>
35 #include <vtkRenderWindow.h>
36 #include <vtkSphereSource.h>
37 #include <vtkOutlineFilter.h>
38 #include <vtkProperty.h>
39
40
41 //------------------------------------------------------------------
42 //------------------------------------------------------------------
43 //------------------------------------------------------------------
44
45 /**
46  * \brief Class that brigde to VTK, override double click...
47  */
48 class vtk3DSurfaceWidget : public wxVTKRenderWindowInteractor
49 {
50 public:
51
52     vtk3DSurfaceWidget(
53         wxWindow* parent,
54         wxWindowID id,
55         const wxPoint& pos = wxDefaultPosition,
56         const wxSize& size = wxDefaultSize,
57         long style = 0,
58         const wxString& name = wxPanelNameStr
59         );
60     ~vtk3DSurfaceWidget();
61     void OnLeftDClick( wxMouseEvent& event );   
62         virtual void OnMouseWheel( wxMouseEvent& event );
63     void Render( );
64
65     void ConfigureVTK( );
66
67     void ShowMARACASData( marInterface* mar );
68         void ShowMARACASDataCT( marInterfaceCT* mar );
69     void SetSurfaceColor(float red, float green, float blue );
70     void SetSurfaceVisibility( bool visible );
71     void SetSurfaceIsoValue( int isoval );
72     void SetSurfaceOpacity( int opaval );
73
74     void GetSphereCenter( double center[3] );
75     void SetAxis( vtkPolyData *axis );
76     void RemoveAxis( );
77
78     ///\todo remove
79     vtkImageData* _marImageData;
80     vtkPolyData* _marPolyData;
81
82     vtkGetMacro(InitialSphere, int);
83
84     void SetInterfaceVtkPanelWidgets(InterfaceVtkPanelWidgets * intVtkPanWid) {_intVtkPanWid=intVtkPanWid;};
85     void SetInitialPoint();
86         void GetLast3DClickPoint( double *pp, double *cp );
87         void InitCameraReset( );
88         vtkRenderer *GetRenderer();
89
90 protected:
91
92     void SetInitialPoint( float* pickPoint, float* cameraPos );
93         void SetLast3DClickPoint( double *pp, double *cp );
94
95     marInterface                                *_mar;
96         marInterfaceCT                          *_marCT;
97     vtkRenderer                                 *_pRenderer;
98     vtkRenderWindow                             *_pRenderWindow;
99     vtkOutlineFilter                    *_outLine;
100     vtkPolyDataMapper                   *_outMapper;
101     vtkActor                                    *_outActor;
102     vtkMarchingCubes                    *_mCubes;
103     vtkPolyDataMapper                   *_surfMapper;
104     vtkActor                                    *_surfActor;
105
106     vtkPolyData                                 *_centralLine;
107     vtkPolyDataMapper                   *_centralLineMapper;
108     vtkActor                                    *_centralLineActor;
109
110     vtkSphereSource                             *_spheres[ 4 ];
111     vtkPolyDataMapper                   *_spheresMapper[ 4 ];
112     vtkActor                                    *_spheresActor[ 4 ];
113
114     vtkPolyDataMapper                   *_axesMapper;
115     vtkActor                                    *_axesActor;
116
117     double                                              _range[2];
118
119         InterfaceVtkPanelWidgets        *_intVtkPanWid;
120
121 private:
122
123     int         _width;
124     int         _height;
125     int         _depth;
126     int         InitialSphere;
127         float   _lastPickPoint[3];
128         float   _lastCameraPos[3];
129
130     DECLARE_EVENT_TABLE( );
131
132 };
133
134 #endif //__VTK3DSURFACEWIDGET__