#ifndef VolumeRendererManagerData_H_
#define VolumeRendererManagerData_H_
+#include "vtkCommand.h"
#include <vtkVolumeRayCastCompositeFunction.h>
#include <vtkPlanes.h>
+#include <vtkVolumeMapper.h>
#include <vtkVolumeRayCastMapper.h>
#include <vtkVolumeProperty.h>
#include <vtkVolume.h>
#include <vtkRenderer.h>
#include <vtkVolumeRayCastMIPFunction.h>
#include <vtkLookupTable.h>
+#include <vtkBoxWidget.h>
+#include <vtkAbstractMapper.h>
+
+#if (VTK_MAYOR_VERSION>=5 && VTK_MINOR_VERSION>=6)
+ #include <vtkGPUVolumeRayCastMapper.h>
+#endif
+
+
#include <vector>
-class VolumeRendererManagerData {
+// 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(vtkAbstractMapper* m)
+ { this->Mapper = m; }
+
+protected:
+ vtkBoxWidgetCallback()
+ { this->Mapper = 0; }
+
+ //vtkVolumeRayCastMapper *Mapper;
+ vtkAbstractMapper *Mapper;
+};
+
+
+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;
+ vtkVolumeRayCastMapper *_volumeMapper;
+
+
+#if (VTK_MAYOR_VERSION>=5 && VTK_MINOR_VERSION>=6)
+ vtkGPUVolumeRayCastMapper *_volumeMappergpu;
+#else
+ vtkVolumeRayCastMapper *_volumeMappergpu;
+#endif
+
+
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);
};