2 #ifndef VolumeRendererManagerData_H_
3 #define VolumeRendererManagerData_H_
5 #include "vtkCommand.h"
6 #include <vtkVolumeRayCastCompositeFunction.h>
8 #include <vtkVolumeMapper.h>
9 #include <vtkVolumeRayCastMapper.h>
10 #include <vtkVolumeProperty.h>
11 #include <vtkVolume.h>
12 #include <vtkPiecewiseFunction.h>
13 #include <vtkColorTransferFunction.h>
14 #include <vtkImageData.h>
15 #include <vtkProp3D.h>
16 #include <vtkRenderer.h>
17 #include <vtkVolumeRayCastMIPFunction.h>
18 #include <vtkLookupTable.h>
19 #include <vtkBoxWidget.h>
20 #include <vtkAbstractMapper.h>
22 #if (VTK_MAYOR_VERSION>=6 && VTK_MINOR_VERSION>=6)
23 #include <vtkGPUVolumeRayCastMapper.h>
30 // Callback for moving the planes from the box widget to the mapper
31 class vtkBoxWidgetCallback : public vtkCommand
34 static vtkBoxWidgetCallback *New()
35 { return new vtkBoxWidgetCallback; }
36 virtual void Execute(vtkObject *caller, unsigned long, void*)
38 vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
41 vtkPlanes *planes = vtkPlanes::New();
42 widget->GetPlanes(planes);
43 this->Mapper->SetClippingPlanes(planes);
47 void SetMapper(vtkAbstractMapper* m)
51 vtkBoxWidgetCallback()
54 //vtkVolumeRayCastMapper *Mapper;
55 vtkAbstractMapper *Mapper;
59 class VolumeRendererManagerData : public vtkObject{
62 VolumeRendererManagerData(vtkImageData* vol, std::string dataname="");
63 VolumeRendererManagerData(vtkImageData* vol, vtkRenderer* render, std::string dataname="");
64 VolumeRendererManagerData(vtkImageData* vol, bool usegpu, std::string dataname="");
65 ~VolumeRendererManagerData();
68 ** Check if the variables are setted correctly
70 void checkInvariant()throw (char *);
80 vtkProp3D* getProp3D();
83 ** return the id from the daat
90 void setId(int propid);
95 std::string getDataname();
100 void setDataname(std::string dataname);
105 void setVolumeColor(std::vector<double>& greylevel,
106 std::vector<double>& red,
107 std::vector<double>& green,
108 std::vector<double>& blue);
113 void setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value);
117 void setVolumeOpacity(std::vector<double> greylevel,double value);
119 vtkPiecewiseFunction* GetTransferFunction(){
123 vtkColorTransferFunction* GetColorFunction(){
127 void changeCompositeMIPFunction(int function) throw (char *);
129 void SetLookupTable(vtkLookupTable* lookuptable);
131 void EnableBoundingBox(vtkRenderWindowInteractor* interactor);
132 void DisableBoundingBox();
135 * Prop 3D (data actor)
139 * Dataname given by the user (ex. filename)
141 std::string _dataname;
151 vtkVolumeRayCastCompositeFunction *_compositeFunction;
152 vtkPlanes *_volumePlanes;
153 vtkVolumeRayCastMapper *_volumeMapper;
156 #if (VTK_MAYOR_VERSION>=6 && VTK_MINOR_VERSION>=6)
157 vtkGPUVolumeRayCastMapper *_volumeMappergpu;
159 vtkVolumeRayCastMapper *_volumeMappergpu;
163 vtkVolumeProperty *_volumeProperty;
165 vtkPiecewiseFunction* _tfun;
166 vtkColorTransferFunction* _ctfun;
167 vtkVolumeRayCastMIPFunction* _MIPFunction;
169 ** boxwidget to control the volume
171 vtkBoxWidget* _boxWidgetS1;
173 void Initialize(vtkImageData* vol, std::string dataname, bool usegpu = false);
178 #endif /*VolumeRendererManagerData_H_*/