#include <vtkVolumeRayCastMIPFunction.h>
#include <vtkLookupTable.h>
#include <vector>
+#include <vtkBoxWidget.h>
+#include <vtkGPUVolumeRayCastMapper.h>
+#include "vtkCommand.h"
+// Callback for moving the planes from the box widget to the mapper
+class vtkBoxWidgetCallback : public vtkCommand
+{
+public:
+ static vtkBoxWidgetCallback *New()
+ { return new vtkBoxWidgetCallback; }
+ virtual void Execute(vtkObject *caller, unsigned long, void*)
+ {
+ vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
+ if (this->Mapper)
+ {
+ vtkPlanes *planes = vtkPlanes::New();
+ widget->GetPlanes(planes);
+ this->Mapper->SetClippingPlanes(planes);
+ planes->Delete();
+ }
+ }
+ void SetMapper(vtkGPUVolumeRayCastMapper* m)
+ { this->Mapper = m; }
+
+protected:
+ vtkBoxWidgetCallback()
+ { this->Mapper = 0; }
+
+ //vtkVolumeRayCastMapper *Mapper;
+ vtkGPUVolumeRayCastMapper *Mapper;
+};
-class VolumeRendererManagerData {
+
+class VolumeRendererManagerData : public vtkObject{
public:
VolumeRendererManagerData(vtkImageData* vol, std::string dataname="");
VolumeRendererManagerData(vtkImageData* vol, vtkRenderer* render, std::string dataname="");
+ VolumeRendererManagerData(vtkImageData* vol, bool usegpu, std::string dataname="");
~VolumeRendererManagerData();
/**
** Volume Opacity
**/
void setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value);
+ /**
+ ** Volume Opacity
+ **/
+ void setVolumeOpacity(std::vector<double> greylevel,double value);
vtkPiecewiseFunction* GetTransferFunction(){
return _tfun;
void SetLookupTable(vtkLookupTable* lookuptable);
+ void EnableBoundingBox(vtkRenderWindowInteractor* interactor);
+ void DisableBoundingBox();
protected:
/**
* Prop 3D (data actor)
vtkVolumeRayCastCompositeFunction *_compositeFunction;
vtkPlanes *_volumePlanes;
vtkVolumeRayCastMapper *_volumeMapper;
+ vtkGPUVolumeRayCastMapper *_volumeMappergpu;
vtkVolumeProperty *_volumeProperty;
vtkVolume *_newvol;
vtkPiecewiseFunction* _tfun;
vtkColorTransferFunction* _ctfun;
vtkVolumeRayCastMIPFunction* _MIPFunction;
+ /**
+ ** boxwidget to control the volume
+ **/
+ vtkBoxWidget* _boxWidgetS1;
- void Initialize(vtkImageData* vol, std::string dataname);
+ void Initialize(vtkImageData* vol, std::string dataname, bool usegpu = false);
};