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 #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"
44 #include "vtkOutlineFilter.h"
45 #include "vtkRenderWindowInteractor.h"
47 #include "vtkVolumeRayCastMIPFunction.h"
49 #include "volumerendererdata.h"
51 class vtkClipping3DDataViewer {
53 //----------------------
54 //Constructo-Destructor
55 //----------------------
56 vtkClipping3DDataViewer();
57 virtual ~vtkClipping3DDataViewer();
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);
68 vtkMarchingCubes *GetMCubes(int idTissue);
70 virtual void Refresh();
71 void RefreshSurface();
73 virtual void Configure();
74 void Configure_Tissue();
75 void Configure_Volume();
78 void SetIsovalue(int idTissue, int isoValue);
79 double GetIsovalue(int idTissue);
81 vtkVolume *GetVolumeActor();
82 vtkVolumeRayCastMapper *GetVolumeMapper();
83 vtkPlanes *GetVolumePlanes();
85 void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
86 vtkMPRBaseData* GetVtkMPRBaseData();
88 vtkActor *GetTissueActor(int id);
89 void SetVisibleTissue(int idTissue, bool visible);
90 bool GetVisibleTissue(int idTissue);
91 bool GetVisibleVolume();
92 void SetVisibleVolume(bool visibleVolume);
94 bool GetVisibleVolumeBox();
95 void SetVisibleVolumeBox(bool visibleBox);
97 void SetRepresentationType(int idTissue, bool representationType);
98 bool GetRepresentationType(int idTissue);
100 boxSurfaceObserver *GetObserverS(int idObserverS);
101 boxSurfaceObserver *GetObserverV();
103 //void ReadVolumeFunctions(char *namefile);
104 void ReadVolumeFunctions();
105 void ReadMeshVTK(char *namefile);
108 void Configure_VolumeBox();
109 void SetInteractor(vtkRenderWindowInteractor* interactor);
110 void SetRenderer(vtkRenderer* renderer);
112 //-------------------
114 //-------------------
116 std::vector<double>* GetGreyValuesTransferenceFVector();
117 std::vector<double>* GetIntensityValuesTransferenceFVector();
118 std::vector<double>* GetRedColorsOfColorTransferenceFVector();
119 std::vector<double>* GetGreenColorsOfColorTransferenceFVector();
120 std::vector<double>* GetBlueColorsOfColorTransferenceFVector();
121 std::vector<double>* GetGreyValueColorsOfColorTransferenceFVector();
123 void setColorTransferFunction(vtkColorTransferFunction* colortable);
125 //--------------------------------------
126 //Getters transference function
127 //and color of the transference function
128 //---------------------------------------
129 vtkPiecewiseFunction *GetTransferencefunction();
130 vtkColorTransferFunction *GetColorTransferenceFunction();
132 void SetRayCasting(bool active);
133 void SetMIPActive(bool active);
134 void SetInterpolation(bool active);
135 void SetShade(bool active);
137 void BoxActorChanged(bool changed);
138 void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
143 vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
144 vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
145 vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
146 vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
147 vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
150 vtkOutlineFilter *_outlineData;
151 vtkPolyDataMapper *_mapOutline;
155 vtkPiecewiseFunction *_tfun;
156 vtkColorTransferFunction *_ctfun;
157 // vtkVolumeRayCastCompositeFunction *_compositeFunction;
158 vtkPlanes *_volumePlanes;
159 vtkVolumeRayCastMapper *_volumeMapper;
160 vtkVolumeProperty *_volumeProperty;
162 vtkMPRBaseData *_vtkmprbasedata;
164 bool _visibleVolumeBox;
165 bool _representationType[VTKMPRDATA_MAXTISSUE];
166 bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
167 vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
168 boxSurfaceObserver *_observerV;
169 boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
171 std::vector<double> greyValuesTransferenceFVector;
172 std::vector<double> intensityValuesTransferenceFVector;
173 std::vector<double> redColorsOfColorTransferenceFVector;
174 std::vector<double> greenColorsOfColorTransferenceFVector;
175 std::vector<double> blueColorsOfColorTransferenceFVector;
176 std::vector<double> greyValueColorsOfColorTransferenceFVector;
178 vtkVolumeRayCastCompositeFunction *_compositeFunction;
179 vtkVolumeRayCastMIPFunction *_compositeFunctionMIP ;
186 VolumeRendererData* _volumerendererdata;
189 #endif /*VTKCLIPPING3DDATAVIEWER_H_*/