2 #ifndef __WX__MPR__BASE__DATA__H
3 #define __WX__MPR__BASE__DATA__H
5 #include <vtkCommand.h>
6 #include "vtkRenderWindow.h"
7 #include <vtkVolumeRayCastMapper.h>
8 #include "vtkImageActor.h"
11 #include "vtkPolyDataMapper.h"
12 #include "vtkStripper.h"
13 #include <vtkGlyph3D.h>
14 #include "vtkLODActor.h"
16 //#include "vtkContourFilter.h"
17 //#include "vtkPolyDataNormals.h"
18 #include <vtkMarchingCubes.h>
20 #include <vtkClipPolyData.h>
21 #include "vtkOutlineFilter.h"
22 #include <vtkPiecewiseFunction.h>
23 #include <vtkColorTransferFunction.h>
24 #include <vtkVolume.h>
25 #include <vtkVolumeProperty.h>
26 #include <vtkVolumeRayCastMapper.h>
27 #include <vtkVolumeRayCastCompositeFunction.h>
28 #include <vtkBoxWidget.h>
30 #include "vtkImageData.h"
31 #include "vtkLookupTable.h"
32 //#include "vtkImageActor.h"
33 #include <vtkImageMapToColors.h>
34 #include <vtkPointWidget.h>
36 #include "marImageData.h"
37 //#include "./pPlotter/HistogramDialog.h"
41 //------------------------------------------------------------------
44 #define VTKMPRDATA_MAXTISSUE 4
47 //------------------------------------------------------------------
48 //------------------------------------------------------------------
49 //------------------------------------------------------------------
51 class MARACASVISULIB_EXPORTS vtkBaseData {
54 virtual ~vtkBaseData();
55 vtkImageData* GetImageData();
56 marImageData* GetMarImageData();
57 void SetMarImageData(marImageData *marimagedata);
58 virtual void Configure();
66 marImageData *_marImageData;
72 //------------------------------------------------------------------
73 //------------------------------------------------------------------
74 //------------------------------------------------------------------
76 class MARACASVISULIB_EXPORTS vtkMPRBaseData: public vtkBaseData{
79 virtual ~vtkMPRBaseData();
80 virtual void Configure();
81 int GetMaxPositionX( );
82 int GetMaxPositionY( );
83 int GetMaxPositionZ( );
88 void GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2);
89 vtkTransform *GetTransformOrientation();
90 void SetNormal(double nx, double ny, double nz);
91 void InitTransformOrientation(vtkTransform *trans);
94 int _x1,_x2,_y1,_y2,_z1,_z2;
98 vtkTransform *_transformOrientation;
102 //------------------------------------------------------------------
103 //------------------------------------------------------------------
104 //------------------------------------------------------------------
106 class MARACASVISULIB_EXPORTS vtkMPR3DDataViewer {
108 vtkMPR3DDataViewer();
109 virtual ~vtkMPR3DDataViewer();
110 vtkImageActor* GetImageActor(int id);
111 vtkActor* GetOutlineActor();
112 virtual void Refresh();
113 virtual void Configure();
114 void SetVisiblePosition(int idPosition, bool visible);
115 bool GetVisiblePosition(int idPosition);
116 vtkImageActor* GetvtkActor_saggital();
117 vtkImageActor* GetvtkActor_axial();
118 vtkImageActor* GetvtkActor_coronal();
119 void SetPositionX(int pos);
120 void SetPositionY(int pos);
121 void SetPositionZ(int pos);
122 void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
123 vtkMPRBaseData* GetVtkMPRBaseData();
125 vtkColorTransferFunction *GetvtkColorTransferFunction();
126 std::vector<double > *GetctFunVectorPoint();
127 std::vector<double > *GetctFunVectorRed();
128 std::vector<double > *GetctFunVectorGreen();
129 std::vector<double > *GetctFunVectorBlue();
133 bool _visiblePosition[3];
136 vtkOutlineFilter *_outlineData;
137 vtkPolyDataMapper *_mapOutline;
141 vtkColorTransferFunction *_ctfun;
142 std::vector<double> _ctFunVectorPoint;
143 std::vector<double> _ctFunVectorRed;
144 std::vector<double> _ctFunVectorGreen;
145 std::vector<double> _ctFunVectorBlue;
147 // vtkLookupTable *_bwLut;
148 // vtkLookupTable *_hueLut;
149 // vtkLookupTable *_satLut;
151 vtkImageMapToColors *_saggitalColors;
152 vtkImageActor *_saggital;
153 vtkImageMapToColors *_axialColors;
154 vtkImageActor *_axial;
155 vtkImageMapToColors *_coronalColors;
156 vtkImageActor *_coronal;
157 vtkMPRBaseData *_vtkmprbasedata;
165 //------------------------------------------------------------------
166 //------------------------------------------------------------------
167 //------------------------------------------------------------------
169 // Callback for the interaction
170 //class boxVolumeObserver : public vtkCommand
173 // vtkRenderWindow *_renWin;
174 // vtkVolumeRayCastMapper *_volumeMapper;
177 // boxVolumeObserver() { }
179 // virtual char const *GetClassName() const { return "boxVolumeObserver";}
181 // static boxVolumeObserver *New(){
182 // boxVolumeObserver * result;
183 // result = new boxVolumeObserver();
187 // virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
188 // void SetRenWin( vtkRenderWindow *renWin );
189 // void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper);
192 //------------------------------------------------------------------
193 //------------------------------------------------------------------
194 //------------------------------------------------------------------
196 // Callback for the interaction
197 class boxSurfaceObserver : public vtkCommand
202 vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper;
206 _vtkVolumeRayCastMapper = NULL;
209 virtual char const *GetClassName() const { return "boxSurfaceObserver";}
211 static boxSurfaceObserver *New(){
212 boxSurfaceObserver * result;
213 result = new boxSurfaceObserver();
217 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
218 void SetPlanes(vtkPlanes *planes);
219 void SetActor(vtkProp *actor);
220 void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper);
225 //------------------------------------------------------------------
226 //------------------------------------------------------------------
227 //------------------------------------------------------------------
229 class vtkClipping3DDataViewer {
231 //----------------------
232 //Constructo-Destructor
233 //----------------------
234 vtkClipping3DDataViewer();
235 virtual ~vtkClipping3DDataViewer();
237 // vtkImageActor* GetImageActor(int id);
238 vtkActor* GetOutlineActor();
239 vtkClipPolyData* GetTissueClipper(int id);
240 vtkPolyDataMapper* GetTissueMapper(int id);
241 vtkPlanes* GetTissuePlanes(int id);
242 vtkStripper* GetTissueStripper(int id);
243 // vtkGlyph3D* GetGlyph(int id);
244 vtkLODActor* GetMaceActor(int id);
246 vtkMarchingCubes *GetMCubes(int idTissue);
248 virtual void Refresh();
249 void RefreshSurface();
251 virtual void Configure();
252 void Configure_Tissue();
253 void Configure_Volume();
255 void SetIsovalue(int idTissue, int isoValue);
256 double GetIsovalue(int idTissue);
258 vtkVolume *GetVolumeActor();
259 vtkVolumeRayCastMapper *GetVolumeMapper();
260 vtkPlanes *GetVolumePlanes();
262 void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
263 vtkMPRBaseData* GetVtkMPRBaseData();
265 vtkActor *GetTissueActor(int id);
266 void SetVisibleTissue(int idTissue, bool visible);
267 bool GetVisibleTissue(int idTissue);
268 bool GetVisibleVolume();
269 void SetVisibleVolume(bool visibleVolume);
271 void SetRepresentationType(int idTissue, bool representationType);
272 bool GetRepresentationType(int idTissue);
274 boxSurfaceObserver *GetObserverS(int idObserverS);
275 boxSurfaceObserver *GetObserverV();
277 //void ReadVolumeFunctions(char *namefile);
278 void ReadVolumeFunctions();
279 void ReadMeshVTK(char *namefile);
282 //-------------------
284 //-------------------
286 std::vector<double>* GetGreyValuesTransferenceFVector();
287 std::vector<double>* GetIntensityValuesTransferenceFVector();
288 std::vector<double>* GetRedColorsOfColorTransferenceFVector();
289 std::vector<double>* GetGreenColorsOfColorTransferenceFVector();
290 std::vector<double>* GetBlueColorsOfColorTransferenceFVector();
291 std::vector<double>* GetGreyValueColorsOfColorTransferenceFVector();
293 //--------------------------------------
294 //Getters transference function
295 //and color of the transference function
296 //---------------------------------------
297 vtkPiecewiseFunction *GetTransferencefunction();
298 vtkColorTransferFunction *GetColorTransferenceFunction();
304 vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
305 vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
306 vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
307 vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
308 vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
311 vtkOutlineFilter *_outlineData;
312 vtkPolyDataMapper *_mapOutline;
316 vtkPiecewiseFunction *_tfun;
317 vtkColorTransferFunction *_ctfun;
318 vtkVolumeRayCastCompositeFunction *_compositeFunction;
319 vtkPlanes *_volumePlanes;
320 vtkVolumeRayCastMapper *_volumeMapper;
321 vtkVolumeProperty *_volumeProperty;
324 vtkMPRBaseData *_vtkmprbasedata;
327 bool _representationType[VTKMPRDATA_MAXTISSUE];
328 bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
329 vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
330 boxSurfaceObserver *_observerV;
331 boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
333 std::vector<double> greyValuesTransferenceFVector;
334 std::vector<double> intensityValuesTransferenceFVector;
335 std::vector<double> redColorsOfColorTransferenceFVector;
336 std::vector<double> greenColorsOfColorTransferenceFVector;
337 std::vector<double> blueColorsOfColorTransferenceFVector;
338 std::vector<double> greyValueColorsOfColorTransferenceFVector;
342 #endif // __WX__MPR__BASE__DATA__H