2 #ifndef VolumeRendererManagerData_H_
3 #define VolumeRendererManagerData_H_
5 #include <vtkVolumeRayCastCompositeFunction.h>
7 #include <vtkVolumeRayCastMapper.h>
8 #include <vtkVolumeProperty.h>
10 #include <vtkPiecewiseFunction.h>
11 #include <vtkColorTransferFunction.h>
12 #include <vtkImageData.h>
13 #include <vtkProp3D.h>
14 #include <vtkRenderer.h>
15 #include <vtkVolumeRayCastMIPFunction.h>
16 #include <vtkLookupTable.h>
18 #include <vtkBoxWidget.h>
19 #include <vtkGPUVolumeRayCastMapper.h>
20 #include "vtkCommand.h"
22 // Callback for moving the planes from the box widget to the mapper
23 class vtkBoxWidgetCallback : public vtkCommand
26 static vtkBoxWidgetCallback *New()
27 { return new vtkBoxWidgetCallback; }
28 virtual void Execute(vtkObject *caller, unsigned long, void*)
30 vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
33 vtkPlanes *planes = vtkPlanes::New();
34 widget->GetPlanes(planes);
35 this->Mapper->SetClippingPlanes(planes);
39 void SetMapper(vtkGPUVolumeRayCastMapper* m)
43 vtkBoxWidgetCallback()
46 //vtkVolumeRayCastMapper *Mapper;
47 vtkGPUVolumeRayCastMapper *Mapper;
51 class VolumeRendererManagerData : public vtkObject{
54 VolumeRendererManagerData(vtkImageData* vol, std::string dataname="");
55 VolumeRendererManagerData(vtkImageData* vol, vtkRenderer* render, std::string dataname="");
56 VolumeRendererManagerData(vtkImageData* vol, bool usegpu, std::string dataname="");
57 ~VolumeRendererManagerData();
60 ** Check if the variables are setted correctly
62 void checkInvariant()throw (char *);
72 vtkProp3D* getProp3D();
75 ** return the id from the daat
82 void setId(int propid);
87 std::string getDataname();
92 void setDataname(std::string dataname);
97 void setVolumeColor(std::vector<double>& greylevel,
98 std::vector<double>& red,
99 std::vector<double>& green,
100 std::vector<double>& blue);
105 void setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value);
109 void setVolumeOpacity(std::vector<double> greylevel,double value);
111 vtkPiecewiseFunction* GetTransferFunction(){
115 vtkColorTransferFunction* GetColorFunction(){
119 void changeCompositeMIPFunction(int function) throw (char *);
121 void SetLookupTable(vtkLookupTable* lookuptable);
123 void EnableBoundingBox(vtkRenderWindowInteractor* interactor);
124 void DisableBoundingBox();
127 * Prop 3D (data actor)
131 * Dataname given by the user (ex. filename)
133 std::string _dataname;
143 vtkVolumeRayCastCompositeFunction *_compositeFunction;
144 vtkPlanes *_volumePlanes;
145 vtkVolumeRayCastMapper *_volumeMapper;
146 vtkGPUVolumeRayCastMapper *_volumeMappergpu;
147 vtkVolumeProperty *_volumeProperty;
149 vtkPiecewiseFunction* _tfun;
150 vtkColorTransferFunction* _ctfun;
151 vtkVolumeRayCastMIPFunction* _MIPFunction;
153 ** boxwidget to control the volume
155 vtkBoxWidget* _boxWidgetS1;
157 void Initialize(vtkImageData* vol, std::string dataname, bool usegpu = false);
162 #endif /*VolumeRendererManagerData_H_*/