#include "boxSurfaceObserver.h"
#include "vtkProperty.h"
+
using namespace std;
VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, std::string dataname){
_MIPFunction = 0;
_boxWidgetS1 = 0;
+
+
+/* EED9Juin2011
if(usegpu && _vol->GetDataDimension() > 2){
_volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
_volumeMappergpu->SetClippingPlanes( _volumePlanes );
_volumeMapper->SetInput( _vol );
_volumeMapper->Update();
}
+*/
+ vtkVolumeMapper *volMapperTmp;
+ if(usegpu && _vol->GetDataDimension() > 2){
+ #if (VTK_MAYOR_VERSION>=6 && VTK_MINOR_VERSION>=6)
+ _volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
+ _volumeMappergpu->AutoAdjustSampleDistancesOn();
+ volMapperTmp = _volumeMappergpu;
+ #else
+ _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+ _MIPFunction = vtkVolumeRayCastMIPFunction::New();
+ _volumeMapper = vtkVolumeRayCastMapper::New();
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+ _volumeMapper->AutoAdjustSampleDistancesOn();
+ volMapperTmp = _volumeMapper;
+ #endif
+ }else{
+ _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+ _MIPFunction = vtkVolumeRayCastMIPFunction::New();
+ _volumeMapper = vtkVolumeRayCastMapper::New();
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+ _volumeMapper->AutoAdjustSampleDistancesOn();
+ volMapperTmp = _volumeMapper;
+ }
+
+ volMapperTmp->SetClippingPlanes( _volumePlanes );
+ _newvol->SetMapper(volMapperTmp );
+ volMapperTmp->SetInput( _vol );
+ volMapperTmp->Update();
_newvol->Update();
}
-VolumeRendererManagerData::~VolumeRendererManagerData(){
+VolumeRendererManagerData::~VolumeRendererManagerData()
+{
_tfun->Delete();
_ctfun->Delete();
}
-void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* interactor){
- if(_volumeMappergpu){
+void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* interactor)
+{
+//EED9Juin2011 if(_volumeMappergpu){
_boxWidgetS1 = vtkBoxWidget::New();
_boxWidgetS1->SetInteractor( interactor );
_boxWidgetS1->SetPlaceFactor(1.01);
_boxWidgetS1->PlaceWidget();
vtkBoxWidgetCallback *callback = vtkBoxWidgetCallback::New();
- callback->SetMapper(_volumeMappergpu);
+
+ if (_volumeMapper!=0){
+ callback->SetMapper(_volumeMapper);
+ } else {
+ callback->SetMapper(_volumeMappergpu);
+ }
+
_boxWidgetS1->AddObserver(vtkCommand::InteractionEvent, callback);
callback->Delete();
_boxWidgetS1->EnabledOn();
_boxWidgetS1->GetSelectedFaceProperty()->SetOpacity(0.0);
- }
+//EED9Juin2011 }
}
void VolumeRendererManagerData::DisableBoundingBox(){
#include "vtkCommand.h"
#include <vtkVolumeRayCastCompositeFunction.h>
#include <vtkPlanes.h>
+#include <vtkVolumeMapper.h>
#include <vtkVolumeRayCastMapper.h>
#include <vtkVolumeProperty.h>
#include <vtkVolume.h>
#include <vtkProp3D.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)
+#if (VTK_MAYOR_VERSION>=6 && VTK_MINOR_VERSION>=6)
#include <vtkGPUVolumeRayCastMapper.h>
#endif
+
#include <vector>
vtkVolumeRayCastCompositeFunction *_compositeFunction;
vtkPlanes *_volumePlanes;
- vtkVolumeRayCastMapper *_volumeMapper;
- vtkGPUVolumeRayCastMapper *_volumeMappergpu;
+ vtkVolumeRayCastMapper *_volumeMapper;
+
+
+#if (VTK_MAYOR_VERSION>=6 && VTK_MINOR_VERSION>=6)
+ vtkGPUVolumeRayCastMapper *_volumeMappergpu;
+#else
+ vtkVolumeRayCastMapper *_volumeMappergpu;
+#endif
+
+
vtkVolumeProperty *_volumeProperty;
vtkVolume *_newvol;
vtkPiecewiseFunction* _tfun;