]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasMultipleVolumeRendererManagerData.cxx
creaButtonContainer: exceptions added, doxygen documentation added :)
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasMultipleVolumeRendererManagerData.cxx
index de064e339aff011d3c87fdcbb66aa2a9b05cd896..052da71062ec1fe6e89ee48fdf733631e5d781a1 100644 (file)
@@ -15,13 +15,15 @@ wxMaracasMultipleVolumeRendererManagerData::wxMaracasMultipleVolumeRendererManag
 
        _volumePlanes  = vtkPlanes::New();
        _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+       _MIPFunction = vtkVolumeRayCastMIPFunction::New();
+
        _volumeMapper = vtkVolumeRayCastMapper::New();  
        _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
        _volumeMapper->SetClippingPlanes( _volumePlanes );
        _volumeMapper->AutoAdjustSampleDistancesOn();
        _volumeProperty = vtkVolumeProperty::New();     
        _volumeProperty->SetInterpolationTypeToLinear();
-       _volumeProperty->ShadeOn();
+       //_volumeProperty->ShadeOn();
        _volumeProperty->DisableGradientOpacityOn();    
        _volumeProperty->SetColor(_ctfun);
        _volumeProperty->SetScalarOpacity(_tfun );
@@ -58,7 +60,7 @@ void wxMaracasMultipleVolumeRendererManagerData::setVolumeColor(std::vector<doub
        _ctfun->RemoveAllPoints();
        for(int i = 0; i < greylevelcolors.size();i++){
                _ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
-       //                      std::cout<<"transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
+                               //std::cout<<"wxMaracasMultipleVolumeRendererManagerData::setVolumeColor "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
        }               
        _newvol->Update();      
 }
@@ -71,7 +73,7 @@ void wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity(std::vector<do
        _tfun->RemoveAllPoints();
        for(int i = 0; i < greylevel.size();i++){
                _tfun->AddPoint(greylevel[i], value[i]);
-//                     std::cout<<"transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
+                       //std::cout<<"wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity "<<greylevel[i]<<" "<< value[i]<<std::endl;
        }
     _newvol->Update();
 }
@@ -79,8 +81,23 @@ void wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity(std::vector<do
 /**
 **     Check if the variables are setted correctly
 **/
-void wxMaracasMultipleVolumeRendererManagerData::checkInvariant(){
+void wxMaracasMultipleVolumeRendererManagerData::checkInvariant()throw (char *){
+       if(!_compositeFunction){
+               throw "No composite function initialized";
+       }
+       if(!_MIPFunction){
+               throw "No MIP function initialized";
+       }
+       if(!_volumeMapper){
+               throw "No volume mapper initialized";
+       }
+}
 
+/**
+**     Check if the variables are setted correctly
+**/
+void wxMaracasMultipleVolumeRendererManagerData::Update(){
+        _newvol->Update();
 }
 /**
 **     get the prop3D 
@@ -114,3 +131,12 @@ void wxMaracasMultipleVolumeRendererManagerData::setDataname(std::string datanam
        _dataname = dataname;
 }
 
+void wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction(int function) throw (char *){
+       checkInvariant();
+       if(function == 0){
+               _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+       }else{
+               _volumeMapper->SetVolumeRayCastFunction(_MIPFunction);
+       }
+       
+}