]> Creatis software - creaMaracasVisu.git/commitdiff
2116 creaMaracasVisu Bug New Normal Erase Start End Sphere of the tubes
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 19 Aug 2013 16:55:13 +0000 (18:55 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 19 Aug 2013 16:55:13 +0000 (18:55 +0200)
bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx

index 80946c0447e0f488add37ffe035ea726d9929084..b58742c5c63e1d1db6fa6b147461e41be4570a88 100644 (file)
@@ -34,7 +34,6 @@
 #include <vtkPolyData.h>
 #include <vtkPointData.h>
 #include <vtkTubeFilter.h>
-#include <vtkSphereSource.h>
 #include "vtkObjectFactory.h"
 
 
@@ -307,38 +306,11 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube)
 
 
 
-// Adding spheres at the start and end of the tube
-
-       // Sphere start
-       i=iGeneral;
-       vtkSphereSource *vtksphereStart         = vtkSphereSource::New();
-       vtksphereStart->SetThetaResolution (10);
-       vtksphereStart->SetPhiResolution (10);
-       vtksphereStart->SetRadius( bbGetInputlstRadio()[i]  );
-       vtkPolyDataMapper *sphereMapperStart    = vtkPolyDataMapper::New();
-       sphereMapperStart->SetInput( vtksphereStart->GetOutput() );
-       vtkActor *sphereActorStart      = vtkActor::New();
-       sphereActorStart->SetMapper(sphereMapperStart);
-       sphereActorStart->SetOrigin( 0,0,0 );
-       sphereActorStart->SetPosition(bbGetInputlstPointX()[i]*spc[0], bbGetInputlstPointY()[i]*spc[1], bbGetInputlstPointZ()[i]*spc[2] );
-
-       // Sphere end
-       i=size-1;
-       vtkSphereSource *vtksphereEnd           = vtkSphereSource::New();
-       vtksphereEnd->SetThetaResolution (10);
-       vtksphereEnd->SetPhiResolution (10);
-       vtksphereEnd->SetRadius( bbGetInputlstRadio()[i]  );
-       vtkPolyDataMapper *sphereMapperEnd      = vtkPolyDataMapper::New();
-       sphereMapperEnd->SetInput( vtksphereEnd->GetOutput() );
-       vtkActor *sphereActorEnd        = vtkActor::New();
-       sphereActorEnd->SetMapper(sphereMapperEnd);
-       sphereActorEnd->SetOrigin( 0,0,0 );
-       sphereActorEnd->SetPosition(bbGetInputlstPointX()[i]*spc[0], bbGetInputlstPointY()[i]*spc[1], bbGetInputlstPointZ()[i]*spc[2] );
-
        vtkSmartPointer<vtkTubeFilter> tube = vtkSmartPointer<vtkTubeFilter>::New();
        tube->SetInput(polyData);
        tube->SetNumberOfSides(nTv);
        tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
+        tube->CappingOn();
        
        vtkLookupTableEED* vLutEED                               = vtkLookupTableEED::New();
 
@@ -356,15 +328,11 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube)
        actor->SetMapper(mapper);
 
     vecVtkActors.push_back( actor );
-    vecVtkActors.push_back( sphereActorEnd );
-    vecVtkActors.push_back( sphereActorStart );
 
        // Interface Update    // Interface Update
      if  (bbGetInputRenderer()!=NULL )
      {
            bbGetInputRenderer()->AddActor( actor );
-           bbGetInputRenderer()->AddActor( sphereActorStart );
-           bbGetInputRenderer()->AddActor( sphereActorEnd );
      }
 }
 
@@ -377,9 +345,6 @@ void TubeTreeFilter::SetGraphicProperties()
     int numPoints;
 
     vtkActor *actorTube;
-    vtkActor *actorSpherEnd;
-    vtkActor *actorSpherStart;
-
 
     double r,g,b;
     r = bbGetInputColour()[0];
@@ -388,21 +353,16 @@ void TubeTreeFilter::SetGraphicProperties()
     for (iTube=0 ; iTube<sizeLstAxis; iTube++)
     {
         // Get Actor
-        actorTube=vecVtkActors[0+iTube*3];
-        actorSpherEnd=vecVtkActors[1+iTube*3];
-        actorSpherStart=vecVtkActors[2+iTube*3];
+
+        actorTube=vecVtkActors[iTube];
 
         // Set Opacity
         actorTube->GetProperty()->SetOpacity( bbGetInputOpacity() );
-        actorSpherEnd->GetProperty()->SetOpacity( bbGetInputOpacity() );
-        actorSpherStart->GetProperty()->SetOpacity( bbGetInputOpacity() );
 
        // Set Transform
         if ( bbGetInputTransform()!=NULL )
         {
             actorTube->SetUserTransform( bbGetInputTransform() );
-            actorSpherEnd->SetUserTransform( bbGetInputTransform() );
-            actorSpherStart->SetUserTransform( bbGetInputTransform() );
         }
 
         //Set Colour
@@ -426,8 +386,6 @@ void TubeTreeFilter::SetGraphicProperties()
         }
 
         actorTube->GetProperty()->SetColor( r,g,b );
-        actorSpherEnd->GetProperty()->SetColor( r,g,b );
-        actorSpherStart->GetProperty()->SetColor( r,g,b );
 
 
 // Setting radio
@@ -477,12 +435,13 @@ void TubeTreeFilter::Process()
             iGeneral = iGeneral+numPoints;
         }
 
-        if ( bbGetInputiTube()*3 <= (int)(vecVtkActors.size()-1) )
+        if ( bbGetInputiTube() <= (int)(vecVtkActors.size()-1) )
         {
-            bbSetOutputOutTube( vecVtkActors[ bbGetInputiTube()*3 ] );
+            bbSetOutputOutTube( vecVtkActors[ bbGetInputiTube() ] );
         } else         {
                 printf("TubeTreeFilter .ERROR. missing index vector...\n");
         }// vector Actor size
+
     } // oldLstSize
     SetGraphicProperties();