]> Creatis software - bbtk.git/commitdiff
#3549 GetElementVectorVectorDouble vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sat, 17 Oct 2026 13:28:19 +0000 (15:28 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sat, 17 Oct 2026 13:28:19 +0000 (15:28 +0200)
kernel/src/bbtkRTTI.h
packages/std/src/bbstdGetVectorElement.cxx
packages/std/src/bbstdGetVectorElement.h
packages/std/src/bbstdStringTo.cxx
packages/vtk/src/bbvtkPlaneClipPolyData.cxx
packages/vtk/src/bbvtkPlaneClipPolyData.h
packages/vtk/src/bbvtkTransform.cxx
packages/vtk/src/bbvtkTransform.h

index d7a21d0..20622b3 100644 (file)
@@ -157,6 +157,8 @@ namespace bbtk
     template <> inline std::string HumanTypeName< TYPE >(const TYPE&)  \
     { return NAME; }   
   
+  typedef std::vector< double > typeVectorDbl;
+
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::string,"String");
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed char,"Char");
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed short,"Short");
@@ -168,6 +170,7 @@ namespace bbtk
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(double,"Double");
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bool,"Bool");
   BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(long,"Long");
+//  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME( typeVectorDbl ,"vecDbl");
 
   // Human readable strings for std::vector
 #define BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(TYPE)              \
@@ -185,8 +188,12 @@ namespace bbtk
   BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(uint32_t);
   BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(long);
   BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(float);
+
+
+
   BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(double);
   BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(std::string);
+  BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME( typeVectorDbl );
 
 /// The bbtk::TypeInfo type is a const ref on std::type_info (which can only be manipulated as such (because typeid returns const std::type_info& and type_info has all constructors private)) 
   typedef const std::type_info& TypeInfo;
index 303c63d..0a7983f 100644 (file)
@@ -60,6 +60,11 @@ BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,float);
 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,double);
 typedef std::string string;
 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,string);
+
+typedef std::vector<double> vecDouble;
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement, vecDouble );
+
 //====================================================================
 
 } // namespace bbstd
index 452b43c..9252f3c 100644 (file)
@@ -83,7 +83,6 @@ namespace bbstd
                  bbSetOutputOut( bbGetInputErrorValue() );
          }
   }
-  //=================================================================
 
   //=================================================================  
   template <class T>
@@ -91,21 +90,18 @@ namespace bbstd
   {
        bbSetInputI(0);
   }
-  //=================================================================
-  //=================================================================  
+
+//=================================================================
   template <class T>
   void GetVectorElement<T>::bbUserInitializeProcessing()
   {
-
   }
+
   //=================================================================
-  //=================================================================  
   template <class T>
   void GetVectorElement<T>::bbUserFinalizeProcessing()
   {
-
   }
-  //=================================================================
 
 } // namespace bbstd
 
index 055e60e..3ba9caf 100644 (file)
@@ -67,7 +67,7 @@ namespace bbstd
         bbSetOutputOut(true);
 
     }
-        printf("EED StringTo 5\n");
+
   }
   
   // Template specialization of DoIt
index 07eafb7..82a620f 100644 (file)
@@ -1,8 +1,14 @@
 //===== 
 // 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)
 //===== 
+
 #include "bbvtkPlaneClipPolyData.h"
 #include "bbvtkPackage.h"
+
+#include <vtkClipPolyData.h>
+#include <vtkClipClosedSurface.h>
+#include <vtkPlaneCollection.h>
+
 namespace bbvtk
 {
 
@@ -25,22 +31,21 @@ void PlaneClipPolyData::Process()
        plane->SetOrigin(origin[0],origin[1],origin[2]);
        plane->SetNormal(normal[0],normal[1],normal[2]);
 
-       vtkClipPolyData* clipper = vtkClipPolyData::New();
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
-       clipper->SetInputConnection(inPolyData->GetProducerPort());
-#else
-       clipper->SetInputData(inPolyData);
-#endif
-
-       clipper->SetClipFunction(plane);
-       clipper->Update();
-
-       vtkPolyData* outPolydata = clipper->GetOutput();
-    bbSetOutputClippedPolyData(outPolydata);
-
-   // std::cout << "RaC PlaneClipPolyData::Process END "<<polydataCopy<< std::endl;
+    if (bbGetInputCloseSurface()==false)  // with holes
+    {
+        vtkClipPolyData* clipper = vtkClipPolyData::New();
+        clipper->SetClipFunction(plane);
+        clipper->Update();
+        bbSetOutputClippedPolyData( clipper->GetOutput() );
+    } else {  // true    with out holes
+        vtkClipClosedSurface* clipper = vtkClipClosedSurface::New();
+        clipper->SetInputData(inPolyData);
+        vtkPlaneCollection *planes = vtkPlaneCollection::New();
+        planes->AddItem(plane);
+        clipper->SetClippingPlanes(planes);
+        clipper->Update();
+        bbSetOutputClippedPolyData( clipper->GetOutput() );
+    }
 }
 
 //=====
@@ -48,6 +53,7 @@ void PlaneClipPolyData::Process()
 //===== 
 void PlaneClipPolyData::bbUserSetDefaultValues()
 {
+    bbSetInputCloseSurface(false);
 }
 
 //=====
index f68ea0e..508970e 100644 (file)
@@ -7,22 +7,7 @@
 #include "bbtkAtomicBlackBox.h"
 #include "iostream"
 
-#include <vtkSmartPointer.h>
 #include <vtkPolyData.h>
-#include <vtkClipPolyData.h>
-#include <vtkPlane.h>
-
-#include <vtkDataSetMapper.h>
-#include <vtkActor.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
-#include <vtkCamera.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkActor.h>
-#include <vtkProperty.h>
-#include <vtkSphereSource.h>
 
 namespace bbvtk
 {
@@ -38,6 +23,7 @@ class bbvtk_EXPORT PlaneClipPolyData
   BBTK_DECLARE_INPUT(PlaneOrigin,std::vector<double>);
   BBTK_DECLARE_INPUT(PlaneNormal,std::vector<double>);
   BBTK_DECLARE_INPUT(PolyData,vtkPolyData*);
+  BBTK_DECLARE_INPUT(CloseSurface,bool);
   BBTK_DECLARE_OUTPUT(ClippedPolyData,vtkPolyData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -50,9 +36,10 @@ class bbvtk_EXPORT PlaneClipPolyData
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneClipPolyData,bbtk::AtomicBlackBox);
 BBTK_NAME("PlaneClipPolyData");
-BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_AUTHOR("Ricardo A COREDOR /Eduardo DAVILA");
 BBTK_DESCRIPTION("Clips a polydata with a plane determined by the origin and normal given");
 BBTK_CATEGORY("");
+BBTK_INPUT(PlaneClipPolyData,CloseSurface,"(default false)  false : hole in the clip plane;  true : with out hole in the clip plane",bool,"");
 BBTK_INPUT(PlaneClipPolyData,PlaneOrigin,"Cutting plane origin",std::vector<double>,"");
 BBTK_INPUT(PlaneClipPolyData,PlaneNormal,"Cutting plane normal",std::vector<double>,"");
 BBTK_INPUT(PlaneClipPolyData,PolyData,"PolyData to be clipped",vtkPolyData*,"");
index 88cc6ac..5845c47 100644 (file)
@@ -148,18 +148,44 @@ namespace bbvtk
           } // for j
           m->Modified();
           result->Update();
-      } // ManualMatrix
-      
+      } // ManualMatrix4x4
+
+      if (bbGetInputManualMatrix3x3In().size()==9)
+      {
+          std::vector<double> manaulMatrixIn = bbGetInputManualMatrix3x3In();
+          vtkMatrix4x4* m = result->GetMatrix();
+          int i,j,ii=0;
+          for (j=0;j<3;j++)
+          {
+              for (i=0;i<3;i++)
+              {
+                  //                  m->SetElement(j,i,manaulMatrixIn[ii]);
+                  m->SetElement(j,i,manaulMatrixIn[ii]);
+                  ii++;
+              }// for i
+          } // for j
+          m->SetElement(3,0,0);
+          m->SetElement(3,1,0);
+          m->SetElement(3,2,0);
+          m->SetElement(3,3,1);
+          m->SetElement(0,3,0);
+          m->SetElement(1,3,0);
+          m->SetElement(2,3,0);
+
+          m->Modified();
+          result->Update();
+      } // ManualMatrix3x3
+
       vtkTransform * finalTransform;
          if (bbGetInputInverse()==false)
          {
         finalTransform = result;
          } else {
-               vtkMatrix4x4 *matrix;
-               matrix=vtkMatrix4x4::New();
-               result->GetInverse(matrix);
-               resultInverse->SetMatrix( matrix );
-               finalTransform = resultInverse;
+               vtkMatrix4x4    *matrix;
+               matrix          = vtkMatrix4x4::New();
+               result          -> GetInverse(matrix);
+               resultInverse   -> SetMatrix( matrix );
+               finalTransform  = resultInverse;
          }  // if Inverse
       
       bbSetOutputOut(finalTransform);
index da19e3f..e881160 100644 (file)
@@ -47,7 +47,8 @@ namespace bbvtk
     BBTK_DECLARE_INPUT(Translate,std::vector<double>);
     BBTK_DECLARE_INPUT(Spacing,std::vector<double>);
     BBTK_DECLARE_INPUT(RotateToNormal,std::vector<double>);
-    BBTK_DECLARE_INPUT(ManualMatrixIn,std::vector<double>);
+      BBTK_DECLARE_INPUT(ManualMatrixIn,std::vector<double>);
+      BBTK_DECLARE_INPUT(ManualMatrix3x3In,std::vector<double>);
     BBTK_DECLARE_OUTPUT(Out,vtkLinearTransform *);
     BBTK_DECLARE_OUTPUT(ManualMatrixOut,std::vector<double>);
     BBTK_PROCESS(Process);
@@ -75,6 +76,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform,bbtk::AtomicBlackBox);
   BBTK_INPUT(Transform,RotateWXYZ,"vector with Angle Vx Vy Vz",std::vector<double>,"");
   BBTK_INPUT(Transform,RotateToNormal,"(default is EMPTY) Normal vector [nx,ny,nz]",std::vector<double>,"");
   BBTK_INPUT(Transform,ManualMatrixIn,"(default EMPTY) The 16 elements of a 4x4 matrix",std::vector<double>,"");
+  BBTK_INPUT(Transform,ManualMatrix3x3In,"(default EMPTY) The 9 elements of a 3x3 matrix",std::vector<double>,"");
 
   BBTK_OUTPUT(Transform,Out,"vtkTransform result",vtkLinearTransform *,"");
   BBTK_OUTPUT(Transform,ManualMatrixOut,"The 16 elements of the 4x4 matrix",std::vector<double>,"");