]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/vtk3DSurfaceWidget.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / vtk3DSurfaceWidget.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: vtk3DSurfaceWidget.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 #ifndef __VTK3DSURFACEWIDGET__
43 #define __VTK3DSURFACEWIDGET__
44
45 #include "wxVTKRenderWindowInteractorEditContour.h"
46
47 #include "vtkImagePolyDataSeedConnectivity.h"
48 #include "vtkInteractorStyleCutter.h"
49 #include "marInterface.h"
50 #include "kernel/marInterfaceCT.h"
51 #include "InterfaceVtkPanelWidgets.h"
52
53 #include <vtkImageData.h>
54 #include <vtkProperty2D.h>
55 #include <vtkPolyData.h>
56 #include <vtkActor.h>
57 #include <vtkMarchingCubes.h>
58 #include <vtkPolyDataMapper.h>
59 #include <vtkRenderer.h>
60 #include <vtkRenderWindow.h>
61 #include <vtkSphereSource.h>
62 #include <vtkOutlineFilter.h>
63 #include <vtkProperty.h>
64
65
66 //------------------------------------------------------------------
67 //------------------------------------------------------------------
68 //------------------------------------------------------------------
69
70 /**
71  * \brief Class that brigde to VTK, override double click...
72  */
73 class vtk3DSurfaceWidget : public wxVTKRenderWindowInteractor
74 {
75 public:
76
77     vtk3DSurfaceWidget(
78         wxWindow* parent,
79         wxWindowID id,
80         const wxPoint& pos = wxDefaultPosition,
81         const wxSize& size = wxDefaultSize,
82         long style = 0,
83         const wxString& name = wxPanelNameStr
84         );
85     ~vtk3DSurfaceWidget();
86     void OnLeftDClick( wxMouseEvent& event );   
87         virtual void OnMouseWheel( wxMouseEvent& event );
88     void Render( );
89
90     void ConfigureVTK( );
91
92     void ShowMARACASData( marInterface* mar );
93         void ShowMARACASDataCT( marInterfaceCT* mar );
94     void SetSurfaceColor(float red, float green, float blue );
95     void SetSurfaceVisibility( bool visible );
96     void SetSurfaceIsoValue( int isoval );
97     void SetSurfaceOpacity( int opaval );
98
99     void GetSphereCenter( double center[3] );
100     void SetAxis( vtkPolyData *axis );
101     void RemoveAxis( );
102
103     ///\todo remove
104     vtkImageData* _marImageData;
105     vtkPolyData* _marPolyData;
106
107     vtkGetMacro(InitialSphere, int);
108
109     void SetInterfaceVtkPanelWidgets(InterfaceVtkPanelWidgets * intVtkPanWid) {_intVtkPanWid=intVtkPanWid;};
110     void SetInitialPoint();
111         void GetLast3DClickPoint( double *pp, double *cp );
112         void InitCameraReset( );
113         vtkRenderer *GetRenderer();
114
115 protected:
116
117     void SetInitialPoint( float* pickPoint, float* cameraPos );
118         void SetLast3DClickPoint( double *pp, double *cp );
119
120     marInterface                                *_mar;
121         marInterfaceCT                          *_marCT;
122     vtkRenderer                                 *_pRenderer;
123     vtkRenderWindow                             *_pRenderWindow;
124     vtkOutlineFilter                    *_outLine;
125     vtkPolyDataMapper                   *_outMapper;
126     vtkActor                                    *_outActor;
127     vtkMarchingCubes                    *_mCubes;
128     vtkPolyDataMapper                   *_surfMapper;
129     vtkActor                                    *_surfActor;
130
131     vtkPolyData                                 *_centralLine;
132     vtkPolyDataMapper                   *_centralLineMapper;
133     vtkActor                                    *_centralLineActor;
134
135     vtkSphereSource                             *_spheres[ 4 ];
136     vtkPolyDataMapper                   *_spheresMapper[ 4 ];
137     vtkActor                                    *_spheresActor[ 4 ];
138
139     vtkPolyDataMapper                   *_axesMapper;
140     vtkActor                                    *_axesActor;
141
142     double                                              _range[2];
143
144         InterfaceVtkPanelWidgets        *_intVtkPanWid;
145
146 private:
147
148     int         _width;
149     int         _height;
150     int         _depth;
151     int         InitialSphere;
152         float   _lastPickPoint[3];
153         float   _lastCameraPos[3];
154
155     DECLARE_EVENT_TABLE( );
156
157 };
158
159 #endif //__VTK3DSURFACEWIDGET__