#include "boxSurfaceObserver.h"
#include "vtkProperty.h"
-#include <vtkVolumeRayCastMapper.h>
+
+#if (VTK_MAJOR_VERSION <= 7)
+ #include <vtkVolumeRayCastMapper.h>
+#else
+ #include <vtkFixedPointVolumeRayCastMapper.h>
+#endif
//EED 2017-01-01 Migration VTK7
using namespace std;
-VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, bool usegpu){
+VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, bool usegpu)
+{
Initialize(vol, "", usegpu);
}
-VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, std::string dataname){
+VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, std::string dataname)
+{
Initialize(vol, dataname);
}
-VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, vtkRenderer* render, std::string dataname){
+VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, vtkRenderer* render, std::string dataname)
+{
Initialize(vol, dataname);
render->AddActor(this->getProp3D());
_newvol->SetProperty(_volumeProperty );
- _compositeFunction = 0;
- _MIPFunction = 0;
+#if (VTK_MAJOR_VERSION <= 7)
+ _compositeFunction = 0;
+ _MIPFunction = 0;
+#else
+ // ..
+#endif
- BoxWidget = 0;
+ BoxWidget = 0;
/* EED9Juin2011
if(usegpu && _vol->GetDataDimension() > 2){
_volumeProperty->Delete();
_newvol->Delete();
+
+#if (VTK_MAJOR_VERSION <= 7)
if(_compositeFunction)
_compositeFunction->Delete();
if(_MIPFunction)
_MIPFunction->Delete();
+#else
+ // ..
+#endif
+
if(VolumeMapper)
VolumeMapper->Delete();
/**
** Check if the variables are setted correctly
**/
-void VolumeRendererManagerData::checkInvariant()throw (char *){
- if(!_compositeFunction){
- throw "No composite function initialized";
- }
- if(!_MIPFunction){
- throw "No MIP function initialized";
- }
+void VolumeRendererManagerData::checkInvariant()throw (char *)
+{
+#if (VTK_MAJOR_VERSION <= 7)
+ if(!_compositeFunction)
+ {
+ throw "No composite function initialized";
+ }
+ if(!_MIPFunction)
+ {
+ throw "No MIP function initialized";
+ }
+#else
+ // ..
+#endif
+
if(!VolumeMapper){
throw "No volume mapper initialized";
}
//checkInvariant();
if(VolumeMapper!=NULL){
#if VTK_MAJOR_VERSION >= 6
- if(dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper))
- {
- vtkVolumeRayCastMapper* volumemapper = dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper);
- if(function == 0){
- volumemapper->SetVolumeRayCastFunction(_compositeFunction);
- }else{
- volumemapper->SetVolumeRayCastFunction(_MIPFunction);
- }
- }else if(dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper)){
- vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper);
- if(function == 0){
- volumemapper->SetBlendModeToComposite();
- }else if(function == 1){
- volumemapper->SetBlendModeToMaximumIntensity();
- }else if(function == 2){
- volumemapper->SetBlendModeToMinimumIntensity();
- }
- }
+
+ #if (VTK_MAJOR_VERSION <= 7)
+ if(dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper))
+ {
+ vtkVolumeRayCastMapper* volumemapper = dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper);
+ if(function == 0) {
+ volumemapper->SetVolumeRayCastFunction(_compositeFunction);
+ } else {
+ volumemapper->SetVolumeRayCastFunction(_MIPFunction);
+ }
+ } else if(dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper)){
+ vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper);
+ if(function == 0) {
+ volumemapper->SetBlendModeToComposite();
+ } else if(function == 1) {
+ volumemapper->SetBlendModeToMaximumIntensity();
+ } else if(function == 2) {
+ volumemapper->SetBlendModeToMinimumIntensity();
+ }
+ }
+
+ #else
+ if(dynamic_cast<vtkFixedPointVolumeRayCastMapper*>(VolumeMapper))
+ {
+ vtkFixedPointVolumeRayCastMapper* volumemapper = dynamic_cast<vtkFixedPointVolumeRayCastMapper*>(VolumeMapper);
+ // ... for composote or MIP
+ } else if(dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper)){
+ vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper);
+ if(function == 0) {
+ volumemapper->SetBlendModeToComposite();
+ } else if(function == 1) {
+ volumemapper->SetBlendModeToMaximumIntensity();
+ } else if(function == 2) {
+ volumemapper->SetBlendModeToMinimumIntensity();
+ }
+ }
+ #endif
+
+
+
#else
vtkVolumeRayCastMapper* volumemapper = dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper);
if(function == 0){