]> Creatis software - creaMaracasVisu.git/commitdiff
#3476 Clean code
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 24 Jun 2021 20:54:33 +0000 (22:54 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 24 Jun 2021 20:54:33 +0000 (22:54 +0200)
bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx

index 52ab1bdc6af7c50d896426b4cf80e297a0e0579c..0097329a0ed2305567e4eec2483475ca68a570ef 100644 (file)
@@ -44,7 +44,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxisTree3D,bbtk::AtomicBlackBox);
 
 void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
 {
-printf("8.1 ");
+//EED printf("8.1 ");
        vtkPolyData                     *polydata               = vtkPolyData::New( );
        vtkPolyDataMapper       *polydatamapper = vtkPolyDataMapper::New();
        vtkActor                        *vtkactor               = vtkActor::New();
@@ -59,13 +59,13 @@ printf("8.1 ");
 #endif
        vtkactor->SetMapper(polydatamapper);
 
-printf("8.2 ");
+//EED printf("8.2 ");
 
        vecVtkPolyData.push_back( polydata );
        vecVtkPolyDataMaper.push_back( polydatamapper );
        vecVtkActors.push_back( vtkactor );
 
-printf("8.3 ");
+//EED printf("8.3 ");
 
 //     vtkImageData* img = bbGetInputImage();
        unsigned int i,size;
@@ -77,21 +77,24 @@ printf("8.3 ");
 
        int lstpointsXsize =bbGetInputlstPointX().size();
 
-printf("8.4 ");
+//EED printf("8.4 ");
 
        if( lstpointsXsize>0 )
        {
-printf("8.5 ");
+//EED printf("8.5 ");
                vtkPoints       *allPoints              = vtkPoints::New( );
                vtkPolyLine *polyline           = vtkPolyLine::New();
                vtkCellArray* allTopology       = vtkCellArray::New( );
 //             allTopology->InsertNextCell( numPoints );
-printf("8.6 ");
+
 
                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++)
                {
-printf("8.7(%d) ",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],
@@ -103,18 +106,18 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral);
 
 //                     allTopology->InsertCellPoint( i-iGeneral );
                } // rof
-printf("8.8 ");
+//EED printf("8.8 ");
                
   allTopology->InsertNextCell(polyline);
 
  // create cell array for edges
   vtkCellArray *edges = vtkCellArray::New();
-printf("8.9 ");
+//EED printf("8.9 ");
 
 // connect edge's and vertexes point ids
   for(vtkIdType i = iGeneral; i < size-1; i++)
   {
-printf("8.10(%d) ",i);
+//EED printf("8.10(%d) ",i);
     vtkLine *edge = vtkLine::New();
     edge->GetPointIds()->SetId(0, i-iGeneral);
     edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
@@ -125,7 +128,7 @@ printf("8.10(%d) ",i);
 //    vertexes->InsertNextCell(vertex);
   }
 
-printf("8.11 ");
+//EED printf("8.11 ");
                polydata->SetPoints( allPoints );
  polydata->SetLines(edges);
 //             polydata->SetLines( allTopology );
@@ -136,7 +139,7 @@ printf("8.11 ");
                edges->Delete();
                allPoints->Delete();
                allTopology->Delete();
-printf("8.12 ");
+//EED printf("8.12 ");
                
        }
 
@@ -145,7 +148,7 @@ printf("8.12 ");
 
        if (bbGetInputColourLaw()==1)  // the same color for all 
        {
-printf("8.13(%d) ",bbGetInputColour().size() );
+//EED printf("8.13(%d) ",bbGetInputColour().size() );
 
                r = bbGetInputColour()[0];
                g = bbGetInputColour()[1];
@@ -155,7 +158,7 @@ printf("8.13(%d) ",bbGetInputColour().size() );
 
        if (bbGetInputColourLaw()==2) // different colors for each segment
        {
-printf("8.14 ");
+//EED printf("8.14 ");
                if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )   
                {
                        r = bbGetInputColour()[0+iAxis*3];
@@ -166,13 +169,13 @@ printf("8.14 ");
                        g = (rand() % 100) / 100.0;
                        b = (rand() % 100) / 100.0;
                }
-printf("8.15 ");
+//EED printf("8.15 ");
                vtkactor->GetProperty()->SetColor( r,g,b );
        }  // Law 2  color for each segment
 
        if (bbGetInputColourLaw()==3)  // color for each point 
        {
-printf("8.16 ");
+//EED printf("8.16 ");
                // Setup the colors array
                vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
                colors->SetNumberOfComponents(3);
@@ -194,90 +197,95 @@ printf("8.16 ");
  
        }  // Law 3 color for each point
 
-printf("8.17 ");
+//EED printf("8.17 ");
        vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
        vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
 
        if ( bbGetInputTransform()!=NULL )
        {
-printf("8.18 ");
+//EED printf("8.18 ");
                vtkactor->SetUserTransform( bbGetInputTransform() );
        }
 
      // Interface Update
      if  (bbGetInputRenderer()!=NULL )
      {
-printf("8.19 ");
+//EED printf("8.19 ");
            bbGetInputRenderer()->AddActor( vtkactor );
      }
-printf("8.20 ");
+//EED printf("8.20 ");
 
 }
 
 
 void DrawAxisTree3D::Process()
 {
-printf("1 ");
-       int iGeneral=0;
-       std::vector<int> lstIndexs = bbGetInputlstIndexs();
-       if ( bbGetInputlstIndexs().size()==0 )
-       {
-printf("2 ");
-               lstIndexs.push_back( bbGetInputlstPointX().size() );
-       } // if
-       int iAxis,sizeLstAxis=lstIndexs.size();
-    int iActor,sizeActors = vecVtkActors.size();
-       int numPoints;
-
-printf("3 ");
-
-//    if (oldLstSize!=sizeLstAxis)
-//      {
-//        oldLstSize=sizeLstAxis;
-         for (iActor=0 ; iActor<sizeActors; iActor++)
-         {
-printf("4-%d ",iActor);
-            if (bbGetInputRenderer()!=NULL )
-            {
-printf("5 ");
-                bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
-                vecVtkPolyData[iActor]->Delete();
-                vecVtkPolyDataMaper[iActor]->Delete();
-                vecVtkActors[iActor]->Delete();
-printf("6 ");
-            } // if
-         } // for iActor
-         vecVtkPolyData.clear();
-         vecVtkPolyDataMaper.clear();
-         vecVtkActors.clear();
-printf("7 ");
-         for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
-         {
-printf("8(%d) ",iAxis);
-            numPoints = lstIndexs[iAxis];
-printf("9(%d) ",iAxis);
-            DrawOneAxis(iGeneral,numPoints,iAxis);
-printf("10 ");   
-            iGeneral = iGeneral+numPoints;
-    //         if ((iAxis % 1)==0)
-    //         {
-    //                 printf("EED  DrawAxisTree3D::Process  %d/%d\n", iAxis,sizeLstAxis );
-    //         }
-         } // for iAxis
-
-printf("11 ");
-
-        if ( bbGetInputiAxis() < (int)(vecVtkActors.size() ) )
-        {
-            bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );            
-        } else         {
-            printf("DrawAxisTree3D .ERROR.  iAxis for exist in actors vector ...\n");
-        } // if 
- //   } else {// if oldLstSize
-//    } // if oldLstSize
-
-printf("12 \n");
+printf("DrawAxisTree3D::Process Start >>   %s\n", bbGetFullName().c_str() );
 
+   if ( (bbGetInputlstPointX().size()==bbGetInputlstPointY().size()) && 
+               (bbGetInputlstPointX().size()==bbGetInputlstPointZ().size())      )
+       {
+               int iGeneral=0;
+               std::vector<int> lstIndexs = bbGetInputlstIndexs();
+               if ( bbGetInputlstIndexs().size()==0 )
+               {
+       //EED printf("2 ");
+                       lstIndexs.push_back( bbGetInputlstPointX().size() );
+               } // if
+               int iAxis,sizeLstAxis=lstIndexs.size();
+               int iActor,sizeActors = vecVtkActors.size();
+               int numPoints;
+
+       //EED printf("3 ");
+
+       //    if (oldLstSize!=sizeLstAxis)
+       //       {
+       //        oldLstSize=sizeLstAxis;
+                    for (iActor=0 ; iActor<sizeActors; iActor++)
+                    {
+       //EED printf("4-%d ",iActor);
+                       if (bbGetInputRenderer()!=NULL )
+                       { 
+       //EED printf("5 ");
+                           bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
+                           vecVtkPolyData[iActor]->Delete();
+                           vecVtkPolyDataMaper[iActor]->Delete();
+                           vecVtkActors[iActor]->Delete();
+       //EED printf("6 ");
+                       } // if
+                    } // for iActor
+                    vecVtkPolyData.clear();
+                    vecVtkPolyDataMaper.clear();
+                    vecVtkActors.clear();
+       //EED printf("7 ");
+                    for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
+                    {
+       //EED printf("8(%d) ",iAxis);
+                       numPoints = lstIndexs[iAxis];
+       //EED printf("9(%d) ",iAxis);
+                       DrawOneAxis(iGeneral,numPoints,iAxis);
+       //EED printf("10 ");   
+                       iGeneral = iGeneral+numPoints;
+               //              if ((iAxis % 1)==0)
+               //              {
+               //                      printf("EED  DrawAxisTree3D::Process  %d/%d\n", iAxis,sizeLstAxis );
+               //              }
+                    } // for iAxis
+
+       //EED printf("11 ");
+
+                   if ( bbGetInputiAxis() < (int)(vecVtkActors.size() ) )
+                   {
+                       bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );            
+                   } else      {
+                       printf("DrawAxisTree3D .ERROR.  iAxis for exist in actors vector ...\n");
+                   } // if 
+        //   } else {// if oldLstSize
+       //    } // if oldLstSize
+       } else {
+               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
+printf("DrawAxisTree3D::Process End \n");
 
 }
 
@@ -317,6 +325,7 @@ void DrawAxisTree3D::bbUserSetDefaultValues()
      bbSetInputLineWidth(0.5);
      bbSetInputColourLaw(1);
      bbSetInputTransform(NULL);
+     bbSetOutputOutAxis(NULL);
 
 }
 
index fc664f2ec52c85ccc8b116cfa5e90cc2affbfb17..db7a79f1cd1de8ac9b89632173b32ec0dcb038d8 100644 (file)
@@ -168,8 +168,6 @@ void wxVtkMPR3DView::RemoveActor(vtkActor* actor)
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::Configure()
 {
-printf("EED wxVtkMPR3DView::Configure Configure Start\n");
-
        vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
        _wxvtk3Dbaseview->Configure();
        _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
@@ -288,15 +286,11 @@ printf("EED wxVtkMPR3DView::Configure Configure Start\n");
        // render window (expressed in pixels).
        _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
 //EED 23oct2010        _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
-
-printf("EED wxVtkMPR3DView::Configure Configure End\n");
-
 }
 
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::ConfigureFreePlanes()
 {
-printf("EED wxVtkMPR3DView::ConfigureFreePlanes Start\n");
        // The shared picker enables us to use 3 planes at one time
        // and gets the picking order right
        vtkCellPicker* picker = vtkCellPicker::New();
@@ -320,17 +314,12 @@ printf("EED wxVtkMPR3DView::ConfigureFreePlanes Start\n");
        _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc );
        _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc );
        _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc );      
-       
-
-       
-printf("EED wxVtkMPR3DView::ConfigureFreePlanes End\n");
 }
 
 
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::SetImage()
 {
-printf("EED wxVtkMPR3DView::SetImage Start\n");
        vtkImageData *imageData                                 = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
        // Orthogonal planes B&W
 //EED 2017-01-01 Migration VTK7
@@ -397,8 +386,6 @@ printf("EED wxVtkMPR3DView::SetImage Start\n");
        _probe->SetSourceData( imageData );
 #endif
        _vtkmpr3Ddataviewer->SetImage();
-printf("EED wxVtkMPR3DView::SetImage End %f  %f \n", colorWindow,colorLevel );
-       
 }
 
 //-------------------------------------------------------------------
@@ -535,19 +522,16 @@ void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortab
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::Refresh()   // virtual
 {
-printf("EED wxVtkMPR3DView::Refresh Start\n");
        _vtkmpr3Ddataviewer->Refresh();
        if (_wxvtkmpr3DviewCntrlPanel!=NULL)
        {
                _wxvtkmpr3DviewCntrlPanel->Refresh();
        }
-printf("EED wxVtkMPR3DView::Refresh End\n");
 }
 
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::RefreshView()   // virtual
 {
-printf("EED wxVtkMPR3DView::RefreshView Start\n");
        double spc[3];
        vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
        if(image)
@@ -632,7 +616,6 @@ printf("EED wxVtkMPR3DView::RefreshView Start\n");
        {
                _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(false);
        } // if _wxvtkmpr3DviewCntrlPanel
-printf("EED wxVtkMPR3DView::RefreshView End\n");
 }
 
 //-------------------------------------------------------------------