From 32c9481600e7afdf9620949a94d5a348e5ae4918 Mon Sep 17 00:00:00 2001 From: Juan Prieto Date: Fri, 6 Jan 2012 14:53:12 +0000 Subject: [PATCH] linking error on fedora, changes in qt cmake --- appli/QtVTKViewer/CMakeLists.txt | 12 ++ .../volumerenderermanagerdata.cxx | 111 ++++++++---------- lib/maracasVisuLib/CMakeLists.txt | 8 +- 3 files changed, 68 insertions(+), 63 deletions(-) diff --git a/appli/QtVTKViewer/CMakeLists.txt b/appli/QtVTKViewer/CMakeLists.txt index 71c4b0d..5e8d184 100644 --- a/appli/QtVTKViewer/CMakeLists.txt +++ b/appli/QtVTKViewer/CMakeLists.txt @@ -32,7 +32,19 @@ INCLUDE_DIRECTORIES ( #---------------------------------------------------------------------------- # DEPENDENCIES (LIBRARIES TO LINK WITH) SET ( ${EXE_NAME}_LINK_LIBRARIES + + QVTK + GUIQtViewers + GUIQtVolumeRenderer + GUIQtSurfaceRenderer + + BaseVolumeRenderer + BaseSurfaceRenderer + + KernelViewerWidgets + KernelVolumeRenderer + KernelSurfaceRenderer # ${WXWIDGETS_LIBRARIES} # ${KWWidgets_LIBRARIES} # ${VTK_LIBRARIES} diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx index d25f4a8..21047fa 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx @@ -17,27 +17,27 @@ #endif #endif - 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()); + } -void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string dataname, bool usegpu) -{ +void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string dataname, bool usegpu){ _id = 0; _vol = vol; _dataname = dataname; @@ -53,6 +53,14 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana _volumeProperty->SetScalarOpacity(_tfun ); _ctfun = vtkColorTransferFunction::New(); + if(vol->GetNumberOfScalarComponents() == 1 ){ + + _ctfun->AddRGBPoint(vol->GetScalarRange()[0], 0, 0 , 0); + _ctfun->AddRGBPoint(vol->GetScalarRange()[1], 1, 1 , 1); + _ctfun->Build(); + _volumeProperty->SetColor(_ctfun); + } + _newvol = vtkVolume::New(); _newvol->SetProperty(_volumeProperty ); @@ -89,23 +97,22 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana */ VolumeMapper = 0; - - -#if ( VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 8 ) - -//EED 10/Nov/2011 vtkGPUVolumeRayCastMapper * volumeMappergpu = vtkGPUVolumeRayCastMapper::New(); - vtkSmartVolumeMapper * volumeMappergpu = vtkSmartVolumeMapper::New(); - - volumeMappergpu->AutoAdjustSampleDistancesOn(); +#if VTK_MAJOR_VERSION >= 5 + #if VTK_MINOR_VERSION >= 6 + cout<<"using volume render GPU"<AutoAdjustSampleDistancesOn(); VolumeMapper = volumeMappergpu; + #endif #else - _volumeProperty->SetColor(_ctfun); - _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); - _MIPFunction = vtkVolumeRayCastMIPFunction::New(); - vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New(); - volumeMapper->SetVolumeRayCastFunction(_compositeFunction); - volumeMapper->AutoAdjustSampleDistancesOn(); - VolumeMapper = volumeMapper; + + + _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); + _MIPFunction = vtkVolumeRayCastMIPFunction::New(); + vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New(); + volumeMapper->SetVolumeRayCastFunction(_compositeFunction); + volumeMapper->AutoAdjustSampleDistancesOn(); + VolumeMapper = volumeMapper; #endif @@ -136,10 +143,10 @@ VolumeRendererManagerData::~VolumeRendererManagerData() if(BoxWidget){ DisableBoundingBox(); } + } +void VolumeRendererManagerData::SetIndependentComponents(bool independent){ -void VolumeRendererManagerData::SetIndependentComponents(bool independent) -{ if(!independent){ _volumeProperty->IndependentComponentsOff(); }else{ @@ -185,13 +192,16 @@ void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* int //EED9Juin2011 } } -void VolumeRendererManagerData::DisableBoundingBox() -{ +void VolumeRendererManagerData::DisableBoundingBox(){ + if(BoxWidget){ BoxWidget->EnabledOff(); //BoxWidget->Delete(); //BoxWidget = 0; + cout<<"JPRG::VolumeRendererManagerData::DisableBoundingBox"<& greylevelcol /** ** Volume Opacity **/ -void VolumeRendererManagerData::setVolumeOpacity(std::vector greylevel,std::vector value) -{ +void VolumeRendererManagerData::setVolumeOpacity(std::vector greylevel,std::vector value){ _tfun->RemoveAllPoints(); for(unsigned int i = 0; i < greylevel.size();i++){ @@ -226,12 +235,10 @@ void VolumeRendererManagerData::setVolumeOpacity(std::vector greylevel,s _newvol->Update(); } - /** ** Volume Opacity **/ -void VolumeRendererManagerData::setVolumeOpacity(std::vector greylevel,double value) -{ +void VolumeRendererManagerData::setVolumeOpacity(std::vector greylevel,double value){ std::vector valuevector; for(unsigned i = 0; i < greylevel.size(); i++){ valuevector.push_back(value); @@ -257,56 +264,44 @@ void VolumeRendererManagerData::checkInvariant()throw (char *){ /** ** Check if the variables are setted correctly **/ -void VolumeRendererManagerData::Update() -{ +void VolumeRendererManagerData::Update(){ _newvol->Update(); } - /** ** get the prop3D **/ -vtkProp3D* VolumeRendererManagerData::getProp3D() -{ +vtkProp3D* VolumeRendererManagerData::getProp3D(){ return this->_newvol; } - /** ** return the id from the daat **/ -int VolumeRendererManagerData::getId() -{ +int VolumeRendererManagerData::getId(){ return _id; } - /** ** set data id **/ -void VolumeRendererManagerData::setId(int propid) -{ +void VolumeRendererManagerData::setId(int propid){ _id = propid; } /** ** Get the filanme **/ -std::string VolumeRendererManagerData::getDataname() -{ +std::string VolumeRendererManagerData::getDataname(){ return _dataname; } /** ** Set the filanme **/ -void VolumeRendererManagerData::setDataname(std::string dataname) -{ +void VolumeRendererManagerData::setDataname(std::string dataname){ _dataname = dataname; } - -void VolumeRendererManagerData::changeCompositeMIPFunction(int function) -{ +void VolumeRendererManagerData::changeCompositeMIPFunction(int function){ //checkInvariant(); if(VolumeMapper){ - #if VTK_MAJOR_VERSION >= 5 #if VTK_MINOR_VERSION >= 6 if(dynamic_cast(VolumeMapper)){ @@ -328,7 +323,6 @@ void VolumeRendererManagerData::changeCompositeMIPFunction(int function) } #endif #else - vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast(VolumeMapper); if(function == 0){ volumemapper->SetBlendModeToComposite(); @@ -342,8 +336,7 @@ void VolumeRendererManagerData::changeCompositeMIPFunction(int function) } -void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable) -{ +void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable){ if(lookuptable){ _ctfun->RemoveAllPoints(); vtkColorTransferFunction* colort = (vtkColorTransferFunction*)lookuptable; @@ -358,8 +351,7 @@ void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable) } -void VolumeRendererManagerData::changeInterpolationType(int type) -{ +void VolumeRendererManagerData::changeInterpolationType(int type){ //checkInvariant(); if(type == 0){ _volumeProperty->SetInterpolationTypeToLinear(); @@ -368,7 +360,8 @@ void VolumeRendererManagerData::changeInterpolationType(int type) } } -void VolumeRendererManagerData::SetColorTransferFunction(int i, vtkColorTransferFunction* colorf) -{ +void VolumeRendererManagerData::SetColorTransferFunction(int i, vtkColorTransferFunction* colorf){ + _volumeProperty->SetColor(i, colorf); + } diff --git a/lib/maracasVisuLib/CMakeLists.txt b/lib/maracasVisuLib/CMakeLists.txt index 14db134..330cf1e 100644 --- a/lib/maracasVisuLib/CMakeLists.txt +++ b/lib/maracasVisuLib/CMakeLists.txt @@ -137,11 +137,11 @@ FILE(GLOB ${LIBRARY_NAME}_HEADERS_CUTMODULE src/CutModule/interface/*.h src/CutM #jhcl-End=========================================================================== #creaMaracasVisu_CutModule_interface #EED CM - KernelVolumeRenderer + #KernelVolumeRenderer KernelViewerWidgets - KernelSurfaceRenderer - BaseVolumeRenderer - BaseSurfaceRenderer + #KernelSurfaceRenderer + #BaseVolumeRenderer + #BaseSurfaceRenderer ) #---------------------------------------------------------------------------- -- 2.47.1