/**
** Start of the manager class
**/
-VolumeRendererManager::VolumeRendererManager(){
- _renderer = NULL;
- _idCount=0;
+VolumeRendererManager::VolumeRendererManager()
+{
+ _renderer = NULL;
+ _idCount = 0;
}
-VolumeRendererManager::~VolumeRendererManager(){
- _renderer = 0;
- _idCount=0;
- image = 0;
+
+VolumeRendererManager::~VolumeRendererManager()
+{
+ _renderer = 0;
+ _idCount = 0;
+ image = 0;
for(unsigned i = 0; i < prop3Dvect.size();i++){
prop3Dvect[i]->Delete();
}
/**
** Sets the renderer to manage the prop3D from the view
**/
-void VolumeRendererManager::setRenderer(vtkRenderer* renderer){
+void VolumeRendererManager::setRenderer(vtkRenderer* renderer)
+{
_renderer = renderer;
}
/**
** Updates Volume
**/
-void VolumeRendererManager::Update(int ppid){
+void VolumeRendererManager::Update(int ppid)
+{
VolumeRendererManagerData* data = this->getViewData(ppid);
data->Update();
_renderer->Render();
if this flag is set to false and the volume has multiple components, vtkImageAppendComponents is used to create
a single representation of the image.
*/
-int VolumeRendererManager::addVolume(vtkImageData* img, vtkRenderWindowInteractor* interactor, bool independentcomponents){
- if(img->GetNumberOfScalarComponents() > 1 && !independentcomponents){
-
-
+int VolumeRendererManager::addVolume(vtkImageData* img, vtkRenderWindowInteractor* interactor, bool independentcomponents)
+{
+ if(img->GetNumberOfScalarComponents() > 1 && !independentcomponents)
+ {
image = img;
-
vtkSmartPointer< vtkImageLuminance > luminance = vtkSmartPointer< vtkImageLuminance >::New();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
#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){
#define VolumeRendererManagerData_H_
#include "vtkCommand.h"
-#include <vtkVolumeRayCastCompositeFunction.h>
+
+#if (VTK_MAJOR_VERSION <= 7)
+ #include "vtkVolumeRayCastCompositeFunction.h"
+ #include "vtkVolumeRayCastMIPFunction.h"
+#else
+ // ..
+#endif
+
+
#include <vtkPlanes.h>
#include <vtkVolumeMapper.h>
#include <vtkImageData.h>
#include <vtkProp3D.h>
#include <vtkRenderer.h>
-#include <vtkVolumeRayCastMIPFunction.h>
#include <vtkLookupTable.h>
#include <vtkBoxWidget.h>
#include <vtkAbstractMapper.h>
*/
int _id;
+#if (VTK_MAJOR_VERSION <= 7)
vtkVolumeRayCastCompositeFunction *_compositeFunction;
- vtkPlanes *_volumePlanes;
-
+ vtkVolumeRayCastMIPFunction *_MIPFunction;
+#else
+ //..
+#endif
+
+ vtkPlanes *_volumePlanes;
vtkVolumeProperty *_volumeProperty;
vtkVolume *_newvol;
vtkPiecewiseFunction *_tfun;
vtkColorTransferFunction *_ctfun;
- vtkVolumeRayCastMIPFunction *_MIPFunction;
/**
** boxwidget to control the volume
**/
if ( _vtkVolumeRayCastMapper != NULL )
{
_vtkVolumeRayCastMapper->RemoveAllClippingPlanes();
-// vtkPlanes *planes = vtkPlanes::New();
-// boxwidget->GetPlanes(planes);
-// _vtkVolumeRayCastMapper->SetClippingPlanes(planes);
_vtkVolumeRayCastMapper->SetClippingPlanes(_planes);
} // if volume
}
//-------------------------------------------------------------------
-void boxSurfaceObserver::SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper)
+#if (VTK_MAJOR_VERSION <= 7)
+ void boxSurfaceObserver::SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper)
+#else
+ void boxSurfaceObserver::SetvtkFixedPointVolumeRayCastMapper(vtkFixedPointVolumeRayCastMapper *vtkvolumeraycastmapper)
+#endif
{
_vtkVolumeRayCastMapper = vtkvolumeraycastmapper;
}
#include "vtkPlanes.h"
#include "vtkProp.h"
-#include "vtkVolumeRayCastMapper.h"
+
+#if (VTK_MAJOR_VERSION <= 7)
+ #include "vtkVolumeRayCastMapper.h"
+#else
+ #include <vtkFixedPointVolumeRayCastMapper.h>
+#endif
+
#include "vtkObject.h"
#include "vtkCommand.h"
class boxSurfaceObserver : public vtkCommand
{
public:
- vtkPlanes *_planes;
- vtkProp *_actor;
+ vtkPlanes *_planes;
+ vtkProp *_actor;
- vtkAlgorithm *_mCubes;
- vtkAlgorithm *_tissueStripper;
- vtkAlgorithm *_tissueClipper;
- vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper;
+ vtkAlgorithm *_mCubes;
+ vtkAlgorithm *_tissueStripper;
+ vtkAlgorithm *_tissueClipper;
+#if (VTK_MAJOR_VERSION <= 7)
+ vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper;
+#else
+ vtkFixedPointVolumeRayCastMapper *_vtkVolumeRayCastMapper;
+#endif
boxSurfaceObserver()
{
- _mCubes = NULL;
- _tissueStripper = NULL;
- _tissueClipper = NULL;
- _vtkVolumeRayCastMapper = NULL;
+ _mCubes = NULL;
+ _tissueStripper = NULL;
+ _tissueClipper = NULL;
+ _vtkVolumeRayCastMapper = NULL;
+
}
virtual char const *GetClassName() const { return "boxSurfaceObserver";}
static boxSurfaceObserver *New(){
- boxSurfaceObserver * result;
- result = new boxSurfaceObserver();
+ boxSurfaceObserver *result;
+ result = new boxSurfaceObserver();
return result;
}
virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
void SetPlanes(vtkPlanes *planes);
void SetActor(vtkProp *actor);
+#if (VTK_MAJOR_VERSION <= 7)
void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper);
+#else
+ void SetvtkFixedPointVolumeRayCastMapper(vtkFixedPointVolumeRayCastMapper *vtkvolumeraycastmapper);
+#endif
void SetFilters(vtkAlgorithm *_mCubes , vtkAlgorithm *_tissueStripper , vtkAlgorithm *_tissueClipper);
};
//#include <vector>
#include <vtkPiecewiseFunction.h>
#include <vtkColorTransferFunction.h>
- #include <vtkVolumeRayCastMapper.h>
+#if (VTK_MAJOR_VERSION <= 7)
+ #include <vtkVolumeRayCastMapper.h>
+#else
+ #include <vtkFixedPointVolumeRayCastMapper.h>
+#endif
#include <vtkVolume.h>
//#include "../wxMPRWidget.h"
bool getRefreshed();
void setCTF(vtkColorTransferFunction* cf);
void setTF(vtkPiecewiseFunction* tf);
+#if (VTK_MAJOR_VERSION <= 7)
void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
+#else
+ void setFixedPointVolumeMapper(vtkFixedPointVolumeRayCastMapper* volMapper);
+#endif
void setVolume(vtkVolume* vol);
//void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
//void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
bool refreshed;
vtkColorTransferFunction *_ctfun;
- vtkPiecewiseFunction *_tfun;
+ vtkPiecewiseFunction *_tfun;
vtkVolumeRayCastMapper *volumeMapper;
- vtkVolume *newvol;
+ vtkVolume *newvol;
//things to refresh
//wxVtkMPR3DView *wxvtkmpr3Dview;
_shade = false;
_volumerendererdata = VolumeRendererData::New();
+
+#if (VTK_MAJOR_VERSION <= 7)
_volumeMapper = vtkVolumeRayCastMapper::New();
+ _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+ _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
+#else
+ _volumeMapper = vtkFixedPointVolumeRayCastMapper::New();
+#endif
+
_newvol = vtkVolume::New();
_volumeProperty = vtkVolumeProperty::New();
- _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
- _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
}
//-------------------------------------------------------------------
// Volume
_tfun->Delete();
_ctfun->Delete();
+#if (VTK_MAJOR_VERSION <= 7)
_compositeFunction->Delete();
+#else
+ // ..
+#endif
_volumeMapper->Delete();
_volumeProperty->Delete();
_newvol->Delete();
#endif
+#if (VTK_MAJOR_VERSION <= 7)
_volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
-
- // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+ // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+#else
+ // ..
+#endif
//
_volumeMapper->SetClippingPlanes( _volumePlanes );
_observerV = boxSurfaceObserver::New();
_observerV->SetPlanes( _volumePlanes );
_observerV->SetActor( _newvol );
+
+#if (VTK_MAJOR_VERSION <= 7)
_observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
+#else
+ _observerV->SetvtkFixedPointVolumeRayCastMapper( _volumeMapper );
+#endif
}
//-----------------------------------------------------------------------------
void vtkClipping3DDataViewer::updateVolume()
{
+#if (VTK_MAJOR_VERSION <= 7)
if(_isRayCasting)
{
_volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
_volumerendererdata->changeCompositeMIPFunction(0);
- }
- else if(_isMIP)
- {
+ } else if(_isMIP) {
_volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
_volumerendererdata->changeCompositeMIPFunction(1);
}
+#else
+ // ... here Composition of MIP
+ printf("EED vtkClipping3DDataViewer::updateVolume ... here Composition or MIP \n");
+#endif
+
if(_interpolation)
{
return _newvol;
}
//-------------------------------------------------------------------
-vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){
+#if (VTK_MAJOR_VERSION <= 7)
+ vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper()
+#else
+ vtkFixedPointVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper()
+#endif
+{
return _volumeMapper;
}
//-------------------------------------------------------------------
#include "vtkStripper.h"
#include "vtkLODActor.h"
#include "vtkMarchingCubes.h"
-#include "vtkVolumeRayCastMapper.h"
+#if (VTK_MAJOR_VERSION <= 7)
+ #include "vtkVolumeRayCastCompositeFunction.h"
+ #include "vtkVolumeRayCastMIPFunction.h"
+ #include "vtkVolumeRayCastMapper.h"
+#else
+ #include <vtkFixedPointVolumeRayCastMapper.h>
+#endif
#include "boxSurfaceObserver.h"
-#include "vtkVolumeRayCastCompositeFunction.h"
#include <vtkPiecewiseFunction.h>
#include "vtkVolumeProperty.h"
#include "vtkPolyDataMapper.h"
#include "vtkOutlineFilter.h"
#include "vtkRenderWindowInteractor.h"
-#include "vtkVolumeRayCastMIPFunction.h"
#include "volumerendererdata.h"
double GetIsovalue(int idTissue);
vtkVolume *GetVolumeActor();
- vtkVolumeRayCastMapper *GetVolumeMapper();
+
+#if (VTK_MAJOR_VERSION <= 7)
+ vtkVolumeRayCastMapper *GetVolumeMapper();
+#else
+ vtkFixedPointVolumeRayCastMapper *GetVolumeMapper();
+#endif
+
vtkPlanes *GetVolumePlanes();
void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
private:
- vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
- vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
- vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
- vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
- vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
+ vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
+ vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
+ vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
+ vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
+ vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
/// Volume
- vtkPiecewiseFunction *_tfun;
- vtkColorTransferFunction *_ctfun;
+ vtkPiecewiseFunction *_tfun;
+ vtkColorTransferFunction *_ctfun;
// vtkVolumeRayCastCompositeFunction *_compositeFunction;
- vtkPlanes *_volumePlanes;
- vtkVolumeRayCastMapper *_volumeMapper;
- vtkVolumeProperty *_volumeProperty;
- vtkVolume *_newvol;
- vtkMPRBaseData *_vtkmprbasedata;
- bool _visibleVolume;
- bool _visibleVolumeBox;
- bool _representationType[VTKMPRDATA_MAXTISSUE];
- bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
- vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
- boxSurfaceObserver *_observerV;
- boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
-
- std::vector<double> greyValuesTransferenceFVector;
- std::vector<double> intensityValuesTransferenceFVector;
- std::vector<double> redColorsOfColorTransferenceFVector;
- std::vector<double> greenColorsOfColorTransferenceFVector;
- std::vector<double> blueColorsOfColorTransferenceFVector;
- std::vector<double> greyValueColorsOfColorTransferenceFVector;
-
+ vtkPlanes *_volumePlanes;
+
+#if (VTK_MAJOR_VERSION <= 7)
+ vtkVolumeRayCastMapper *_volumeMapper;
+#else
+ vtkFixedPointVolumeRayCastMapper *_volumeMapper;
+#endif
+
+
+ vtkVolumeProperty *_volumeProperty;
+ vtkVolume *_newvol;
+ vtkMPRBaseData *_vtkmprbasedata;
+ bool _visibleVolume;
+ bool _visibleVolumeBox;
+ bool _representationType[VTKMPRDATA_MAXTISSUE];
+ bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
+ vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
+ boxSurfaceObserver *_observerV;
+ boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
+
+ std::vector<double> greyValuesTransferenceFVector;
+ std::vector<double> intensityValuesTransferenceFVector;
+ std::vector<double> redColorsOfColorTransferenceFVector;
+ std::vector<double> greenColorsOfColorTransferenceFVector;
+ std::vector<double> blueColorsOfColorTransferenceFVector;
+ std::vector<double> greyValueColorsOfColorTransferenceFVector;
+
+#if (VTK_MAJOR_VERSION <= 7)
vtkVolumeRayCastCompositeFunction *_compositeFunction;
vtkVolumeRayCastMIPFunction *_compositeFunctionMIP ;
+#else
+ // ..
+#endif
+
bool _isRayCasting;
bool _isMIP;