#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;
_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 );
*/
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"<<endl;
+ vtkGPUVolumeRayCastMapper * volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
+ volumeMappergpu->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
if(BoxWidget){
DisableBoundingBox();
}
+
}
+void VolumeRendererManagerData::SetIndependentComponents(bool independent){
-void VolumeRendererManagerData::SetIndependentComponents(bool independent)
-{
if(!independent){
_volumeProperty->IndependentComponentsOff();
}else{
//EED9Juin2011 }
}
-void VolumeRendererManagerData::DisableBoundingBox()
-{
+void VolumeRendererManagerData::DisableBoundingBox(){
+
if(BoxWidget){
BoxWidget->EnabledOff();
//BoxWidget->Delete();
//BoxWidget = 0;
+
cout<<"JPRG::VolumeRendererManagerData::DisableBoundingBox"<<endl;
+
+
}
}
/**
** Volume Opacity
**/
-void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value)
-{
+void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value){
_tfun->RemoveAllPoints();
for(unsigned int i = 0; i < greylevel.size();i++){
_newvol->Update();
}
-
/**
** Volume Opacity
**/
-void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,double value)
-{
+void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,double value){
std::vector<double> valuevector;
for(unsigned i = 0; i < greylevel.size(); i++){
valuevector.push_back(value);
/**
** 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<vtkVolumeRayCastMapper*>(VolumeMapper)){
}
#endif
#else
-
vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper);
if(function == 0){
volumemapper->SetBlendModeToComposite();
}
-void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable)
-{
+void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable){
if(lookuptable){
_ctfun->RemoveAllPoints();
vtkColorTransferFunction* colort = (vtkColorTransferFunction*)lookuptable;
}
-void VolumeRendererManagerData::changeInterpolationType(int type)
-{
+void VolumeRendererManagerData::changeInterpolationType(int type){
//checkInvariant();
if(type == 0){
_volumeProperty->SetInterpolationTypeToLinear();
}
}
-void VolumeRendererManagerData::SetColorTransferFunction(int i, vtkColorTransferFunction* colorf)
-{
+void VolumeRendererManagerData::SetColorTransferFunction(int i, vtkColorTransferFunction* colorf){
+
_volumeProperty->SetColor(i, colorf);
+
}