]> Creatis software - bbtk.git/commitdiff
#3537 Add box AddRendererToVector
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 22 Jul 2025 15:21:19 +0000 (17:21 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 22 Jul 2025 15:21:19 +0000 (17:21 +0200)
packages/std/src/bbstdVectorFilterDouble.h
packages/vtk/src/bbvtkAddImageToVector.cxx
packages/vtk/src/bbvtkAddRendererToVector.cxx [new file with mode: 0644]
packages/vtk/src/bbvtkAddRendererToVector.h [new file with mode: 0644]
packages/vtk/src/bbvtkGetVectorElement.cxx
packages/vtk/src/bbvtkGetVectorElement.h

index 9595be2df346050be5b318134386d422ea5a1dd8..64604c0527edf9dd5dfb60c974af6b707d2c9813 100644 (file)
@@ -52,7 +52,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterDouble,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ  (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k1=2 xz , 16 switch In0 and In1 (k1=1 nothing k0 swhich)",int,"");
+  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 (or the index k1 if exist) , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ  (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k1=2 xz , 16 switch In0 and In1 (k1=0 nothing, k1=1 swhich)",int,"");
   BBTK_INPUT(VectorFilterDouble,k1,"(default [0])  nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6),  k1[0] In0..9 element base to be order (Type 8)  , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11),  k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) , direction (type 15), direction (type 16) ",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
index 450fa0e583b2594bf40e2b8ad494fa4751ca0e53..70f41ef5eca12df835ae6f5e24e9f9df3866705b 100644 (file)
@@ -14,7 +14,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(AddImageToVector,bbtk::AtomicBlackBox);
 //===== 
 void AddImageToVector::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -42,12 +41,12 @@ void AddImageToVector::Process()
    if (bbGetInputIn9()!=NULL) { lstImages.push_back( bbGetInputIn9() ); }
    bbSetOutputOut(lstImages);  
 }
-//===== 
+
+//=====
 // 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 AddImageToVector::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
    bbSetInputIn0(NULL);
@@ -63,32 +62,29 @@ void AddImageToVector::bbUserSetDefaultValues()
    std::vector<vtkImageData*> lstImages;
    bbSetInputImageVector(lstImages);  
 }
-//===== 
+
+//=====
 // 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 AddImageToVector::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    if any
 }
-//===== 
+
+//=====
 // 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 AddImageToVector::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbvtk
+
+} // EO namespace bbvtk
 
 
diff --git a/packages/vtk/src/bbvtkAddRendererToVector.cxx b/packages/vtk/src/bbvtkAddRendererToVector.cxx
new file mode 100644 (file)
index 0000000..30c4e18
--- /dev/null
@@ -0,0 +1,90 @@
+//===== 
+// 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 "bbvtkAddRendererToVector.h"
+#include "bbvtkPackage.h"
+
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,AddRendererToVector)
+BBTK_BLACK_BOX_IMPLEMENTATION(AddRendererToVector,bbtk::AtomicBlackBox);
+//===== 
+// 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 AddRendererToVector::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;
+   std::vector<vtkRenderer*> lstRenderer=bbGetInputRendererVector();
+   if (bbGetInputIn0()!=NULL) { lstRenderer.push_back( bbGetInputIn0() ); }
+   if (bbGetInputIn1()!=NULL) { lstRenderer.push_back( bbGetInputIn1() ); }
+   if (bbGetInputIn2()!=NULL) { lstRenderer.push_back( bbGetInputIn2() ); }
+   if (bbGetInputIn3()!=NULL) { lstRenderer.push_back( bbGetInputIn3() ); }
+   if (bbGetInputIn4()!=NULL) { lstRenderer.push_back( bbGetInputIn4() ); }
+   if (bbGetInputIn5()!=NULL) { lstRenderer.push_back( bbGetInputIn5() ); }
+   if (bbGetInputIn6()!=NULL) { lstRenderer.push_back( bbGetInputIn6() ); }
+   if (bbGetInputIn7()!=NULL) { lstRenderer.push_back( bbGetInputIn7() ); }
+   if (bbGetInputIn8()!=NULL) { lstRenderer.push_back( bbGetInputIn8() ); }
+   if (bbGetInputIn9()!=NULL) { lstRenderer.push_back( bbGetInputIn9() ); }
+   bbSetOutputOut(lstRenderer);  
+}
+
+//=====
+// 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 AddRendererToVector::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn0(NULL);
+   bbSetInputIn1(NULL);
+   bbSetInputIn2(NULL);
+   bbSetInputIn3(NULL);
+   bbSetInputIn4(NULL);
+   bbSetInputIn5(NULL);
+   bbSetInputIn6(NULL);
+   bbSetInputIn7(NULL);
+   bbSetInputIn8(NULL);
+   bbSetInputIn9(NULL);
+   std::vector<vtkRenderer*> lstRenderer;
+   bbSetInputRendererVector(lstRenderer);
+}
+
+//=====
+// 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 AddRendererToVector::bbUserInitializeProcessing()
+{
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any
+}
+
+//=====
+// 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 AddRendererToVector::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+}
+
+} // EO namespace bbvtk
+
+
diff --git a/packages/vtk/src/bbvtkAddRendererToVector.h b/packages/vtk/src/bbvtkAddRendererToVector.h
new file mode 100644 (file)
index 0000000..0532ed6
--- /dev/null
@@ -0,0 +1,67 @@
+//===== 
+// 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)
+//===== 
+#ifndef __bbvtkAddRendererToVector_h_INCLUDED__
+#define __bbvtkAddRendererToVector_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkRenderer.h"
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT AddRendererToVector
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(AddRendererToVector,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+  BBTK_DECLARE_INPUT(RendererVector,std::vector<vtkRenderer*>);
+  BBTK_DECLARE_INPUT(In0,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In1,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In2,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In3,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In4,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In5,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In6,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In7,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In8,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In9,vtkRenderer*);
+  BBTK_DECLARE_OUTPUT(Out,std::vector<vtkRenderer*>);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// 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)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(AddRendererToVector,bbtk::AtomicBlackBox);
+BBTK_NAME("AddRendererToVector");
+BBTK_AUTHOR("Info-Dev");
+BBTK_DESCRIPTION("eduardo.davila@creatis.insa-lyon.fr - Concat at the end of the ImageVector all the inputs. Add vtkRenderer* to a vector fo vtkRenderer*");
+BBTK_CATEGORY("void");
+BBTK_INPUT(AddRendererToVector,RendererVector,"Vector of vtkImagesData*",std::vector<vtkRenderer*>,"");
+BBTK_INPUT(AddRendererToVector,In0,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In1,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In2,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In3,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In4,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In5,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In6,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In7,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In8,"Input image 1",vtkRenderer*,"");
+BBTK_INPUT(AddRendererToVector,In9,"Input image 1",vtkRenderer*,"");
+BBTK_OUTPUT(AddRendererToVector,Out,"Vector of vtkRenderer*",std::vector<vtkRenderer*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(AddRendererToVector);
+//===== 
+// 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)
+//===== 
+}
+// EO namespace bbvtk
+
+#endif // __bbvtkAddRendererToVector_h_INCLUDED__
+
index 818e5e756745ea9b5c241c52a2637e84be50e0f0..9a43bfb6b9221f00c7670210da38cb19cb41b6db 100644 (file)
@@ -51,6 +51,7 @@ namespace bbvtk
 
 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(vtk,GetVectorElement,ptrvtkImageData);
 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(vtk,GetVectorElement,ptrvtkPolyData);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(vtk,GetVectorElement,ptrvtkRenderer);
 
 //====================================================================
 
index 6a766dc4a85efdc9003d536f1b9473eed3f68602..47746ba2f070c31f88d3f17435d5c606eb9119eb 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "vtkImageData.h"
 #include "vtkPolyData.h"
+#include "vtkRenderer.h"
 
 namespace bbvtk
 {
@@ -61,7 +62,8 @@ namespace bbvtk
 
 
   typedef vtkImageData* ptrvtkImageData;
-  typedef vtkPolyData* ptrvtkPolyData;
+  typedef vtkPolyData*  ptrvtkPolyData;
+  typedef vtkRenderer*  ptrvtkRenderer;
 
 //  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME( ptrvtkImageData ,"PtrvtkImageData");
 //  BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME( ptrvtkPolyData ,"PtrvtkPolyData");
@@ -73,9 +75,10 @@ namespace bbvtk
   BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement,bbtk::AtomicBlackBox);
 
   std::string humantypename;
-  if (bbtk::HumanTypeName<T>()==bbtk::HumanTypeName<vtkPolyData*>()) { humantypename="VtkPolyData"; }
+  if (bbtk::HumanTypeName<T>()==bbtk::HumanTypeName<vtkPolyData*>())  { humantypename="VtkPolyData";  }
   if (bbtk::HumanTypeName<T>()==bbtk::HumanTypeName<vtkImageData*>()) { humantypename="VtkImageData"; }
-  
+  if (bbtk::HumanTypeName<T>()==bbtk::HumanTypeName<vtkRenderer*>())  { humantypename="VtkRenderer";  }
+
   BBTK_NAME("GetVector"+humantypename+"Element");
 
 //  BBTK_NAME("GetVector"+bbtk::HumanTypeName<T>()+"Element");