vtkClipping3DDataViewer.cxx

Go to the documentation of this file.
00001 
00002 #include "vtkClipping3DDataViewer.h"
00003 #include "vtkDataSetReader.h"
00004 #include "vtkProperty.h"
00005 
00006 vtkClipping3DDataViewer::vtkClipping3DDataViewer()
00007 {
00008         int i;
00009         for (i=0; i<VTKMPRDATA_MAXTISSUE; i++){
00010                 _visibleTissue[i]               = false;
00011                 _representationType[i]  = true;
00012         }
00013         _visibleVolume=false;
00014 }
00015 //-------------------------------------------------------------------
00016 vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
00017 {
00018         int i;
00019         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00020                 _mCubes[i]->Delete();
00021                 _tissueStripper[i]->Delete();
00022                 _tissueMapper[i]->Delete();
00023                 _tissuePlanes[i]->Delete();
00024                 _tissueClipper[i]->Delete();
00025         }
00026         _outlineData->Delete();
00027         _mapOutline->Delete();
00028         _outline->Delete();
00029         // Volume
00030         _tfun->Delete();
00031         _ctfun->Delete();
00032         _compositeFunction->Delete();
00033         _volumeMapper->Delete();
00034         _volumeProperty->Delete();
00035         _newvol->Delete();
00036         _volumePlanes->Delete();
00037 
00038         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00039                 _tissue[i]-> Delete();
00040                 _observerS[i]-> Delete();
00041         }
00042         _observerV-> Delete();
00043 }
00044 //-------------------------------------------------------------------
00045 vtkActor* vtkClipping3DDataViewer::GetOutlineActor()
00046 {
00047         return _outline;
00048 }
00049 //-------------------------------------------------------------------
00050 vtkClipPolyData* vtkClipping3DDataViewer::GetTissueClipper(int id)
00051 {
00052         return this->_tissueClipper[id];
00053 }
00054 //-------------------------------------------------------------------
00055 vtkPolyDataMapper* vtkClipping3DDataViewer::GetTissueMapper(int id)
00056 {
00057         return _tissueMapper[id];
00058 }
00059 //-------------------------------------------------------------------
00060 vtkPlanes* vtkClipping3DDataViewer::GetTissuePlanes(int id)
00061 {
00062         return _tissuePlanes[id];
00063 }
00064 //-------------------------------------------------------------------
00065 vtkStripper* vtkClipping3DDataViewer::GetTissueStripper(int id)
00066 {
00067         return _tissueStripper[id];
00068 }
00069 //-------------------------------------------------------------------
00070 void vtkClipping3DDataViewer::Refresh()
00071 {
00072 //      _volumeMapper->SetClippingPlanes(_volumePlanes);
00073 
00074 //      this->_volumeMapper->Update();
00075 //      this->_newvol->Update();
00076 
00077 //      _newvol->VisibilityOn();
00078 
00079         
00080 // _volumeMapper = vtkVolumeRayCastMapper::New();
00081 //      _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
00082 //      _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
00083 //      _volumeMapper->SetClippingPlanes( _volumePlanes );
00084 //      _newvol->SetMapper(_volumeMapper );
00085 
00086 
00087 }
00088 //-------------------------------------------------------------------
00089 void vtkClipping3DDataViewer::RefreshSurface()
00090 {
00091         int i;
00092         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
00093         {
00094                 SetIsovalue(i, (int) (GetIsovalue(i)+1) );
00095 //              this->GetMCubes(i)->Update();
00096         }
00097 }
00098 //-------------------------------------------------------------------
00099 void vtkClipping3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
00100 {
00101         _vtkmprbasedata=vtkmprbasedata;
00102 }
00103 //-------------------------------------------------------------------
00104 vtkMPRBaseData* vtkClipping3DDataViewer::GetVtkMPRBaseData()
00105 {
00106         return _vtkmprbasedata;
00107 }
00108 
00109 
00110 //-------------------------------------------------------------------
00111 void vtkClipping3DDataViewer::SetVisibleTissue(int idTissue, bool visible)
00112 {
00113         _visibleTissue[idTissue]=visible;
00114 }
00115 //-------------------------------------------------------------------
00116 bool vtkClipping3DDataViewer::GetVisibleTissue(int idTissue){
00117         return _visibleTissue[idTissue];
00118 }
00119 //-------------------------------------------------------------------
00120 void vtkClipping3DDataViewer::SetRepresentationType(int idTissue, bool representationType)
00121 {
00122         _representationType[idTissue]=representationType;
00123 }
00124 //-------------------------------------------------------------------
00125 bool vtkClipping3DDataViewer::GetRepresentationType(int idTissue)
00126 {
00127         return _representationType[idTissue];
00128 }
00129 
00130 //-------------------------------------------------------------------
00131 vtkActor* vtkClipping3DDataViewer::GetTissueActor(int id){
00132         return _tissue[id];
00133 }
00134 
00135 //-------------------------------------------------------------------
00136 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverS(int idObserverS)
00137 {
00138         return _observerS[idObserverS];
00139 }
00140 //-------------------------------------------------------------------
00141 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverV()
00142 {
00143         return _observerV;
00144 }
00145 
00146 //-------------------------------------------------------------------
00147 bool vtkClipping3DDataViewer::GetVisibleVolume()
00148 {
00149         return _visibleVolume;
00150 }
00151 //-------------------------------------------------------------------
00152 void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume)
00153 {
00154         _visibleVolume = visiblevolume;
00155 }
00156 
00157 
00158 //-------------------------------------------------------------------
00159 void vtkClipping3DDataViewer::Configure_Tissue()
00160 {
00161 
00162         double range[2];
00163         int i;
00164         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00165                 // Visualisation - original volume
00166                 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
00167                 imagedata->GetScalarRange( range );
00168                 _mCubes[i] = vtkMarchingCubes::New( );
00169                 _mCubes[i]->SetInput( imagedata );
00170 
00171                 _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 );
00172 //              _mCubes[i]->SetValue( 0, 1500 );
00173 
00174             _tissueStripper[i] = vtkStripper::New();
00175             _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) );
00176 
00177 
00178 
00179                 _tissuePlanes[i]  = vtkPlanes::New();
00180    
00181                 int x1,x2,y1,y2,z1,z2;
00182                 imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
00183                 _tissuePlanes[i]->SetBounds  (x1,x2,y1,y2,z1,z2);
00184                 
00185                 _tissueClipper[i] = vtkClipPolyData::New();
00186                 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
00187                 _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
00188                 _tissueClipper[i]->InsideOutOn( );
00189 
00190                 _tissueMapper[i] = vtkPolyDataMapper::New( );
00191                 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
00192                 _tissueMapper[i]->ScalarVisibilityOff( );
00193 //              _tissueMapper[i]->Update();
00194 
00195         }
00196                 
00197 
00198 
00199         // vtkActor tissue
00200         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00201                 // tissue
00202                 _tissue[i] = vtkActor::New();
00203                 _tissue[i]->SetMapper( GetTissueMapper(i) );
00204                 float cr=1,cg=0.5,cb=0.5;
00205                 _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255   , cb/255   );
00206                 _tissue[i]->GetProperty()->SetSpecular(.3);
00207                 _tissue[i]->GetProperty()->SetSpecularPower(20);
00208                 _tissue[i]->GetProperty()->SetOpacity(0.5);
00209                 if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85   , 0.85   );
00210                 if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0  ,  1  );
00211                 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20   , 0.20   );
00212                 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1   , 0   );
00213         }
00214 
00215         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
00216         {
00217                 _observerS[i] = boxSurfaceObserver::New();
00218                 _observerS[i]->SetPlanes( GetTissuePlanes(i) );
00219                 _observerS[i]->SetActor( _tissue[i] );
00220         }
00221 
00222 }
00223 
00224 //-----------------------------------------------------------------------------
00225 
00226 void vtkClipping3DDataViewer::Configure_Volume()
00227 {
00228   // Volume
00229 
00230   _tfun = vtkPiecewiseFunction::New();
00231   _ctfun = vtkColorTransferFunction::New();
00232 
00233         double range[2];
00234         this->_vtkmprbasedata->GetImageData()->GetScalarRange(range);
00235         double max = range[1];
00236 
00237         /*
00238         adding the poinst of the transference function
00239         */
00240         //X
00241         greyValuesTransferenceFVector.push_back(max * 0/2);  // JPR ?? 0/2
00242         greyValuesTransferenceFVector.push_back(max * 1/2);  // JPR ?? division entiere?
00243         greyValuesTransferenceFVector.push_back(max * 2/2);
00244         //Y
00245         intensityValuesTransferenceFVector.push_back(0.0);
00246         intensityValuesTransferenceFVector.push_back(1.0);
00247         intensityValuesTransferenceFVector.push_back(1.0);
00248 
00249         _tfun->AddPoint(max * 0/2 , 0.0);
00250         _tfun->AddPoint(max * 1/2 , 1.0);
00251         _tfun->AddPoint(max * 2/2 , 1.0);
00252 
00253         /*
00254                 Adding the colors to the vectors        
00255         */
00256         //RED
00257         redColorsOfColorTransferenceFVector.push_back(0.0);
00258         redColorsOfColorTransferenceFVector.push_back(1.0);
00259         redColorsOfColorTransferenceFVector.push_back(0.0);
00260         redColorsOfColorTransferenceFVector.push_back(0.0);
00261         redColorsOfColorTransferenceFVector.push_back(0.0);
00262 
00263         //GREEN
00264         greenColorsOfColorTransferenceFVector.push_back(0.0);
00265         greenColorsOfColorTransferenceFVector.push_back(0.0);
00266         greenColorsOfColorTransferenceFVector.push_back(0.0);
00267         greenColorsOfColorTransferenceFVector.push_back(1.0);
00268         greenColorsOfColorTransferenceFVector.push_back(0.2);
00269         
00270         //BLUE
00271         blueColorsOfColorTransferenceFVector.push_back(0.0);
00272         blueColorsOfColorTransferenceFVector.push_back(0.0);
00273         blueColorsOfColorTransferenceFVector.push_back(1.0);
00274         blueColorsOfColorTransferenceFVector.push_back(0.0);
00275         blueColorsOfColorTransferenceFVector.push_back(0.0);
00276         //GREY VALUE    
00277         greyValueColorsOfColorTransferenceFVector.push_back(max*0/4);
00278         greyValueColorsOfColorTransferenceFVector.push_back(max*1/4);
00279         greyValueColorsOfColorTransferenceFVector.push_back(max*2/4);
00280         greyValueColorsOfColorTransferenceFVector.push_back(max*3/4);
00281         greyValueColorsOfColorTransferenceFVector.push_back(max*4/4);
00282 
00283         _ctfun->AddRGBPoint( max*0/4 , 0.0, 0.0, 0.0);
00284         _ctfun->AddRGBPoint( max*1/4 , 1.0, 0.0, 0.0);
00285         _ctfun->AddRGBPoint( max*2/4 , 0.0, 0.0, 1.0);
00286         _ctfun->AddRGBPoint( max*3/4 , 0.0, 1.0, 0.0);
00287         _ctfun->AddRGBPoint( max*4/4 , 0.0, 0.2, 0.0);
00288 
00289   _volumePlanes  = vtkPlanes::New();
00290 //      int x1,x2,y1,y2,z1,z2;
00291 //      vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
00292 //      imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
00293 //      _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2);
00294 
00295   _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
00296 
00297   _volumeMapper = vtkVolumeRayCastMapper::New();
00298         _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
00299         _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
00300         _volumeMapper->SetClippingPlanes( _volumePlanes );
00301         _volumeMapper->AutoAdjustSampleDistancesOn();
00302 
00303   _volumeProperty = vtkVolumeProperty::New();
00304         _volumeProperty->SetColor(_ctfun);
00305         _volumeProperty->SetScalarOpacity( _tfun );
00306 // EED 31/03/2008
00307         _volumeProperty->SetInterpolationTypeToLinear();
00308         _volumeProperty->ShadeOn();
00309         _volumeProperty->DisableGradientOpacityOn();
00310 
00311 //      _volumeProperty->SetInterpolationTypeToNearest();
00312 //      _volumeProperty->ShadeOff();
00313 //      _volumeProperty->SetAmbient(0.3);
00314 //      _volumeProperty->SetDiffuse(0.1);
00315 //      _volumeProperty->SetSpecular(0.8);
00316 //      _volumeProperty->DisableGradientOpacityOn();
00317 
00318   _newvol = vtkVolume::New();
00319         _newvol->SetMapper(_volumeMapper );
00320         _newvol->SetProperty(_volumeProperty );
00321 
00322   _observerV = boxSurfaceObserver::New();
00323         _observerV->SetPlanes( _volumePlanes );
00324         _observerV->SetActor( _newvol );
00325         _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
00326 }
00327 
00328 
00329 //-------------------------------------------------------------------
00330 void vtkClipping3DDataViewer::Configure()
00331 {
00332         Configure_Tissue();
00333         Configure_Volume();
00334 
00335   // An outline provides context around the data.
00336   //
00337         _outlineData = vtkOutlineFilter::New();
00338     _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
00339         _mapOutline = vtkPolyDataMapper::New();
00340     _mapOutline->SetInput(_outlineData->GetOutput());
00341         _outline = vtkActor::New();
00342     _outline->SetMapper(_mapOutline);
00343     _outline->GetProperty()->SetColor(0,0,0);
00344 }
00345 
00346 
00347 //-------------------------------------------------------------------
00348 void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue)
00349 {
00350         _mCubes[idTissue]->SetValue(0, isoValue);
00351 }
00352 //-------------------------------------------------------------------
00353 double vtkClipping3DDataViewer::GetIsovalue(int idTissue)
00354 {
00355         return _mCubes[idTissue]->GetValue(0);
00356 }
00357 //-------------------------------------------------------------------
00358 vtkVolume* vtkClipping3DDataViewer::GetVolumeActor()
00359 {
00360    return _newvol;
00361 }
00362 //-------------------------------------------------------------------
00363 vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){
00364         return _volumeMapper;
00365 }
00366 //-------------------------------------------------------------------
00367 vtkPlanes* vtkClipping3DDataViewer::GetVolumePlanes()
00368 {
00369         return _volumePlanes;
00370 }
00371 
00372 //-------------------------------------------------------------------
00373 vtkMarchingCubes *vtkClipping3DDataViewer::GetMCubes(int idTissue)
00374 {
00375         return _mCubes[idTissue];
00376 }
00377 //--------------------------------------------------------------------
00378 //-------------------
00379 //Getters Vectors
00380 //-------------------
00381 
00382 std::vector<double>*    vtkClipping3DDataViewer::GetGreyValuesTransferenceFVector()
00383 {
00384         return &greyValuesTransferenceFVector;
00385 }
00386 //--------------------------------------------------------------------
00387 std::vector<double>*    vtkClipping3DDataViewer::GetIntensityValuesTransferenceFVector()
00388 {
00389         return &intensityValuesTransferenceFVector;
00390 }
00391 //--------------------------------------------------------------------
00392 std::vector<double>*    vtkClipping3DDataViewer::GetRedColorsOfColorTransferenceFVector()
00393 {
00394         return &redColorsOfColorTransferenceFVector;
00395 }
00396 //--------------------------------------------------------------------
00397 std::vector<double>*    vtkClipping3DDataViewer::GetGreenColorsOfColorTransferenceFVector()
00398 {
00399         return &greenColorsOfColorTransferenceFVector;
00400 }
00401 //--------------------------------------------------------------------
00402 std::vector<double>*    vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector()
00403 {       
00404         return &blueColorsOfColorTransferenceFVector;
00405 }
00406 //--------------------------------------------------------------------
00407 std::vector<double>*    vtkClipping3DDataViewer::GetGreyValueColorsOfColorTransferenceFVector()
00408 {
00409         return &greyValueColorsOfColorTransferenceFVector;
00410 }
00411 //--------------------------------------------------------------------
00412 //--------------------------------------
00413 //Getters transference function
00414 //and color of the transference function
00415 //---------------------------------------
00416 vtkPiecewiseFunction* vtkClipping3DDataViewer::GetTransferencefunction()
00417 {
00418         return this->_tfun;
00419 }
00420 //--------------------------------------------------------------------
00421 vtkColorTransferFunction* vtkClipping3DDataViewer::GetColorTransferenceFunction()
00422 {
00423         return this->_ctfun;
00424 }
00425 
00426 //-------------------------------------------------------------------
00427 
00428 void vtkClipping3DDataViewer::ReadVolumeFunctions()
00429 {
00430 /*
00431         int i=0,xi,yi,r,g,b,gValue;
00432         vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData();
00433         
00434         HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata);
00435         // 
00436         // put in a method
00437         //
00438         int tfSize=this->greyValuesTransferenceFVector.size();
00439                 if(tfSize>0)
00440                 {
00441                         int i=0,y;
00442                         hDlg->erasePointsTransferenceFunction();
00443                         while(i<tfSize)
00444                         {
00445                                 double g=greyValuesTransferenceFVector[i];
00446                                 double in=intensityValuesTransferenceFVector[i];
00447                                 hDlg->addPointToTransferenceFunction(g,in*100);
00448                                 i++;
00449                         }
00450                         
00451                 }
00452 
00453         int ctfSize=this->redColorsOfColorTransferenceFVector.size();
00454         if(ctfSize>0)
00455         {
00456                 int i=0,y;
00457                         while(i<ctfSize)
00458                         {
00459                                 double gr=greyValueColorsOfColorTransferenceFVector[i];
00460                                 double r=redColorsOfColorTransferenceFVector[i];
00461                                 double g=greenColorsOfColorTransferenceFVector[i];
00462                                 double b=blueColorsOfColorTransferenceFVector[i];
00463                                 hDlg->addColorPoint(gr,r*255,g*255,b*255);
00464                                 i++;
00465                         }
00466         }
00467         //If it is smooth activate next line
00468         //hDlg->updatePlotter();
00469         //setting variables if the user wants to do refresh
00470         hDlg->setCTF(_ctfun);
00471         hDlg->setTF(_tfun);
00472         
00473         //
00474         // when the user had changed the transference Function
00475         //
00476         if(hDlg->ShowModal()== wxID_OK )
00477         {       
00478                         // -- vtkPiecewiseFunction --
00479                         this->_tfun->RemoveAllPoints();
00480                         greyValuesTransferenceFVector.clear();
00481                         intensityValuesTransferenceFVector.clear();
00482                 
00483                         int nTFPoints=hDlg->getSizeTransferenceFunction();
00484                         i=0;
00485                         while(i<nTFPoints)
00486                         {
00487                                 hDlg->getTransferenceFunctionPoint(i,xi,yi);
00488                                 this->_tfun->AddPoint( xi , yi/100.0 );
00489                                 greyValuesTransferenceFVector.push_back(xi);
00490                                 intensityValuesTransferenceFVector.push_back(yi/100.0);
00491                                 i++;
00492                         }       
00493                         // -- vtkColorTransferFunction  --
00494                         this->_ctfun->RemoveAllPoints ();
00495                         //clean colors
00496                         redColorsOfColorTransferenceFVector.clear();
00497                         greenColorsOfColorTransferenceFVector.clear();
00498                         blueColorsOfColorTransferenceFVector.clear();
00499                         greyValueColorsOfColorTransferenceFVector.clear();
00500 
00501                         int nCTFpoints=hDlg->getSizeBarColor();
00502                         i=0;    
00503                         while(i<nCTFpoints)
00504                         {
00505                                 hDlg->getDataBarColorPoint(i,xi,r,g,b);
00506                                 this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
00507                                 redColorsOfColorTransferenceFVector.push_back(r/255.0);
00508                                 greenColorsOfColorTransferenceFVector.push_back(g/255.0);
00509                                 blueColorsOfColorTransferenceFVector.push_back(b/255.0);
00510                                 greyValueColorsOfColorTransferenceFVector.push_back(xi);
00511                                 i++;
00512                         }
00513                         
00514                         this->_volumeMapper->Update();
00515                         this->_newvol->Update();
00516         }
00517         
00518         else
00519         {
00520                 
00521                 if(hDlg->getRefreshed())
00522                 {
00523                         int i=0,size;
00524                         //--Transference Function----
00525                         this->_tfun->RemoveAllPoints();
00526                         i=0;
00527                         size=greyValuesTransferenceFVector.size();
00528                         for(i=0;i<size;i++)
00529                         {
00530                                 double grey1=greyValuesTransferenceFVector[i];
00531                                 double  in2=intensityValuesTransferenceFVector[i];
00532                                 this->_tfun->AddPoint( grey1 , in2 );
00533                         }
00534                         
00535                         // -- vtkColorTransferFunction  --
00536                         _ctfun->RemoveAllPoints ();
00537                         
00538                         i=0;
00539                         size=greyValueColorsOfColorTransferenceFVector.size();          
00540                         for(i=0;i<size;i++)
00541                         {
00542                                 double grey2=(greyValueColorsOfColorTransferenceFVector)[i];
00543                                 double red =(redColorsOfColorTransferenceFVector)[i];
00544                                 double green =(greenColorsOfColorTransferenceFVector)[i];
00545                                 double blue = (blueColorsOfColorTransferenceFVector)[i];
00546                                 _ctfun->AddRGBPoint(grey2,red,green,blue);
00547                         }
00548                         this->_volumeMapper->Update();
00549                         this->_newvol->Update();
00550                  }
00551                  
00552         }
00553         hDlg->Destroy();
00554 */
00555 }
00556 /*
00557 void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile)
00558 {
00559         char tmp[256];
00560         short int       max;
00561         double          range[2];
00562         double          x,val,r,g,b;
00563 
00564         FILE *ff = fopen ( namefile ,"r");
00565 
00566         // --  MAX  --
00567         fscanf(ff,"%s",tmp);
00568         if (strcmp(tmp,"MAX")==0)
00569         {
00570                 vtkImageData *vtkimagedata              = this->_vtkmprbasedata->GetImageData();
00571                 vtkimagedata->GetScalarRange(range);
00572                 max = (int) (range[1]);
00573         } else {
00574                 max = atoi(tmp);
00575         }
00576 
00577         fscanf(ff,"%s",tmp);   // --
00578 
00579         // -- vtkPiecewiseFunction --
00580         this->_tfun->RemoveAllPoints();
00581         fscanf(ff,"%s",tmp);   
00582         while ( strcmp(tmp,"--")!=0 )
00583         {
00584                 x=atof(tmp);
00585                 fscanf(ff,"%s",tmp);   
00586                 val=atof(tmp);
00587                 this->_tfun->AddPoint( x*max , val );
00588                 fscanf(ff,"%s",tmp);   
00589         }
00590 
00591         this->_ctfun->RemoveAllPoints ();
00592         // -- vtkColorTransferFunction  --
00593         while ( !feof(ff))
00594         {
00595                 fscanf(ff,"%s",tmp);   
00596                 x=atof(tmp);
00597                 fscanf(ff,"%s",tmp);   
00598                 r=atof(tmp);
00599                 fscanf(ff,"%s",tmp);   
00600                 g=atof(tmp);
00601                 fscanf(ff,"%s",tmp);   
00602                 b=atof(tmp);
00603                 this->_ctfun->AddRGBPoint( x*max , r,g,b );                     
00604         }
00605 
00606 
00607         this->_volumeMapper->Update();
00608         this->_newvol->Update();
00609 
00610 
00611         fclose(ff);
00612 }
00613 */
00614 
00615 //-------------------------------------------------------------------
00616 // EED 23 Mai 2007
00617 void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile)
00618 {
00619         vtkDataSetReader *reader = vtkDataSetReader::New();
00620         reader->SetFileName(namefile);
00621         reader->Update();
00622         _tissueStripper[3]->SetInput( reader->GetPolyDataOutput()  );
00623 }
00624 
00625 void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
00626         
00627         _volumeProperty->SetColor(colortable);
00628         
00629 }

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1