]> Creatis software - creaMaracasVisu.git/commitdiff
clean code vtk8itk5wx3-mingw64
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 7 Jul 2021 15:14:02 +0000 (17:14 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 7 Jul 2021 15:14:02 +0000 (17:14 +0200)
bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx

index 0164c6d695284e5943317d515377dfec977ba416..9a4b8789d04e87d28b9b5d0cf5bbf1dcda1a3262 100644 (file)
@@ -44,7 +44,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxisTree3D,bbtk::AtomicBlackBox);
 
 void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 {
-//EED printf("8.1 ");
        vtkPolyData                     *polydata               = vtkPolyData::New( );
        vtkPolyDataMapper       *polydatamapper = vtkPolyDataMapper::New();
        vtkActor                        *vtkactor               = vtkActor::New();
@@ -59,14 +58,10 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 #endif
        vtkactor->SetMapper(polydatamapper);
 
-//EED printf("8.2 ");
-
        vecVtkPolyData.push_back( polydata );
        vecVtkPolyDataMaper.push_back( polydatamapper );
        vecVtkActors.push_back( vtkactor );
 
-//EED printf("8.3 ");
-
 //     vtkImageData* img = bbGetInputImage();
        unsigned int i,size;
        double spc[3];
@@ -76,12 +71,8 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
        spc[2]=1;
 
        int lstpointsXsize =bbGetInputlstPointX().size();
-
-//EED printf("8.4 ");
-
        if( lstpointsXsize>0 )
        {
-//EED printf("8.5 ");
                vtkPoints       *allPoints              = vtkPoints::New( );
                vtkPolyLine *polyline           = vtkPolyLine::New();
                vtkCellArray* allTopology       = vtkCellArray::New( );
@@ -89,12 +80,9 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 
 
                size=iGeneral+numPoints;
-//EED printf("8.6a %p %d %d ",allPoints, iGeneral,size);
-//EED printf("8.6b %d %d %d ",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
 
                for (i=iGeneral;i<size;i++)
                {
-//EED printf("8.7(%d) ",i);
                        //multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
                        //hay parĀ·metro dycom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata
                        allPoints->InsertNextPoint( bbGetInputlstPointX()[i]*spc[0],
@@ -106,31 +94,24 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
 //                     allTopology->InsertCellPoint( i-iGeneral );
                } // rof
-//EED printf("8.8 ");
                
-  allTopology->InsertNextCell(polyline);
-
- // create cell array for edges
-  vtkCellArray *edges = vtkCellArray::New();
-//EED printf("8.9 ");
-
-// connect edge's and vertexes point ids
-  for(vtkIdType i = iGeneral; i < size-1; i++)
-  {
-//EED printf("8.10(%d) ",i);
-    vtkLine *edge = vtkLine::New();
-    edge->GetPointIds()->SetId(0, i-iGeneral);
-    edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
-    edges->InsertNextCell(edge);
-    edge->Delete();
-//    vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
-//    vertex->GetPointIds()->SetId(0, i);
-//    vertexes->InsertNextCell(vertex);
-  }
-
-//EED printf("8.11 ");
-               polydata->SetPoints( allPoints );
- polydata->SetLines(edges);
+         allTopology->InsertNextCell(polyline);
+        // create cell array for edges
+         vtkCellArray *edges = vtkCellArray::New();
+       // connect edge's and vertexes point ids
+         for(vtkIdType i = iGeneral; i < size-1; i++)
+         {
+               vtkLine *edge = vtkLine::New();
+               edge->GetPointIds()->SetId(0, i-iGeneral);
+               edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
+               edges->InsertNextCell(edge);
+               edge->Delete();
+       //    vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
+       //    vertex->GetPointIds()->SetId(0, i);
+       //    vertexes->InsertNextCell(vertex);
+         }
+       polydata->SetPoints( allPoints );
+       polydata->SetLines(edges);
 //             polydata->SetLines( allTopology );
 
 
@@ -139,8 +120,6 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
                edges->Delete();
                allPoints->Delete();
                allTopology->Delete();
-//EED printf("8.12 ");
-               
        }
 
        // color
@@ -148,8 +127,6 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
        if (bbGetInputColourLaw()==1)  // the same color for all 
        {
-//EED printf("8.13(%d) ",bbGetInputColour().size() );
-
                r = bbGetInputColour()[0];
                g = bbGetInputColour()[1];
                b = bbGetInputColour()[2];
@@ -158,7 +135,6 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
        if (bbGetInputColourLaw()==2) // different colors for each segment
        {
-//EED printf("8.14 ");
                if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )   
                {
                        r = bbGetInputColour()[0+iAxis*3];
@@ -169,21 +145,17 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
                        g = (rand() % 100) / 100.0;
                        b = (rand() % 100) / 100.0;
                }
-//EED printf("8.15 ");
                vtkactor->GetProperty()->SetColor( r,g,b );
        }  // Law 2  color for each segment
 
        if (bbGetInputColourLaw()==3)  // color for each point 
        {
-//EED printf("8.16 ");
                // Setup the colors array
                vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
                colors->SetNumberOfComponents(3);
                colors->SetName("Colors");
 //             colors->SetName("vertex color");
                int iPoint,pointSize=iGeneral+numPoints;
-
-
                for (iPoint=iGeneral; iPoint<pointSize; iPoint++)
                {
                        r = bbGetInputColour()[0+iPoint*3]*255.0;
@@ -197,30 +169,23 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
  
        }  // Law 3 color for each point
 
-//EED printf("8.17 ");
        vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
        vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
 
        if ( bbGetInputTransform()!=NULL )
        {
-//EED printf("8.18 ");
                vtkactor->SetUserTransform( bbGetInputTransform() );
        }
-
-     // Interface Update
-     if  (bbGetInputRenderer()!=NULL )
-     {
-//EED printf("8.19 ");
-           bbGetInputRenderer()->AddActor( vtkactor );
-     }
-//EED printf("8.20 ");
-
+    // Interface Update
+    if  (bbGetInputRenderer()!=NULL )
+    {
+          bbGetInputRenderer()->AddActor( vtkactor );
+    }
 }
 
 
 void DrawAxisTree3D::Process()
 {
-printf("DrawAxisTree3D::Process Start >>   %s\n", bbGetFullName().c_str() );
 
        // Removing actors
        int iActor,sizeActors = vecVtkActors.size();
@@ -268,7 +233,6 @@ printf("DrawAxisTree3D::Process Start >>   %s\n", bbGetFullName().c_str() );
                        printf("\nDrawAxisTree3D .ERROR.  size of vectors lstPointX.size=%d lstPointY.size=%d lstPointZ.size=%d are not coherent \n\n",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
                }// size X Y Z
        } // if Active
-printf("DrawAxisTree3D::Process End \n");
 
 }