From 3f73d57c9c7fb9847a1f99bb1145e2b98433567a Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Wed, 8 May 2024 09:35:59 +0200 Subject: [PATCH] #3524 BoxWidget_tool Box --- .../src/bbcreaVtkBoxWidget_tool.cxx | 74 ++++++++++ .../src/bbcreaVtkBoxWidget_tool.h | 53 +++++++ .../src/bbcreaVtkPlanes_ImplicitFunction.cxx | 129 ++++++++++++++++++ .../src/bbcreaVtkPlanes_ImplicitFunction.h | 56 ++++++++ 4 files changed, 312 insertions(+) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.h diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx new file mode 100644 index 0000000..eb3be70 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.cxx @@ -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 = " <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 index 0000000..a3b9711 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget_tool.h @@ -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); + BBTK_DECLARE_INPUT(Param02,std::vector); + 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,""); + 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 index 0000000..e4b71bb --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.cxx @@ -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 + +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 = " < lstPoints; + std::vector lstNormals; + size = bbGetInputPlanes()->GetNumberOfPlanes(); + + + if (bbGetInputType()==1) + { + std::vector points = bbGetInputPointsIn(); + std::vector 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;iGetPlane(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;iGetPlane(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 index 0000000..7331e9e --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlanes_ImplicitFunction.h @@ -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 + +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); + BBTK_DECLARE_INPUT(NormalsIn,std::vector); + BBTK_DECLARE_INPUT(Type,int); + BBTK_DECLARE_INPUT(Planes,vtkPlanes*); + BBTK_DECLARE_OUTPUT(PointsOut,std::vector); + BBTK_DECLARE_OUTPUT(NormalsOut,std::vector); + 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,""); + BBTK_INPUT(Planes_ImplicitFunction,NormalsIn,"[nx1,ny1,ny1 , nx2,ny2,nz2,....]",std::vector,""); + 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,""); + BBTK_OUTPUT(Planes_ImplicitFunction,NormalsOut,"[px1,py1,py1 , px2,py2,pz2,....]",std::vector,""); +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__ + -- 2.45.1