1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #ifndef VTKCLIPPING3DDATAVIEWER_H_
27 #define VTKCLIPPING3DDATAVIEWER_H_
29 #include "wxMPRBaseData.h"
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"
40 #include <vtkFixedPointVolumeRayCastMapper.h>
42 #include "boxSurfaceObserver.h"
43 #include <vtkPiecewiseFunction.h>
44 #include "vtkVolumeProperty.h"
45 #include "vtkPolyDataMapper.h"
46 #include "vtkColorTransferFunction.h"
47 #include "vtkVolume.h"
49 //#include "vtkOutlineFilter.h"
50 #include "vtkRenderWindowInteractor.h"
53 #include "volumerendererdata.h"
55 class vtkClipping3DDataViewer {
57 //----------------------
58 //Constructo-Destructor
59 //----------------------
60 vtkClipping3DDataViewer();
61 virtual ~vtkClipping3DDataViewer();
63 // vtkImageActor* GetImageActor(int id);
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);
73 vtkMarchingCubes *GetMCubes(int idTissue);
75 virtual void Refresh();
76 void RefreshSurface();
78 virtual void Configure();
79 void Configure_Tissue();
80 void Configure_Volume();
83 void SetIsovalue(int idTissue, int isoValue);
84 double GetIsovalue(int idTissue);
86 vtkVolume *GetVolumeActor();
88 #if (VTK_MAJOR_VERSION <= 7)
89 vtkVolumeRayCastMapper *GetVolumeMapper();
91 vtkFixedPointVolumeRayCastMapper *GetVolumeMapper();
94 vtkPlanes *GetVolumePlanes();
96 void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
97 vtkMPRBaseData* GetVtkMPRBaseData();
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);
105 bool GetVisibleVolumeBox();
106 void SetVisibleVolumeBox(bool visibleBox);
108 void SetRepresentationType(int idTissue, bool representationType);
109 bool GetRepresentationType(int idTissue);
111 boxSurfaceObserver *GetObserverS(int idObserverS);
112 boxSurfaceObserver *GetObserverV();
114 //void ReadVolumeFunctions(char *namefile);
115 void ReadVolumeFunctions();
116 void ReadMeshVTK(char *namefile);
119 void Configure_VolumeBox();
120 void SetInteractor(vtkRenderWindowInteractor* interactor);
121 void SetRenderer(vtkRenderer* renderer);
123 //-------------------
125 //-------------------
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();
134 void setColorTransferFunction(vtkColorTransferFunction* colortable);
136 //--------------------------------------
137 //Getters transference function
138 //and color of the transference function
139 //---------------------------------------
140 vtkPiecewiseFunction *GetTransferencefunction();
141 vtkColorTransferFunction *GetColorTransferenceFunction();
143 void SetRayCasting(bool active);
144 void SetMIPActive(bool active);
145 void SetInterpolation(bool active);
146 void SetShade(bool active);
148 void BoxActorChanged(bool changed);
149 void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
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 ];
161 vtkPiecewiseFunction *_tfun;
162 vtkColorTransferFunction *_ctfun;
163 // vtkVolumeRayCastCompositeFunction *_compositeFunction;
164 vtkPlanes *_volumePlanes;
166 #if (VTK_MAJOR_VERSION <= 7)
167 vtkVolumeRayCastMapper *_volumeMapper;
169 vtkFixedPointVolumeRayCastMapper *_volumeMapper;
173 vtkVolumeProperty *_volumeProperty;
175 vtkMPRBaseData *_vtkmprbasedata;
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];
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;
191 #if (VTK_MAJOR_VERSION <= 7)
192 vtkVolumeRayCastCompositeFunction *_compositeFunction;
193 vtkVolumeRayCastMIPFunction *_compositeFunctionMIP ;
204 VolumeRendererData* _volumerendererdata;
207 #endif /*VTKCLIPPING3DDATAVIEWER_H_*/