]> Creatis software - creaVtk.git/commitdiff
Clean code
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 1 Sep 2023 15:43:40 +0000 (17:43 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 1 Sep 2023 15:43:40 +0000 (17:43 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx

index 607ed2160476434e446e219dc4461d86bf541f39..fa077d8199c9f84cc34c26a5c67c1527a210603b 100644 (file)
@@ -36,7 +36,9 @@ void MeshReduction_DecimatePro::Process()
         decimatepro->SetInputData( bbGetInputIn() );
         decimatepro->SetTargetReduction( bbGetInputTargetReduction() );
         decimatepro->PreserveTopologyOn();
+        printf("EED MeshReduction_DecimatePro::Process  Running... \n");
         decimatepro->Update();
+        printf("EED MeshReduction_DecimatePro::Process  ...finish \n");
         bbSetOutputOut(decimatepro->GetOutput() );
     } else {
         bbSetOutputOut( NULL );
index 525c2e9f84f6fcbee86e66928371909f9cca177b..17dd34debc699acf4272baf2dde1305527e956af 100644 (file)
@@ -17,261 +17,265 @@ BBTK_BLACK_BOX_IMPLEMENTATION(VoiMPR,bbtk::AtomicBlackBox);
 //===== 
 void VoiMPR::Process()
 {
-
-// THE MAIN PROCESSING METHOD BODY
-//   Here we simply set the input 'In' value to the output 'Out'
-//   And print out the output value
-// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
-//    void bbSet{Input|Output}NAME(const TYPE&)
-//    const TYPE& bbGet{Input|Output}NAME() const 
-//    Where :
-//    * NAME is the name of the input/output
-//      (the one provided in the attribute 'name' of the tag 'input')
-//    * TYPE is the C++ type of the input/output
-//      (the one provided in the attribute 'type' of the tag 'input')
-//    bbSetOutputOut( bbGetInputIn() );
-//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-  
-       if (bbGetInputIn().size()!=6)
-       {
-               printf("EED Warning box not defined.\n");
-       } else {
-               bool showActorXY;
-               bool showActorYZ;
-               bool showActorXZ;
-
-               std::vector<int>    vecVOI  = bbGetInputIn();
-               std::vector<double>    spc  = bbGetInputSpacing();
-               vecVOI[0] = vecVOI[0]*spc[0];
-               vecVOI[1] = vecVOI[1]*spc[0];
-               vecVOI[2] = vecVOI[2]*spc[1];
-               vecVOI[3] = vecVOI[3]*spc[1];
-               vecVOI[4] = vecVOI[4]*spc[2];
-               vecVOI[5] = vecVOI[5]*spc[2];
-               int dep;
-               std::vector<int> vecPoint = bbGetInputActualPoint();
-               vecPoint[0] = vecPoint[0]*spc[0];
-               vecPoint[1] = vecPoint[1]*spc[1];
-               vecPoint[2] = vecPoint[2]*spc[2];
-
-               if (vecPoint.size()==3)
-               {
-                       if ((vecPoint[0]>=vecVOI[0]) && (vecPoint[0]<=vecVOI[1]) ) 
-                       {       
-                               showActorYZ=bbGetInputActive() && true; 
-                       } else {
-                               showActorYZ=bbGetInputActive() && false;        
-                       }
-                       if ((vecPoint[1]>=vecVOI[2]) && (vecPoint[1]<=vecVOI[3]) ) 
-                       {       
-                               showActorXZ=bbGetInputActive() && true; 
-                       } else {
-                               showActorXZ=bbGetInputActive() && false;        
-                       }
-                       if ((vecPoint[2]>=vecVOI[4]) && (vecPoint[2]<=vecVOI[5]) ) 
-                       {       
-                               showActorXY=bbGetInputActive() && true; 
-                       } else {
-                               showActorXY=bbGetInputActive() && false;        
-                       }
-               
-               } else {
-                       showActorXY=bbGetInputActive();
-                       showActorYZ=bbGetInputActive();
-                       showActorXZ=bbGetInputActive();
-               }
-
-               if (bbGetInputXYrender()!=NULL)
-               {
-                       dep=-900;
-                       pointsXY->SetPoint(0, vecVOI[0], vecVOI[2], dep);
-                       pointsXY->SetPoint(1, vecVOI[0], vecVOI[3], dep);
-                       pointsXY->SetPoint(2, vecVOI[1], vecVOI[3], dep);
-                       pointsXY->SetPoint(3, vecVOI[1], vecVOI[2], dep);
-                       pointsXY-> Modified();
-                       if ( showActorXY==true )
-                       {
-                               if (actorAddedXY==false)
-                               {
-                                       bbGetInputXYrender()->AddActor(polygonActorXY);
-                                       actorAddedXY=true;
-                               } // 
-                       } else {
-                               if (actorAddedXY==true)
-                               {
-                                       bbGetInputXYrender()->RemoveActor(polygonActorXY);
-                                       actorAddedXY=false;
-                               } // 
-                       }// Active
-               } // if XYrender
-               if (bbGetInputYZrender()!=NULL)
-               {
-                       dep=900;
-                       pointsYZ->SetPoint(0, dep,vecVOI[2], vecVOI[4] );
-                       pointsYZ->SetPoint(1, dep,vecVOI[2], vecVOI[5] );
-                       pointsYZ->SetPoint(2, dep,vecVOI[3], vecVOI[5] );
-                       pointsYZ->SetPoint(3, dep,vecVOI[3], vecVOI[4] );
-                       pointsYZ-> Modified();
-                       if ( showActorYZ==true )
-                       {
-                               if (actorAddedYZ==false)
-                               {
-                                       bbGetInputYZrender()->AddActor(polygonActorYZ);
-                                       actorAddedYZ=true;
-                               } // 
-                       } else {
-                               if (actorAddedYZ==true)
-                               {
-                                       bbGetInputYZrender()->RemoveActor(polygonActorYZ);
-                                       actorAddedYZ=false;
-                               } // 
-                       }// Active
-               } // if XYrender
-               if (bbGetInputXZrender()!=NULL)
-               {
-                       dep=-900;
-                       pointsXZ->SetPoint(0, vecVOI[0],dep, vecVOI[4] );
-                       pointsXZ->SetPoint(1, vecVOI[0],dep, vecVOI[5] );
-                       pointsXZ->SetPoint(2, vecVOI[1],dep, vecVOI[5] );
-                       pointsXZ->SetPoint(3, vecVOI[1],dep, vecVOI[4] );
-                       pointsXZ-> Modified();
-                       if ( showActorXZ==true )
-                       {
-                               if (actorAddedXZ==false)
-                               {
-                                       bbGetInputXZrender()->AddActor(polygonActorXZ);
-                                       actorAddedXZ=true;
-                               } // 
-                       } else {
-                               if (actorAddedXZ==true)
-                               {
-                                       bbGetInputXZrender()->RemoveActor(polygonActorXZ);
-                                       actorAddedXZ=false;
-                               } // 
-                       }// Active
-               } // if XYrender
-       } // In size
+    
+    // THE MAIN PROCESSING METHOD BODY
+    //   Here we simply set the input 'In' value to the output 'Out'
+    //   And print out the output value
+    // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+    //    void bbSet{Input|Output}NAME(const TYPE&)
+    //    const TYPE& bbGet{Input|Output}NAME() const
+    //    Where :
+    //    * NAME is the name of the input/output
+    //      (the one provided in the attribute 'name' of the tag 'input')
+    //    * TYPE is the C++ type of the input/output
+    //      (the one provided in the attribute 'type' of the tag 'input')
+    //    bbSetOutputOut( bbGetInputIn() );
+    //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+    
+    if (bbGetInputIn().size()!=6)
+    {
+        printf("EED Warning box not defined.\n");
+    } else {
+        bool showActorXY;
+        bool showActorYZ;
+        bool showActorXZ;
+        
+        std::vector<int>    vecVOI  = bbGetInputIn();
+        std::vector<double>    spc  = bbGetInputSpacing();
+        vecVOI[0] = vecVOI[0]*spc[0];
+        vecVOI[1] = vecVOI[1]*spc[0];
+        vecVOI[2] = vecVOI[2]*spc[1];
+        vecVOI[3] = vecVOI[3]*spc[1];
+        vecVOI[4] = vecVOI[4]*spc[2];
+        vecVOI[5] = vecVOI[5]*spc[2];
+        int dep;
+        std::vector<int> vecPoint = bbGetInputActualPoint();
+        vecPoint[0] = vecPoint[0]*spc[0];
+        vecPoint[1] = vecPoint[1]*spc[1];
+        vecPoint[2] = vecPoint[2]*spc[2];
+        
+        if (vecPoint.size()==3)
+        {
+            if ((vecPoint[0]>=vecVOI[0]) && (vecPoint[0]<=vecVOI[1]) )
+            {
+                showActorYZ=bbGetInputActive() && true;
+            } else {
+                showActorYZ=bbGetInputActive() && false;
+            }
+            if ((vecPoint[1]>=vecVOI[2]) && (vecPoint[1]<=vecVOI[3]) )
+            {
+                showActorXZ=bbGetInputActive() && true;
+            } else {
+                showActorXZ=bbGetInputActive() && false;
+            }
+            if ((vecPoint[2]>=vecVOI[4]) && (vecPoint[2]<=vecVOI[5]) )
+            {
+                showActorXY=bbGetInputActive() && true;
+            } else {
+                showActorXY=bbGetInputActive() && false;
+            }
+            
+        } else {
+            showActorXY=bbGetInputActive();
+            showActorYZ=bbGetInputActive();
+            showActorXZ=bbGetInputActive();
+        }
+        
+        if (bbGetInputXYrender()!=NULL)
+        {
+            dep=-900;
+            pointsXY->SetPoint(0, vecVOI[0], vecVOI[2], dep);
+            pointsXY->SetPoint(1, vecVOI[0], vecVOI[3], dep);
+            pointsXY->SetPoint(2, vecVOI[1], vecVOI[3], dep);
+            pointsXY->SetPoint(3, vecVOI[1], vecVOI[2], dep);
+            pointsXY-> Modified();
+            if ( showActorXY==true )
+            {
+                if (actorAddedXY==false)
+                {
+                    bbGetInputXYrender()->AddActor(polygonActorXY);
+                    actorAddedXY=true;
+                } //
+            } else {
+                if (actorAddedXY==true)
+                {
+                    bbGetInputXYrender()->RemoveActor(polygonActorXY);
+                    actorAddedXY=false;
+                } //
+            }// Active
+        } // if XYrender
+        if (bbGetInputYZrender()!=NULL)
+        {
+            dep=900;
+            pointsYZ->SetPoint(0, dep,vecVOI[2], vecVOI[4] );
+            pointsYZ->SetPoint(1, dep,vecVOI[2], vecVOI[5] );
+            pointsYZ->SetPoint(2, dep,vecVOI[3], vecVOI[5] );
+            pointsYZ->SetPoint(3, dep,vecVOI[3], vecVOI[4] );
+            pointsYZ-> Modified();
+            if ( showActorYZ==true )
+            {
+                if (actorAddedYZ==false)
+                {
+                    bbGetInputYZrender()->AddActor(polygonActorYZ);
+                    actorAddedYZ=true;
+                } //
+            } else {
+                if (actorAddedYZ==true)
+                {
+                    bbGetInputYZrender()->RemoveActor(polygonActorYZ);
+                    actorAddedYZ=false;
+                } //
+            }// Active
+        } // if XYrender
+        if (bbGetInputXZrender()!=NULL)
+        {
+            dep=-900;
+            pointsXZ->SetPoint(0, vecVOI[0],dep, vecVOI[4] );
+            pointsXZ->SetPoint(1, vecVOI[0],dep, vecVOI[5] );
+            pointsXZ->SetPoint(2, vecVOI[1],dep, vecVOI[5] );
+            pointsXZ->SetPoint(3, vecVOI[1],dep, vecVOI[4] );
+            pointsXZ-> Modified();
+            if ( showActorXZ==true )
+            {
+                if (actorAddedXZ==false)
+                {
+                    bbGetInputXZrender()->AddActor(polygonActorXZ);
+                    actorAddedXZ=true;
+                } //
+            } else {
+                if (actorAddedXZ==true)
+                {
+                    bbGetInputXZrender()->RemoveActor(polygonActorXZ);
+                    actorAddedXZ=false;
+                } //
+            }// Active
+        } // if XYrender
+    } // In size
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void VoiMPR::bbUserSetDefaultValues()
 {
-
-//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
-//    Here we initialize the input 'In' to 0
-       actorAddedXY            = false;
-       actorAddedXZ            = false;
-       actorAddedYZ            = false;
-       bbSetInputActive(true);
-       bbSetInputXYrender(NULL);
-       bbSetInputYZrender(NULL);
-       bbSetInputXZrender(NULL);
-
-       std::vector<double> spc;
-       spc.push_back(1);
-       spc.push_back(1);
-       spc.push_back(1);
-       bbSetInputSpacing(spc);
+    
+    //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+    //    Here we initialize the input 'In' to 0
+    actorAddedXY               = false;
+    actorAddedXZ               = false;
+    actorAddedYZ               = false;
+    bbSetInputActive(true);
+    bbSetInputXYrender(NULL);
+    bbSetInputYZrender(NULL);
+    bbSetInputXZrender(NULL);
+    
+    std::vector<double> spc;
+    spc.push_back(1);
+    spc.push_back(1);
+    spc.push_back(1);
+    bbSetInputSpacing(spc);
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void VoiMPR::bbUserInitializeProcessing()
 {
-
-//  THE INITIALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-
-       pointsXY                = vtkPoints                     ::New();
-       linesXY                 = vtkCellArray          ::New();
-       polygonXY               = vtkPolyData           ::New();
-       polygonMapperXY = vtkPolyDataMapper     ::New();
-       polygonActorXY  = vtkActor                      ::New();
-//EED 2023-07-27
+    
+    //  THE INITIALIZATION METHOD BODY :
+    //    Here does nothing
+    //    but this is where you should allocate the internal/output pointers
+    //    if any
+    
+    
+    pointsXY           = vtkPoints                     ::New();
+    linesXY            = vtkCellArray          ::New();
+    polygonXY          = vtkPolyData           ::New();
+    polygonMapperXY    = vtkPolyDataMapper     ::New();
+    polygonActorXY     = vtkActor                      ::New();
+    //EED 2023-07-27
     polygonActorXY->GetProperty()->SetOpacity(0.9999);
-       pointsXY                -> SetNumberOfPoints(4);
-       pointsXY                -> SetPoint(0, 0, 0, 0);
-       pointsXY                -> SetPoint(1, 0, 0, 0);
-       pointsXY                -> SetPoint(2, 0, 0, 0);
-       pointsXY                -> SetPoint(3, 0, 0, 0);
-       linesXY                 -> InsertNextCell(5);
-       linesXY                 -> InsertCellPoint(0);
-       linesXY                 -> InsertCellPoint(1);
-       linesXY                 -> InsertCellPoint(2);
-       linesXY                 -> InsertCellPoint(3);
-       linesXY                 -> InsertCellPoint(0);
-       polygonXY               -> SetPoints(pointsXY);
-       polygonXY               -> SetLines(linesXY);
-       polygonMapperXY -> SetInputData(polygonXY);
-       polygonMapperXY -> Update();
-       polygonActorXY  -> SetMapper(polygonMapperXY);
-
-
-       pointsXZ                = vtkPoints                     ::New();
-       linesXZ                 = vtkCellArray          ::New();
-       polygonXZ               = vtkPolyData           ::New();
-       polygonMapperXZ = vtkPolyDataMapper     ::New();
-       polygonActorXZ  = vtkActor                      ::New();
+    pointsXY           -> SetNumberOfPoints(4);
+    pointsXY           -> SetPoint(0, 0, 0, 0);
+    pointsXY           -> SetPoint(1, 0, 0, 0);
+    pointsXY           -> SetPoint(2, 0, 0, 0);
+    pointsXY           -> SetPoint(3, 0, 0, 0);
+    linesXY                    -> InsertNextCell(5);
+    linesXY                    -> InsertCellPoint(0);
+    linesXY                    -> InsertCellPoint(1);
+    linesXY                    -> InsertCellPoint(2);
+    linesXY                    -> InsertCellPoint(3);
+    linesXY                    -> InsertCellPoint(0);
+    polygonXY          -> SetPoints(pointsXY);
+    polygonXY          -> SetLines(linesXY);
+    polygonMapperXY    -> SetInputData(polygonXY);
+    polygonMapperXY    -> Update();
+    polygonActorXY     -> SetMapper(polygonMapperXY);
+    polygonActorXY  -> GetProperty()->SetOpacity(0.99);
+    polygonActorXY  -> GetProperty()->SetLineWidth(2);
+    
+    pointsXZ           = vtkPoints                     ::New();
+    linesXZ            = vtkCellArray          ::New();
+    polygonXZ          = vtkPolyData           ::New();
+    polygonMapperXZ    = vtkPolyDataMapper     ::New();
+    polygonActorXZ     = vtkActor                      ::New();
     //EED 2023-07-27
     polygonActorXZ->GetProperty()->SetOpacity(0.9999);
-       pointsXZ                -> SetNumberOfPoints(4);
-       pointsXZ                -> SetPoint(0, 0, 0, 0);
-       pointsXZ                -> SetPoint(1, 0, 0, 0);
-       pointsXZ                -> SetPoint(2, 0, 0, 0);
-       pointsXZ                -> SetPoint(3, 0, 0, 0);
-       linesXZ                 -> InsertNextCell(5);
-       linesXZ                 -> InsertCellPoint(0);
-       linesXZ                 -> InsertCellPoint(1);
-       linesXZ                 -> InsertCellPoint(2);
-       linesXZ                 -> InsertCellPoint(3);
-       linesXZ                 -> InsertCellPoint(0);
-       polygonXZ               -> SetPoints(pointsXZ);
-       polygonXZ               -> SetLines(linesXZ);
-       polygonMapperXZ -> SetInputData(polygonXZ);
-       polygonMapperXZ -> Update();
-       polygonActorXZ  -> SetMapper(polygonMapperXZ);
+    pointsXZ           -> SetNumberOfPoints(4);
+    pointsXZ           -> SetPoint(0, 0, 0, 0);
+    pointsXZ           -> SetPoint(1, 0, 0, 0);
+    pointsXZ           -> SetPoint(2, 0, 0, 0);
+    pointsXZ           -> SetPoint(3, 0, 0, 0);
+    linesXZ                    -> InsertNextCell(5);
+    linesXZ                    -> InsertCellPoint(0);
+    linesXZ                    -> InsertCellPoint(1);
+    linesXZ                    -> InsertCellPoint(2);
+    linesXZ                    -> InsertCellPoint(3);
+    linesXZ                    -> InsertCellPoint(0);
+    polygonXZ          -> SetPoints(pointsXZ);
+    polygonXZ          -> SetLines(linesXZ);
+    polygonMapperXZ    -> SetInputData(polygonXZ);
+    polygonMapperXZ    -> Update();
+    polygonActorXZ     -> SetMapper(polygonMapperXZ);
+    polygonActorXZ  -> GetProperty()->SetOpacity(0.99);
+    polygonActorXZ  -> GetProperty()->SetLineWidth(2);
 
-       pointsYZ                = vtkPoints                     ::New();
-       linesYZ                 = vtkCellArray          ::New();
-       polygonYZ               = vtkPolyData           ::New();
-       polygonMapperYZ = vtkPolyDataMapper     ::New();
-       polygonActorYZ  = vtkActor                      ::New();
+    pointsYZ           = vtkPoints                     ::New();
+    linesYZ            = vtkCellArray          ::New();
+    polygonYZ          = vtkPolyData           ::New();
+    polygonMapperYZ    = vtkPolyDataMapper     ::New();
+    polygonActorYZ     = vtkActor                      ::New();
     //EED 2023-07-27
     polygonActorYZ->GetProperty()->SetOpacity(0.9999);
-       pointsYZ                ->SetNumberOfPoints(4);
-       pointsYZ                ->SetPoint(0, 0, 0, 0);
-       pointsYZ                ->SetPoint(1, 0, 0, 0);
-       pointsYZ                ->SetPoint(2, 0, 0, 0);
-       pointsYZ                ->SetPoint(3, 0, 0, 0);
-       linesYZ                 ->InsertNextCell(5);
-       linesYZ                 ->InsertCellPoint(0);
-       linesYZ                 ->InsertCellPoint(1);
-       linesYZ                 ->InsertCellPoint(2);
-       linesYZ                 ->InsertCellPoint(3);
-       linesYZ                 ->InsertCellPoint(0);
-       polygonYZ               -> SetPoints(pointsYZ);
-       polygonYZ               -> SetLines(linesYZ);
-       polygonMapperYZ -> SetInputData(polygonYZ);
-       polygonMapperYZ -> Update();
-       polygonActorYZ  -> SetMapper(polygonMapperYZ);
+    pointsYZ           ->SetNumberOfPoints(4);
+    pointsYZ           ->SetPoint(0, 0, 0, 0);
+    pointsYZ           ->SetPoint(1, 0, 0, 0);
+    pointsYZ           ->SetPoint(2, 0, 0, 0);
+    pointsYZ           ->SetPoint(3, 0, 0, 0);
+    linesYZ                    ->InsertNextCell(5);
+    linesYZ                    ->InsertCellPoint(0);
+    linesYZ                    ->InsertCellPoint(1);
+    linesYZ                    ->InsertCellPoint(2);
+    linesYZ                    ->InsertCellPoint(3);
+    linesYZ                    ->InsertCellPoint(0);
+    polygonYZ          -> SetPoints(pointsYZ);
+    polygonYZ          -> SetLines(linesYZ);
+    polygonMapperYZ    -> SetInputData(polygonYZ);
+    polygonMapperYZ    -> Update();
+    polygonActorYZ     -> SetMapper(polygonMapperYZ);
+    polygonActorYZ  -> GetProperty()->SetOpacity(0.99);
+    polygonActorXY  -> GetProperty()->SetLineWidth(2);
+
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void VoiMPR::bbUserFinalizeProcessing()
 {
-
-//  THE FINALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should desallocate the internal/output pointers 
-//    if any
-  
+    //  THE FINALIZATION METHOD BODY :
+    //    Here does nothing
+    //    but this is where you should desallocate the internal/output pointers
+    //    if any
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk