From: Eduardo DAVILA Date: Wed, 7 Jul 2021 06:16:31 +0000 (+0200) Subject: #3465 cutter box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f18b2d452b8c1450396555dd5994def4b79b47e1;p=creaVtk.git #3465 cutter box --- diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbg new file mode 100644 index 0000000..fd6b66d --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbg @@ -0,0 +1,141 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:10 +BOX +creaVtk:Cutter:Box00 +ISEXEC:FALSE +-226.539144:46.310533:-900.000000 +-194.339144:36.310533:-900.000000 +FIN_BOX +BOX +vtk:SphereSource:Box01 +ISEXEC:FALSE +-177.440184:69.250364:-900.000000 +-137.615184:59.250364:-900.000000 +PORT +CenterX:"0" +PORT +CenterY:"0" +PORT +CenterZ:"0" +PORT +PhiResolution:"15" +PORT +Radius:"40" +PORT +ThetaResolution:"15" +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box02 +ISEXEC:FALSE +31.452292:22.917500:-900.000000 +95.172292:12.917500:-900.000000 +FIN_BOX +BOX +vtk:LoadHola:Box03 +ISEXEC:FALSE +67.171981:67.171981:-900.000000 +102.721981:57.171981:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box04 +ISEXEC:FALSE +-147.306444:-1.305431:-900.000000 +-102.066444:-11.305431:-900.000000 +PORT +Colour:"1 0 0" +PORT +Opacity:"1" +PORT +Representation:"1" +FIN_BOX +BOX +wx:LayoutSplit:Box05 +ISEXEC:TRUE +-28.011797:-111.715695:-900.000000 +11.068203:-121.715695:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box07 +ISEXEC:FALSE +-135.789124:-72.766127:-900.000000 +-78.229124:-82.766127:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box09 +ISEXEC:FALSE +-74.693411:-18.608435:-900.000000 +-29.453411:-28.608435:-900.000000 +PORT +Opacity:"0.2" +PORT +Representation:"2" +FIN_BOX +BOX +vtk:UpdateRender:Box13 +ISEXEC:FALSE +-64.894456:-60.049950:-900.000000 +-24.569456:-70.049950:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +wx:CommandButton:Box15 +ISEXEC:FALSE +-77.543946:52.017647:-900.000000 +-34.768946:42.017647:-900.000000 +PORT +Label:"Refresh" +FIN_BOX +CONNECTIONS:13 +CONNECTION +Box03:Out:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out:Box04:In +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box04:Renderer +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box07:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box09:Renderer +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box13:Renderer +NumberOfControlPoints:0 +CONNECTION +Box15:BoxChange:Box04:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box15:Widget:Box07:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:BoxChange:Box09:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box13:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box01:Out:Box00:In +NumberOfControlPoints:0 +CONNECTION +Box01:Out:Box09:In +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbs new file mode 100644 index 0000000..e69385a --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbs @@ -0,0 +1,84 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleCutter.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include vtk +include creaMaracasVisu +include wx + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:Cutter Box00 + +new vtk:SphereSource Box01 + set Box01.CenterX "0" + set Box01.CenterY "0" + set Box01.CenterZ "0" + set Box01.PhiResolution "15" + set Box01.Radius "40" + set Box01.ThetaResolution "15" + +new creaMaracasVisu:ViewerNV Box02 + +new vtk:LoadHola Box03 + +new vtk:PolyDataToActor Box04 + set Box04.Colour "1 0 0" + set Box04.Opacity "1" + set Box04.Representation "1" + +new wx:LayoutSplit Box05 + set Box05.Orientation "H" + +new wx:LayoutLine Box07 + +new vtk:PolyDataToActor Box09 + set Box09.Opacity "0.2" + set Box09.Representation "2" + +new vtk:UpdateRender Box13 + set Box13.Active "true" + +new wx:CommandButton Box15 + set Box15.Label "Refresh" + + +connect Box03.Out Box02.In + +connect Box00.Out Box04.In + +connect Box02.Renderer1 Box04.Renderer + +connect Box02.Widget Box05.Widget2 + +connect Box07.Widget Box05.Widget1 + +connect Box02.Renderer1 Box09.Renderer + +connect Box02.Renderer1 Box13.Renderer + +connect Box15.BoxChange Box04.BoxExecute + +connect Box15.Widget Box07.Widget2 + +connect Box04.BoxChange Box09.BoxExecute + +connect Box09.BoxChange Box13.BoxExecute + +connect Box01.Out Box00.In + +connect Box01.Out Box09.In + + + +# Complex input ports +exec Box05 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx new file mode 100644 index 0000000..2b7c9ae --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx @@ -0,0 +1,107 @@ +//===== +// 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 "bbcreaVtkCutter.h" +#include "bbcreaVtkPackage.h" +#include "vtkCutter.h" +#include "vtkStripper.h" +#include "vtkPlane.h" +# +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Cutter) +BBTK_BLACK_BOX_IMPLEMENTATION(Cutter,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 Cutter::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 = " <SetOrigin(0,0,30); + plane->SetNormal(0,0,1); + + cutter = vtkCutter::New(); + cutter->SetInputData( bbGetInputIn() ); + cutter->SetCutFunction( plane ); + cutter->Update(); + + strips = vtkStripper::New(); + strips->SetInputData( cutter->GetOutput() ); + strips->Update(); + poly = vtkPolyData::New(); + poly->SetPoints( strips->GetOutput()->GetPoints() ); + poly->SetPolys( strips->GetOutput()->GetLines() ); + + bbSetOutputOut( poly ); +// bbSetOutputOut( cutter->GetOutput() ); + + +} +//===== +// 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 Cutter::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 Cutter::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 Cutter::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/bbcreaVtkCutter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.h new file mode 100644 index 0000000..ac83216 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.h @@ -0,0 +1,49 @@ +//===== +// 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 __bbcreaVtkCutter_h_INCLUDED__ +#define __bbcreaVtkCutter_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" +#include "vtkPolyData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT Cutter + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(Cutter,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_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(Cutter,bbtk::AtomicBlackBox); + BBTK_NAME("Cutter"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("vtkCutter"); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(Cutter,In,"vtkPolyData input",vtkPolyData*,""); + + BBTK_OUTPUT(Cutter,Out,"vtkPolyData output",vtkPolyData*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(Cutter); +//===== +// 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 // __bbcreaVtkCutter_h_INCLUDED__ +