]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h
#3207 creaMaracasVisu Feature New Normal branch vtk7itk4wx3-mingw
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkClipping3DDataViewer.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 #ifndef VTKCLIPPING3DDATAVIEWER_H_
27 #define VTKCLIPPING3DDATAVIEWER_H_
28
29 #include "wxMPRBaseData.h"
30
31 #include "vtkClipPolyData.h"
32 #include "vtkStripper.h"
33 #include "vtkLODActor.h"
34 #include "vtkMarchingCubes.h"
35 #if (VTK_MAJOR_VERSION <= 7) 
36         #include "vtkVolumeRayCastCompositeFunction.h"
37         #include "vtkVolumeRayCastMIPFunction.h"
38         #include "vtkVolumeRayCastMapper.h"
39 #else 
40         #include <vtkFixedPointVolumeRayCastMapper.h>
41 #endif
42 #include "boxSurfaceObserver.h"
43 #include <vtkPiecewiseFunction.h>
44 #include "vtkVolumeProperty.h"
45 #include "vtkPolyDataMapper.h"
46 #include "vtkColorTransferFunction.h"
47 #include "vtkVolume.h"
48 #include "vtkActor.h"
49 #include "vtkOutlineFilter.h"
50 #include "vtkRenderWindowInteractor.h"
51
52
53 #include "volumerendererdata.h"
54
55 class vtkClipping3DDataViewer {
56 public:
57         //----------------------
58         //Constructo-Destructor
59         //----------------------
60         vtkClipping3DDataViewer();
61         virtual ~vtkClipping3DDataViewer();
62
63 //      vtkImageActor*                  GetImageActor(int id);
64
65
66         vtkClipPolyData*                GetTissueClipper(int id);
67         vtkPolyDataMapper*              GetTissueMapper(int id);
68         vtkPlanes*                              GetTissuePlanes(int id);
69         vtkStripper*                    GetTissueStripper(int id);
70 //      vtkGlyph3D*                             GetGlyph(int id);
71         vtkLODActor*                    GetMaceActor(int id);
72
73         vtkMarchingCubes                *GetMCubes(int idTissue);
74
75         virtual void                    Refresh();
76         void                                    RefreshSurface();
77
78         virtual void                    Configure();
79         void                                    Configure_Tissue();
80         void                                    Configure_Volume();
81         void                                    SetImage();
82
83         void                                    SetIsovalue(int idTissue, int isoValue);
84         double                                  GetIsovalue(int idTissue);
85
86         vtkVolume                               *GetVolumeActor();
87         
88 #if (VTK_MAJOR_VERSION <= 7) 
89         vtkVolumeRayCastMapper                          *GetVolumeMapper();
90 #else 
91         vtkFixedPointVolumeRayCastMapper        *GetVolumeMapper();
92 #endif
93
94         vtkPlanes                               *GetVolumePlanes();
95
96         void                                    SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
97         vtkMPRBaseData*                 GetVtkMPRBaseData();
98
99         vtkActor                                *GetTissueActor(int id);
100         void                                    SetVisibleTissue(int idTissue, bool visible);
101         bool                                    GetVisibleTissue(int idTissue);
102         bool                                    GetVisibleVolume();
103         void                                    SetVisibleVolume(bool visibleVolume);
104
105         bool                                    GetVisibleVolumeBox();
106         void                                    SetVisibleVolumeBox(bool visibleBox);
107
108         void                                    SetRepresentationType(int idTissue, bool representationType);
109         bool                                    GetRepresentationType(int idTissue);
110
111         boxSurfaceObserver              *GetObserverS(int idObserverS);
112         boxSurfaceObserver              *GetObserverV();
113
114         //void                                  ReadVolumeFunctions(char *namefile);
115         void                                    ReadVolumeFunctions();
116         void                                    ReadMeshVTK(char *namefile);
117
118
119     void                                        Configure_VolumeBox();
120     void                                        SetInteractor(vtkRenderWindowInteractor* interactor);
121     void                                        SetRenderer(vtkRenderer* renderer);
122
123         //-------------------
124         //Getters Vectors
125         //-------------------
126
127         std::vector<double>*    GetGreyValuesTransferenceFVector();
128         std::vector<double>*    GetIntensityValuesTransferenceFVector();
129         std::vector<double>*    GetRedColorsOfColorTransferenceFVector();
130         std::vector<double>*    GetGreenColorsOfColorTransferenceFVector();
131         std::vector<double>*    GetBlueColorsOfColorTransferenceFVector();
132         std::vector<double>*    GetGreyValueColorsOfColorTransferenceFVector();
133
134         void setColorTransferFunction(vtkColorTransferFunction* colortable);
135
136         //--------------------------------------
137         //Getters transference function
138         //and color of the transference function
139         //---------------------------------------
140         vtkPiecewiseFunction            *GetTransferencefunction();
141         vtkColorTransferFunction        *GetColorTransferenceFunction();
142
143         void                    SetRayCasting(bool active);
144         void                    SetMIPActive(bool active);
145         void                    SetInterpolation(bool active);
146         void                    SetShade(bool active);
147         void                    updateVolume();
148         void                                    BoxActorChanged(bool changed);
149         void                    UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
150
151
152
153 private:
154         vtkMarchingCubes                                        *_mCubes[ VTKMPRDATA_MAXTISSUE ];
155         vtkStripper                                                     *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
156         vtkPolyDataMapper                                       *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
157         vtkPlanes                                                       *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
158         vtkClipPolyData                                         *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
159
160         /// Volume
161         vtkPiecewiseFunction                            *_tfun;
162         vtkColorTransferFunction                        *_ctfun;
163 //      vtkVolumeRayCastCompositeFunction       *_compositeFunction;
164         vtkPlanes                                                       *_volumePlanes;
165         
166 #if (VTK_MAJOR_VERSION <= 7) 
167         vtkVolumeRayCastMapper                          *_volumeMapper;
168 #else 
169         vtkFixedPointVolumeRayCastMapper        *_volumeMapper;
170 #endif
171         
172         
173         vtkVolumeProperty                                       *_volumeProperty;
174         vtkVolume                                                       *_newvol;
175         vtkMPRBaseData                                          *_vtkmprbasedata;
176         bool                                                            _visibleVolume;
177         bool                                                            _visibleVolumeBox;
178         bool                                                            _representationType[VTKMPRDATA_MAXTISSUE];
179         bool                                                            _visibleTissue[VTKMPRDATA_MAXTISSUE];
180         vtkActor                                                        *_tissue[VTKMPRDATA_MAXTISSUE];
181         boxSurfaceObserver                                      *_observerV;
182         boxSurfaceObserver                                      *_observerS[VTKMPRDATA_MAXTISSUE];
183
184         std::vector<double>                                     greyValuesTransferenceFVector;
185         std::vector<double>                                     intensityValuesTransferenceFVector;
186         std::vector<double>                                     redColorsOfColorTransferenceFVector;
187         std::vector<double>                                     greenColorsOfColorTransferenceFVector;
188         std::vector<double>                                     blueColorsOfColorTransferenceFVector;
189         std::vector<double>                                     greyValueColorsOfColorTransferenceFVector;
190
191 #if (VTK_MAJOR_VERSION <= 7) 
192         vtkVolumeRayCastCompositeFunction   *_compositeFunction;
193         vtkVolumeRayCastMIPFunction         *_compositeFunctionMIP ;
194 #else 
195         // ..
196 #endif
197
198
199         bool _isRayCasting;
200         bool _isMIP;
201         bool _interpolation;
202         bool _shade;
203
204         VolumeRendererData* _volumerendererdata;
205 };
206
207 #endif /*VTKCLIPPING3DDATAVIEWER_H_*/