wxMaracasMultipleVolumeRendererManagerData.cxx

Go to the documentation of this file.
00001 
00002 #include "wxMaracasMultipleVolumeRendererManagerData.h"
00003 
00004 /********************************************************************************************
00005 ** Start of data viewmanagerData
00006 *********************************************************************************************/
00007 
00008 wxMaracasMultipleVolumeRendererManagerData::wxMaracasMultipleVolumeRendererManagerData(vtkImageData* vol, std::string dataname){
00009 
00010         _vol = vol;     
00011         _dataname = dataname;
00012         
00013         _tfun = vtkPiecewiseFunction::New();
00014         _ctfun = vtkColorTransferFunction::New();   
00015 
00016         _volumePlanes  = vtkPlanes::New();
00017         _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
00018         _volumeMapper = vtkVolumeRayCastMapper::New();  
00019         _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
00020         _volumeMapper->SetClippingPlanes( _volumePlanes );
00021         _volumeMapper->AutoAdjustSampleDistancesOn();
00022         _volumeProperty = vtkVolumeProperty::New();     
00023         _volumeProperty->SetInterpolationTypeToLinear();
00024         _volumeProperty->ShadeOn();
00025         _volumeProperty->DisableGradientOpacityOn();    
00026         _volumeProperty->SetColor(_ctfun);
00027         _volumeProperty->SetScalarOpacity(_tfun );
00028 
00029         _newvol = vtkVolume::New();
00030         _newvol->SetMapper(_volumeMapper );
00031         _newvol->SetProperty(_volumeProperty );
00032         _volumeMapper->SetInput( _vol );
00033         _volumeMapper->Update();
00034         _newvol->Update();
00035 }
00036 
00037 
00038 wxMaracasMultipleVolumeRendererManagerData::~wxMaracasMultipleVolumeRendererManagerData(){
00039         
00040         _tfun->Delete();
00041         _ctfun->Delete();
00042         _volumePlanes->Delete();
00043         _compositeFunction->Delete();
00044         _volumeMapper->Delete();
00045         _volumeProperty->Delete();
00046         _newvol->Delete();
00047         
00048 }
00052 void wxMaracasMultipleVolumeRendererManagerData::setVolumeColor(std::vector<double>& greylevelcolors,
00053                                                                 std::vector<double>& red,
00054                                                                 std::vector<double>& green,
00055                                                                 std::vector<double>& blue)
00056 {       
00057         
00058         _ctfun->RemoveAllPoints();
00059         for(int i = 0; i < greylevelcolors.size();i++){
00060                 _ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
00061         //                      std::cout<<"transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
00062         }               
00063         _newvol->Update();      
00064 }
00065                                 
00069 void wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value){
00070                 
00071         _tfun->RemoveAllPoints();
00072         for(int i = 0; i < greylevel.size();i++){
00073                 _tfun->AddPoint(greylevel[i], value[i]);
00074 //                      std::cout<<"transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
00075         }
00076     _newvol->Update();
00077 }
00078 
00082 void wxMaracasMultipleVolumeRendererManagerData::checkInvariant(){
00083 
00084 }
00088 vtkProp3D* wxMaracasMultipleVolumeRendererManagerData::getProp3D(){
00089         return this->_newvol;
00090 }
00094 int wxMaracasMultipleVolumeRendererManagerData::getId(){
00095         return _id;
00096 }
00100 void wxMaracasMultipleVolumeRendererManagerData::setId(int propid){
00101         _id = propid;
00102 }
00103 
00107 std::string wxMaracasMultipleVolumeRendererManagerData::getDataname(){
00108         return _dataname;
00109 }
00113 void wxMaracasMultipleVolumeRendererManagerData::setDataname(std::string dataname){
00114         _dataname = dataname;
00115 }
00116 

Generated on Wed Jul 29 16:35:30 2009 for creaMaracasVisu_lib by  doxygen 1.5.3