]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h
virtual desctructors
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMPRBaseData.h
1
2 #ifndef __WX__MPR__BASE__DATA__H
3 #define __WX__MPR__BASE__DATA__H
4
5 #include <vtkCommand.h>
6 #include "vtkRenderWindow.h"
7 #include <vtkVolumeRayCastMapper.h>
8 #include "vtkImageActor.h"
9 #include "vtkProp.h"
10 #include "vtkActor.h"
11 #include "vtkPolyDataMapper.h"
12 #include "vtkStripper.h"
13 #include <vtkGlyph3D.h>
14 #include "vtkLODActor.h"
15
16 //#include "vtkContourFilter.h"
17 //#include "vtkPolyDataNormals.h"
18 #include <vtkMarchingCubes.h> 
19
20 #include <vtkClipPolyData.h>
21 #include "vtkOutlineFilter.h"
22 #include <vtkPiecewiseFunction.h>
23 #include <vtkColorTransferFunction.h>
24 #include <vtkVolume.h>
25 #include <vtkVolumeProperty.h>
26 #include <vtkVolumeRayCastMapper.h>
27 #include <vtkVolumeRayCastCompositeFunction.h>
28 #include <vtkBoxWidget.h>
29
30 #include "vtkImageData.h"
31 #include "vtkLookupTable.h"
32 //#include "vtkImageActor.h"
33 #include <vtkImageMapToColors.h> 
34 #include <vtkPointWidget.h> 
35
36 #include "marImageData.h"
37 //#include "./pPlotter/HistogramDialog.h"
38  
39
40 #include "marTypes.h"
41 //------------------------------------------------------------------
42
43
44 #define VTKMPRDATA_MAXTISSUE 4
45
46
47 //------------------------------------------------------------------
48 //------------------------------------------------------------------
49 //------------------------------------------------------------------
50
51 class MARACASVISULIB_EXPORTS vtkBaseData {
52 public:
53         vtkBaseData();
54         virtual ~vtkBaseData();
55         vtkImageData*   GetImageData();
56         marImageData*   GetMarImageData();
57                         void    SetMarImageData(marImageData *marimagedata);
58         virtual void    Configure();
59         double                  GetZ();
60         void                    SetZ(double z);
61
62         int                             GetT();
63         void                    SetT(double t);
64
65 protected:
66         marImageData    *_marImageData;
67         double                  _z;
68         int                             _t;
69 };
70
71
72 //------------------------------------------------------------------
73 //------------------------------------------------------------------
74 //------------------------------------------------------------------
75
76 class MARACASVISULIB_EXPORTS vtkMPRBaseData: public vtkBaseData{
77 public:
78         vtkMPRBaseData();
79         virtual ~vtkMPRBaseData();
80         virtual void                    Configure();
81         int                                             GetMaxPositionX( );
82         int                                             GetMaxPositionY( );
83         int                                             GetMaxPositionZ( );
84         double                                  GetX();
85         double                                  GetY();
86         void                                    SetX(double x);
87         void                                    SetY(double y);
88         void                                    GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2);
89         vtkTransform                    *GetTransformOrientation();
90         void                                    SetNormal(double nx, double ny, double nz);
91         void                                    InitTransformOrientation(vtkTransform *trans);
92
93 protected:
94         int                                             _x1,_x2,_y1,_y2,_z1,_z2;
95
96 private:
97         double                                  _x,_y;
98         vtkTransform                    *_transformOrientation;
99 };
100
101
102 //------------------------------------------------------------------
103 //------------------------------------------------------------------
104 //------------------------------------------------------------------
105
106 class MARACASVISULIB_EXPORTS vtkMPR3DDataViewer {
107 public:
108         vtkMPR3DDataViewer();
109         virtual ~vtkMPR3DDataViewer();
110         vtkImageActor*                  GetImageActor(int id);
111         vtkActor*                               GetOutlineActor();
112         virtual void                    Refresh();
113         virtual void                    Configure();
114         void                                    SetVisiblePosition(int idPosition, bool visible);
115         bool                                    GetVisiblePosition(int idPosition);
116         vtkImageActor*                  GetvtkActor_saggital();
117         vtkImageActor*                  GetvtkActor_axial();
118         vtkImageActor*                  GetvtkActor_coronal();
119         void                                    SetPositionX(int pos);
120         void                                    SetPositionY(int pos);
121         void                                    SetPositionZ(int pos);
122         void                                    SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
123         vtkMPRBaseData*                 GetVtkMPRBaseData();
124         
125         vtkColorTransferFunction   *GetvtkColorTransferFunction();
126         std::vector<double >       *GetctFunVectorPoint();
127         std::vector<double >       *GetctFunVectorRed();
128         std::vector<double >       *GetctFunVectorGreen();
129         std::vector<double >       *GetctFunVectorBlue();
130
131 private:
132         
133         bool                                                            _visiblePosition[3];
134
135         // outline
136         vtkOutlineFilter                                        *_outlineData;
137         vtkPolyDataMapper                                       *_mapOutline;
138         vtkActor                                                        *_outline;
139
140         //
141         vtkColorTransferFunction                        *_ctfun;
142         std::vector<double>                                     _ctFunVectorPoint;
143         std::vector<double>                                     _ctFunVectorRed;
144         std::vector<double>                                     _ctFunVectorGreen;
145         std::vector<double>                                     _ctFunVectorBlue;
146
147 //      vtkLookupTable                                          *_bwLut;
148 //      vtkLookupTable                                          *_hueLut;
149 //      vtkLookupTable                                          *_satLut;
150
151         vtkImageMapToColors                                     *_saggitalColors;
152         vtkImageActor                                           *_saggital;
153         vtkImageMapToColors                                     *_axialColors;
154         vtkImageActor                                           *_axial;
155         vtkImageMapToColors                                     *_coronalColors;
156         vtkImageActor                                           *_coronal;
157         vtkMPRBaseData                                          *_vtkmprbasedata;
158
159
160 };
161
162
163
164
165 //------------------------------------------------------------------
166 //------------------------------------------------------------------
167 //------------------------------------------------------------------
168
169 // Callback for the interaction
170 //class boxVolumeObserver : public vtkCommand
171 //{
172 //      public:
173 //              vtkRenderWindow                 *_renWin;
174 //              vtkVolumeRayCastMapper  *_volumeMapper;
175 //
176 //
177 //              boxVolumeObserver() {  }
178 //
179 //              virtual char const *GetClassName() const { return "boxVolumeObserver";}
180 //
181 //              static boxVolumeObserver *New(){
182 //                              boxVolumeObserver * result;
183 //                              result = new boxVolumeObserver();
184 //                      return result;
185 //              }
186 //
187 //              virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
188 //              void SetRenWin( vtkRenderWindow *renWin );
189 //              void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper);
190 //};
191
192 //------------------------------------------------------------------
193 //------------------------------------------------------------------
194 //------------------------------------------------------------------
195
196 // Callback for the interaction
197 class boxSurfaceObserver : public vtkCommand
198 {
199         public:
200                 vtkPlanes                                       *_planes;
201                 vtkProp                                         *_actor;
202                 vtkVolumeRayCastMapper          *_vtkVolumeRayCastMapper;
203
204                 boxSurfaceObserver() 
205                 {  
206                         _vtkVolumeRayCastMapper = NULL;
207                 }
208
209                 virtual char const *GetClassName() const { return "boxSurfaceObserver";}
210
211                 static boxSurfaceObserver *New(){
212                                 boxSurfaceObserver * result;
213                                 result = new boxSurfaceObserver();
214                         return result;
215                 }
216
217                 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
218                 void SetPlanes(vtkPlanes *planes);
219                 void SetActor(vtkProp *actor);
220                 void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper);
221 };
222
223
224
225 //------------------------------------------------------------------
226 //------------------------------------------------------------------
227 //------------------------------------------------------------------
228
229 class vtkClipping3DDataViewer {
230 public:
231         //----------------------
232         //Constructo-Destructor
233         //----------------------
234         vtkClipping3DDataViewer();
235         virtual ~vtkClipping3DDataViewer();
236
237 //      vtkImageActor*                  GetImageActor(int id);
238         vtkActor*                               GetOutlineActor();
239         vtkClipPolyData*                GetTissueClipper(int id);
240         vtkPolyDataMapper*              GetTissueMapper(int id);
241         vtkPlanes*                              GetTissuePlanes(int id);
242         vtkStripper*                    GetTissueStripper(int id);
243 //      vtkGlyph3D*                             GetGlyph(int id);
244         vtkLODActor*                    GetMaceActor(int id);
245
246         vtkMarchingCubes                *GetMCubes(int idTissue);
247
248         virtual void                    Refresh();
249                         void                    RefreshSurface();
250
251         virtual void                    Configure();
252         void                                    Configure_Tissue();
253         void                                    Configure_Volume();
254
255         void                                    SetIsovalue(int idTissue, int isoValue);
256         double                                  GetIsovalue(int idTissue);
257
258         vtkVolume                               *GetVolumeActor();
259         vtkVolumeRayCastMapper  *GetVolumeMapper();
260         vtkPlanes                               *GetVolumePlanes();
261
262         void                                    SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
263         vtkMPRBaseData*                 GetVtkMPRBaseData();
264
265         vtkActor                                *GetTissueActor(int id);
266         void                                    SetVisibleTissue(int idTissue, bool visible);
267         bool                                    GetVisibleTissue(int idTissue);
268         bool                                    GetVisibleVolume();
269         void                                    SetVisibleVolume(bool visibleVolume);
270
271         void                                    SetRepresentationType(int idTissue, bool representationType);
272         bool                                    GetRepresentationType(int idTissue);
273
274         boxSurfaceObserver              *GetObserverS(int idObserverS);
275         boxSurfaceObserver              *GetObserverV();
276
277         //void                                  ReadVolumeFunctions(char *namefile); 
278         void                                    ReadVolumeFunctions(); 
279         void                                    ReadMeshVTK(char *namefile); 
280
281
282         //-------------------
283         //Getters Vectors
284         //-------------------
285
286         std::vector<double>*                                    GetGreyValuesTransferenceFVector();
287         std::vector<double>*                                    GetIntensityValuesTransferenceFVector();
288         std::vector<double>*                                    GetRedColorsOfColorTransferenceFVector();
289         std::vector<double>*                                    GetGreenColorsOfColorTransferenceFVector();
290         std::vector<double>*                                    GetBlueColorsOfColorTransferenceFVector();
291         std::vector<double>*                                    GetGreyValueColorsOfColorTransferenceFVector();
292
293         //--------------------------------------
294         //Getters transference function
295         //and color of the transference function
296         //---------------------------------------
297         vtkPiecewiseFunction                            *GetTransferencefunction();
298         vtkColorTransferFunction                        *GetColorTransferenceFunction();
299
300
301
302 private:
303         
304         vtkMarchingCubes                                        *_mCubes[ VTKMPRDATA_MAXTISSUE ];
305         vtkStripper                                                     *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
306         vtkPolyDataMapper                                       *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
307         vtkPlanes                                                       *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
308         vtkClipPolyData                                         *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
309
310         // outline
311         vtkOutlineFilter                                        *_outlineData;
312         vtkPolyDataMapper                                       *_mapOutline;
313         vtkActor                                                        *_outline;
314
315         /// Volume
316         vtkPiecewiseFunction                            *_tfun;
317         vtkColorTransferFunction                        *_ctfun;
318         vtkVolumeRayCastCompositeFunction       *_compositeFunction;
319         vtkPlanes                                                       *_volumePlanes;
320         vtkVolumeRayCastMapper                          *_volumeMapper;
321         vtkVolumeProperty                                       *_volumeProperty;
322         vtkVolume                                                       *_newvol;
323
324         vtkMPRBaseData                                          *_vtkmprbasedata;
325
326         bool                                                            _visibleVolume;
327         bool                                                            _representationType[VTKMPRDATA_MAXTISSUE];
328         bool                                                            _visibleTissue[VTKMPRDATA_MAXTISSUE];
329         vtkActor                                                        *_tissue[VTKMPRDATA_MAXTISSUE];
330         boxSurfaceObserver                                      *_observerV;
331         boxSurfaceObserver                                      *_observerS[VTKMPRDATA_MAXTISSUE];
332
333         std::vector<double>                                     greyValuesTransferenceFVector;
334         std::vector<double>                                     intensityValuesTransferenceFVector;
335         std::vector<double>                                     redColorsOfColorTransferenceFVector;
336         std::vector<double>                                     greenColorsOfColorTransferenceFVector;
337         std::vector<double>                                     blueColorsOfColorTransferenceFVector;
338         std::vector<double>                                     greyValueColorsOfColorTransferenceFVector;
339 };
340
341
342 #endif // __WX__MPR__BASE__DATA__H
343
344