]> Creatis software - bbtk.git/commitdiff
#3503 Append PolyData vector
authorPablo Garzon <gapablo2001@gmail.com>
Fri, 2 Jun 2023 12:38:43 +0000 (14:38 +0200)
committerPablo Garzon <gapablo2001@gmail.com>
Fri, 2 Jun 2023 12:38:43 +0000 (14:38 +0200)
packages/itkvtk/src/bbitkvtkGeodesicMeshDeformation.cxx
packages/vtk/src/bbvtkAppendPolyData.xml

index f99dc9cb5a26b0f35e7bdc47f3a5e1b91294e85f..a589a47453ba17e6fc4202b533ae8447acc32e59 100644 (file)
@@ -14,7 +14,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(GeodesicMeshDeformation,bbtk::AtomicBlackBox);
 //===== 
 void GeodesicMeshDeformation::Process()
 {
-//printf("PG GeodesicMeshDeformation::Process START \n");
+printf("PG GeodesicMeshDeformation::Process START \n");
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -29,11 +29,13 @@ void GeodesicMeshDeformation::Process()
     std::vector<double> lstCenter = bbGetInputCenter();
     double s   = bbGetInputS();
     bool    ok  = false;
+    bool       pdChanged = false;
     using MeshType = itk::QuadEdgeMesh<double, 3>;
     
     //Set up QuadEdge and filter every time polydata changes
     if ((bbGetInputIn() != polydata) && (bbGetInputActive()==true) && (bbGetInputIn() != NULL))
     {
+       pdChanged = true;
        //Reset displacement
        if(lstCenter.size() != NULL)
        {
@@ -155,8 +157,8 @@ void GeodesicMeshDeformation::Process()
             
         } // if TypeIn 1 Center
         points->GetPoint( bbGetInputEdgeId() , pb );
-        if (EdgeIdBack!=bbGetInputEdgeId() )
-        {
+        if (EdgeIdBack!=bbGetInputEdgeId() || pdChanged)
+        {printf("PG GeodesicMeshDeformation::Process ENTERED \n");
             EdgeIdBack = bbGetInputEdgeId();
             
                        backLstCenter[0] = lstCenter[0];
@@ -218,7 +220,7 @@ void GeodesicMeshDeformation::Process()
                        }// if ffmFilter != NULL
         } // if distance_x y z  != 0
     } // In != NULL    ok    active
-//    printf("PG GeodesicMeshDeformation::Process END \n");
+    printf("PG GeodesicMeshDeformation::Process END \n");
 }
 //===== 
 // 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)
index 9dde44cee4ec895e87a932f25e0f2b14bb73a4ad..f415a88ad4a8650f03402401e999cfd175432028 100644 (file)
@@ -16,6 +16,8 @@
 <input name="In3" type="vtkPolyData *" description="PolyData 3"/>
 <input name="In4" type="vtkPolyData *" description="PolyData 4"/>
 <input name="In5" type="vtkPolyData *" description="PolyData 5"/>
+<typedef><PRE>typedef std::vector<vtkPolyData *> InputVector;</PRE></typedef>
+<input name="InVector" type="InputVector" description="PolyData vector"/>
 
 <process>
 <PRE>
   bbGetVtkObject()->SetInput(bbGetInputIn3());
   bbGetVtkObject()->SetInput(bbGetInputIn4());
   bbGetVtkObject()->SetInput(bbGetInputIn5());
+  if(!bbGetInputInVector().empty()){
+       for(int i = 0; i < (int) bbGetInputInVector().size(); i++){
+               bbGetVtkObject()->SetInput(bbGetInputInVector()[i]);
+       }
+  }
 #else
   bbGetVtkObject()->AddInputData(bbGetInputIn1());
   bbGetVtkObject()->AddInputData(bbGetInputIn2());
   bbGetVtkObject()->AddInputData(bbGetInputIn3());
   bbGetVtkObject()->AddInputData(bbGetInputIn4());
   bbGetVtkObject()->AddInputData(bbGetInputIn5());
+  if(!bbGetInputInVector().empty()){
+       for(int i = 0; i < (int) bbGetInputInVector().size(); i++){
+               bbGetVtkObject()->AddInputData(bbGetInputInVector()[i]);
+       }
+  }
 #endif