]> Creatis software - creaVtk.git/commitdiff
#3524 BoxWidget_tool Box vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 8 May 2024 07:35:59 +0000 (09:35 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 8 May 2024 07:35:59 +0000 (09:35 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.h [new file with mode: 0644]

diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx
new file mode 100644 (file)
index 0000000..eb3be70
--- /dev/null
@@ -0,0 +1,74 @@
+//===== 
+// 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 "bbcreaVtkBoxWidget_tool.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,BoxWidget_tool)
+BBTK_BLACK_BOX_IMPLEMENTATION(BoxWidget_tool,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 BoxWidget_tool::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 ( (bbGetInputBox_BoxWidget()!=NULL) && (bbGetInputTransform()!=NULL) )
+    {
+        bbGetInputBox_BoxWidget()->SetTransform( bbGetInputTransform() );
+    } // _BoxWidget
+}
+
+//=====
+// 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 BoxWidget_tool::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+    bbSetInputType(0);
+    bbSetInputTransform(NULL);
+    bbSetInputBox_BoxWidget(NULL);
+}
+
+//=====
+// 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 BoxWidget_tool::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 BoxWidget_tool::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+}
+
+}// EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.h b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.h
new file mode 100644 (file)
index 0000000..a3b9711
--- /dev/null
@@ -0,0 +1,53 @@
+//===== 
+// 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 __bbcreaVtkBoxWidget_tool_h_INCLUDED__
+#define __bbcreaVtkBoxWidget_tool_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkLinearTransform.h"
+#include "bbcreaVtkBoxWidget.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT BoxWidget_tool
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(BoxWidget_tool,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(Type,int);
+    BBTK_DECLARE_INPUT(Transform,vtkLinearTransform*);
+    BBTK_DECLARE_INPUT(Param01,std::vector<double>);
+    BBTK_DECLARE_INPUT(Param02,std::vector<double>);
+    BBTK_DECLARE_INPUT(Box_BoxWidget,BoxWidget*);
+    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(BoxWidget_tool,bbtk::AtomicBlackBox);
+  BBTK_NAME("BoxWidget_tool");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(BoxWidget_tool,Type,"(default 0) 0:Nothing  1:SetTransform",int,"");
+  BBTK_INPUT(BoxWidget_tool,Transform,"vtkTransform",vtkLinearTransform*,"");
+  BBTK_INPUT(BoxWidget_tool,Param01,"",std::vector<double>,"");
+  BBTK_INPUT(BoxWidget_tool,Box_BoxWidget,"bbtk Box BoxWidget",BoxWidget*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(BoxWidget_tool);
+//===== 
+// 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 bbcreaVtk
+
+#endif // __bbcreaVtkBoxWidget_tool_h_INCLUDED__
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.cxx
new file mode 100644 (file)
index 0000000..e4b71bb
--- /dev/null
@@ -0,0 +1,129 @@
+//===== 
+// 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 "bbcreaVtkPlanes_ImplicitFunction.h"
+#include "bbcreaVtkPackage.h"
+
+#include <vtkPlane.h>
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Planes_ImplicitFunction)
+BBTK_BLACK_BOX_IMPLEMENTATION(Planes_ImplicitFunction,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 Planes_ImplicitFunction::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( bbGetInputType() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+    printf("EED Planes_ImplicitFunction::Process Start \n");
+
+    if (bbGetInputPlanes()!=NULL)
+    {
+        printf("EED Planes_ImplicitFunction::Process Flag 01 \n");
+        int i,size;
+        vtkPlane* p;
+        double tmpDouble[3];
+        std::vector<double> lstPoints;
+        std::vector<double> lstNormals;
+        size = bbGetInputPlanes()->GetNumberOfPlanes();
+
+        
+        if (bbGetInputType()==1)
+        {
+            std::vector<double> points = bbGetInputPointsIn();
+            std::vector<double> normals = bbGetInputNormalsIn();
+            printf("EED Planes_ImplicitFunction::Process size %d     size %d \n",points.size() , normals.size() );
+            if ((points.size() % 3==0) && (normals.size() % 3==0))
+            {
+                for (i=0;i<size;i++)
+                {
+                    p = bbGetInputPlanes()->GetPlane(i);
+                    tmpDouble[0] = points[i*3+0] ;
+                    tmpDouble[1] = points[i*3+1] ;
+                    tmpDouble[2] = points[i*3+2] ;
+                    p->SetOrigin(tmpDouble);
+                    tmpDouble[0] = normals[i*3+0] ;
+                    tmpDouble[1] = normals[i*3+1] ;
+                    tmpDouble[2] = normals[i*3+2] ;
+                    p->SetNormal(tmpDouble);
+                    p->Modified();
+                    printf("EED Planes_ImplicitFunction::Process normals %f %f %f \n", tmpDouble[0], tmpDouble[1], tmpDouble[2]);
+                } // for i
+            }
+        } // Type ==1
+        
+        if (bbGetInputType()==2)
+        {
+            for (i=0;i<size;i++)
+            {
+                p = bbGetInputPlanes()->GetPlane(i);
+                lstPoints.push_back( p->GetOrigin()[0] );
+                lstPoints.push_back( p->GetOrigin()[1] );
+                lstPoints.push_back( p->GetOrigin()[2] );
+                lstNormals.push_back( p->GetNormal()[0] );
+                lstNormals.push_back( p->GetNormal()[1] );
+                lstNormals.push_back( p->GetNormal()[2] );
+            } // for i
+            bbSetOutputPointsOut(lstPoints);
+            bbSetOutputNormalsOut(lstNormals);
+        } // Type ==2
+    }// Planes
+    printf("EED Planes_ImplicitFunction::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)
+//===== 
+void Planes_ImplicitFunction::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+    bbSetInputType(0);
+    bbSetInputPlanes(NULL);
+
+}
+//===== 
+// 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 Planes_ImplicitFunction::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 Planes_ImplicitFunction::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaVtk
+
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.h
new file mode 100644 (file)
index 0000000..7331e9e
--- /dev/null
@@ -0,0 +1,56 @@
+//===== 
+// 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 __bbcreaVtkPlanes_ImplicitFunction_h_INCLUDED__
+#define __bbcreaVtkPlanes_ImplicitFunction_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkPlanes.h>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT Planes_ImplicitFunction
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(Planes_ImplicitFunction,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(PointsIn,std::vector<double>);
+    BBTK_DECLARE_INPUT(NormalsIn,std::vector<double>);
+    BBTK_DECLARE_INPUT(Type,int);
+    BBTK_DECLARE_INPUT(Planes,vtkPlanes*);
+    BBTK_DECLARE_OUTPUT(PointsOut,std::vector<double>);
+    BBTK_DECLARE_OUTPUT(NormalsOut,std::vector<double>);
+    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(Planes_ImplicitFunction,bbtk::AtomicBlackBox);
+  BBTK_NAME("Planes_ImplicitFunction");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(Planes_ImplicitFunction,PointsIn,"[px1,py1,py1 , px2,py2,pz2,....]",std::vector<double>,"");
+  BBTK_INPUT(Planes_ImplicitFunction,NormalsIn,"[nx1,ny1,ny1 , nx2,ny2,nz2,....]",std::vector<double>,"");
+  BBTK_INPUT(Planes_ImplicitFunction,Type,"(default 0) 0:Nothing 1:Set 2:Get]",int,"");
+  BBTK_INPUT(Planes_ImplicitFunction,Planes,"vtkPlanes (Implicit Function)",vtkPlanes*,"");
+  BBTK_OUTPUT(Planes_ImplicitFunction,PointsOut,"[px1,py1,py1 , px2,py2,pz2,....]",std::vector<double>,"");
+  BBTK_OUTPUT(Planes_ImplicitFunction,NormalsOut,"[px1,py1,py1 , px2,py2,pz2,....]",std::vector<double>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(Planes_ImplicitFunction);
+//===== 
+// 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 bbcreaVtk
+
+#endif // __bbcreaVtkPlanes_ImplicitFunction_h_INCLUDED__
+