From: Eduardo DAVILA Date: Tue, 7 Jun 2022 11:05:14 +0000 (+0200) Subject: #3486 PolyDataNormals box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4b18d770bbccdcc1ce913f96c7c6ee3026f930c6;p=creaVtk.git #3486 PolyDataNormals box --- diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbg b/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbg new file mode 100644 index 0000000..6b9d070 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbg @@ -0,0 +1,149 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBG BlackBox Diagram file +# - /Users/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:12 +BOX +vtk:LoadHola:Box02 +ISEXEC:FALSE +-6.576109:49.475471:-900.000000 +14.973891:46.975471:-900.000000 +FIN_BOX +BOX +vtk:MarchingCubes:Box03 +ISEXEC:FALSE +-26.237196:42.442128:-900.000000 +-4.062196:39.942128:-900.000000 +PORT +Value:"2039" +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box05 +ISEXEC:FALSE +0.914470:14.644955:-900.000000 +39.514470:12.144955:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box06 +ISEXEC:FALSE +-10.260881:2.434102:-900.000000 +16.019119:-0.065898:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box07 +ISEXEC:TRUE +3.187194:-32.073660:-900.000000 +25.947194:-34.573660:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box08 +ISEXEC:FALSE +-14.887020:-19.365229:-900.000000 +18.432980:-21.865229:-900.000000 +FIN_BOX +BOX +creaVtk:PointPicker:Box10 +ISEXEC:FALSE +6.078530:-3.138514:-900.000000 +27.773530:-5.638514:-900.000000 +PORT +TypeEvent:"2" +FIN_BOX +BOX +wx:OutputText:Box12 +ISEXEC:FALSE +15.325583:-13.231962:-900.000000 +36.995583:-15.731962:-900.000000 +PORT +Title:"Normals" +FIN_BOX +BOX +creaVtk:PolyDataNormals:Box13 +ISEXEC:FALSE +-52.167198:22.465622:-900.000000 +-29.872198:19.965622:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box14 +ISEXEC:FALSE +-7.656625:-13.888760:-900.000000 +14.013375:-16.388760:-900.000000 +PORT +Title:"Point" +FIN_BOX +BOX +creaVtk:MeshReduction_DecimatePro:Box16 +ISEXEC:FALSE +-29.102150:36.918569:-900.000000 +-5.607150:34.418569:-900.000000 +PORT +TargetReduction:"0.9" +FIN_BOX +BOX +wx:OutputText:Box17 +ISEXEC:FALSE +-31.473167:-13.592902:-900.000000 +-9.803167:-16.092902:-900.000000 +FIN_BOX +CONNECTIONS:17 +CONNECTION +Box02:Out:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box02:Out:Box05:In +NumberOfControlPoints:0 +CONNECTION +Box05:Renderer1:Box06:Renderer +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box07:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box07:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box05:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box10:Normal:Box12:In +NumberOfControlPoints:0 +CONNECTION +Box10:BoxChange:Box12:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box10:Prop3D +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box10:Point:Box14:In +NumberOfControlPoints:0 +CONNECTION +Box10:BoxChange:Box14:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box08:Widget5 +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box16:In +NumberOfControlPoints:0 +CONNECTION +Box16:Out:Box13:In +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box08:Widget7 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:Box08:Widget3 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbs b/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbs new file mode 100644 index 0000000..fc62018 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbs @@ -0,0 +1,88 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBS BlackBox Script +# - /Users/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePolyDataNormals.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include creaMaracasVisu +include wx +include creaVtk + +author "Author ??" +description "Description ??" +category "" + +new vtk:LoadHola Box02 + +new vtk:MarchingCubes Box03 + set Box03.Value "2039" + +new creaMaracasVisu:ViewerNV Box05 + +new vtk:PolyDataToActor Box06 + +new wx:LayoutSplit Box07 + set Box07.Orientation "H" + +new wx:LayoutLine Box08 + +new creaVtk:PointPicker Box10 + set Box10.TypeEvent "2" + +new wx:OutputText Box12 + set Box12.Title "Normals" + +new creaVtk:PolyDataNormals Box13 + +new wx:OutputText Box14 + set Box14.Title "Point" + +new creaVtk:MeshReduction_DecimatePro Box16 + set Box16.TargetReduction "0.9" + +new wx:OutputText Box17 + + +connect Box02.Out Box03.In + +connect Box02.Out Box05.In + +connect Box05.Renderer1 Box06.Renderer + +connect Box05.Widget Box07.Widget2 + +connect Box08.Widget Box07.Widget1 + +connect Box05.Renderer1 Box10.Renderer + +connect Box10.Normal Box12.In + +connect Box10.BoxChange Box12.BoxExecute + +connect Box06.Out Box10.Prop3D + +connect Box13.Out Box06.In + +connect Box10.Point Box14.In + +connect Box10.BoxChange Box14.BoxExecute + +connect Box14.Widget Box08.Widget5 + +connect Box03.Out Box16.In + +connect Box16.Out Box13.In + +connect Box12.Widget Box08.Widget7 + +connect Box17.Widget Box08.Widget3 + + + +# Complex input ports +exec Box07 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataNormals.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataNormals.cxx new file mode 100644 index 0000000..5db5dcb --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataNormals.cxx @@ -0,0 +1,86 @@ +//===== +// 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 "bbcreaVtkPolyDataNormals.h" +#include "bbcreaVtkPackage.h" + +#include + + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PolyDataNormals) +BBTK_BLACK_BOX_IMPLEMENTATION(PolyDataNormals,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 PolyDataNormals::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 = " <SetInputData( bbGetInputIn() ); + if (bbGetInputComputeType()==0) + { + normal->ComputeCellNormalsOn(); + } else { + normal->ComputePointNormalsOn(); + } + // normal->SetFeatureAngle(60.0); + normal->Update(); + bbSetOutputOut( normal->GetOutput() ); + } // In +} +//===== +// 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 PolyDataNormals::bbUserSetDefaultValues() +{ +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn(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 PolyDataNormals::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 PolyDataNormals::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/bbcreaVtkPolyDataNormals.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataNormals.h new file mode 100644 index 0000000..0cc7b29 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataNormals.h @@ -0,0 +1,50 @@ +//===== +// 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 __bbcreaVtkPolyDataNormals_h_INCLUDED__ +#define __bbcreaVtkPolyDataNormals_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT PolyDataNormals + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(PolyDataNormals,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(In,vtkPolyData*); + BBTK_DECLARE_INPUT(ComputeType,int); + BBTK_DECLARE_OUTPUT(Out,vtkPolyData*); + 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(PolyDataNormals,bbtk::AtomicBlackBox); + BBTK_NAME("PolyDataNormals"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(PolyDataNormals,In,"Mesh input",vtkPolyData*,""); + BBTK_INPUT(PolyDataNormals,ComputeType,"(0 default) 0:points 1:Cells",int,""); + BBTK_OUTPUT(PolyDataNormals,Out,"Mesh output",vtkPolyData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(PolyDataNormals); +//===== +// 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 // __bbcreaVtkPolyDataNormals_h_INCLUDED__ +