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);
62 vtkClipPolyData* GetTissueClipper(int id);
63 vtkPolyDataMapper* GetTissueMapper(int id);
64 vtkPlanes* GetTissuePlanes(int id);
65 vtkStripper* GetTissueStripper(int id);
66 // vtkGlyph3D* GetGlyph(int id);
67 vtkLODActor* GetMaceActor(int id);
69 vtkMarchingCubes *GetMCubes(int idTissue);
71 virtual void Refresh();
72 void RefreshSurface();
74 virtual void Configure();
75 void Configure_Tissue();
76 void Configure_Volume();
79 void SetIsovalue(int idTissue, int isoValue);
80 double GetIsovalue(int idTissue);
82 vtkVolume *GetVolumeActor();
83 vtkVolumeRayCastMapper *GetVolumeMapper();
84 vtkPlanes *GetVolumePlanes();
86 void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
87 vtkMPRBaseData* GetVtkMPRBaseData();
89 vtkActor *GetTissueActor(int id);
90 void SetVisibleTissue(int idTissue, bool visible);
91 bool GetVisibleTissue(int idTissue);
92 bool GetVisibleVolume();
93 void SetVisibleVolume(bool visibleVolume);
95 bool GetVisibleVolumeBox();
96 void SetVisibleVolumeBox(bool visibleBox);
98 void SetRepresentationType(int idTissue, bool representationType);
99 bool GetRepresentationType(int idTissue);
101 boxSurfaceObserver *GetObserverS(int idObserverS);
102 boxSurfaceObserver *GetObserverV();
104 //void ReadVolumeFunctions(char *namefile);
105 void ReadVolumeFunctions();
106 void ReadMeshVTK(char *namefile);
109 void Configure_VolumeBox();
110 void SetInteractor(vtkRenderWindowInteractor* interactor);
111 void SetRenderer(vtkRenderer* renderer);
113 //-------------------
115 //-------------------
117 std::vector<double>* GetGreyValuesTransferenceFVector();
118 std::vector<double>* GetIntensityValuesTransferenceFVector();
119 std::vector<double>* GetRedColorsOfColorTransferenceFVector();
120 std::vector<double>* GetGreenColorsOfColorTransferenceFVector();
121 std::vector<double>* GetBlueColorsOfColorTransferenceFVector();
122 std::vector<double>* GetGreyValueColorsOfColorTransferenceFVector();
124 void setColorTransferFunction(vtkColorTransferFunction* colortable);
126 //--------------------------------------
127 //Getters transference function
128 //and color of the transference function
129 //---------------------------------------
130 vtkPiecewiseFunction *GetTransferencefunction();
131 vtkColorTransferFunction *GetColorTransferenceFunction();
133 void SetRayCasting(bool active);
134 void SetMIPActive(bool active);
135 void SetInterpolation(bool active);
136 void SetShade(bool active);
138 void BoxActorChanged(bool changed);
139 void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
144 vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
145 vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
146 vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
147 vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
148 vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
151 vtkPiecewiseFunction *_tfun;
152 vtkColorTransferFunction *_ctfun;
153 // vtkVolumeRayCastCompositeFunction *_compositeFunction;
154 vtkPlanes *_volumePlanes;
155 vtkVolumeRayCastMapper *_volumeMapper;
156 vtkVolumeProperty *_volumeProperty;
158 vtkMPRBaseData *_vtkmprbasedata;
160 bool _visibleVolumeBox;
161 bool _representationType[VTKMPRDATA_MAXTISSUE];
162 bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
163 vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
164 boxSurfaceObserver *_observerV;
165 boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
167 std::vector<double> greyValuesTransferenceFVector;
168 std::vector<double> intensityValuesTransferenceFVector;
169 std::vector<double> redColorsOfColorTransferenceFVector;
170 std::vector<double> greenColorsOfColorTransferenceFVector;
171 std::vector<double> blueColorsOfColorTransferenceFVector;
172 std::vector<double> greyValueColorsOfColorTransferenceFVector;
174 vtkVolumeRayCastCompositeFunction *_compositeFunction;
175 vtkVolumeRayCastMIPFunction *_compositeFunctionMIP ;
182 VolumeRendererData* _volumerendererdata;
185 #endif /*VTKCLIPPING3DDATAVIEWER_H_*/