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