X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FKernel%2FVTKObjects%2FVolumeRenderer%2Fvolumerenderermanagerdata.h;h=802372840ebf7e83e949c8cf89cba99e1f812f0e;hb=962d2237c57a96d4a644da68b967abbbe1288840;hp=ad0ba5f372df05978f7edbf96078bf974e26edb2;hpb=65c158dc171f8d3114ee3544b2a94a1f41880df0;p=creaMaracasVisu.git diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.h b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.h index ad0ba5f..8023728 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.h +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.h @@ -15,13 +15,45 @@ #include #include #include +#include +#include +#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(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(); /** @@ -71,6 +103,10 @@ public: ** Volume Opacity **/ void setVolumeOpacity(std::vector greylevel,std::vector value); + /** + ** Volume Opacity + **/ + void setVolumeOpacity(std::vector greylevel,double value); vtkPiecewiseFunction* GetTransferFunction(){ return _tfun; @@ -84,6 +120,8 @@ public: void SetLookupTable(vtkLookupTable* lookuptable); + void EnableBoundingBox(vtkRenderWindowInteractor* interactor); + void DisableBoundingBox(); protected: /** * Prop 3D (data actor) @@ -105,13 +143,18 @@ private: 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); };