From b81fa7f4bcfbeb48a57772b98d6b976b6cc133c1 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 3 Jul 2019 16:26:29 +0200 Subject: [PATCH] #3270 creaVtk Feature New Normal - PolyDataToImageData Box --- .../bbs/boxes/VectorsExploration_Widget.bbg | 42 +++--- .../bbs/boxes/VectorsExploration_Widget.bbs | 2 +- .../bbs/boxes/VolumeVectorVisu_Interface.bbg | 78 +++++++--- .../bbs/boxes/VolumeVectorVisu_Interface.bbs | 35 +++-- .../bbs/boxes/VolumeVectorVisu_Widget.bbg | 62 +++++--- .../bbs/boxes/VolumeVectorVisu_Widget.bbs | 24 ++- .../src/bbcreaVtkCreateMeshFromPoints.cxx | 6 +- .../src/bbcreaVtkPolyDataToImageData.cxx | 140 ++++++++++++++++++ .../src/bbcreaVtkPolyDataToImageData.h | 51 +++++++ 9 files changed, 356 insertions(+), 84 deletions(-) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.h diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg index 300ebb8..c641119 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbg # ---------------------------------- APP_START @@ -13,77 +13,77 @@ PACKAGENAME:creaVtk COMPLEXOUTPUTS:1 COMPLEX_PORT widget --179.941974:-67.018786:-900.000000 +-64.794419:-71.354886:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:3 COMPLEX_PORT vtkImageData_vectors --219.680681:113.036929:-900.000000 +-134.404040:115.927663:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT vtkRenderer --81.265493:115.039904:-900.000000 +-3.697475:117.448849:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Title --130.329765:114.918814:-900.000000 +-54.207113:115.882392:-900.000000 FIN_COMPLEX_PORT BOXES:8 BOX vtk:UpdateRender:Box22 ISEXEC:FALSE --109.905905:-14.897333:-900.000000 --69.580905:-24.897333:-900.000000 +71.246734:-19.233433:-900.000000 +111.571734:-29.233433:-900.000000 PORT Active:"true" FIN_BOX BOX wx:LayoutTab:Box17 ISEXEC:FALSE --184.622210:-20.410541:-900.000000 --84.013417:-30.410541:-900.000000 +-117.596676:-21.541034:-900.000000 +-60.036676:-31.541034:-900.000000 PORT WinTitle:"VectorsTensors Analysis" FIN_BOX BOX std:MultipleInputs:Box23 ISEXEC:FALSE --151.066256:11.353972:-900.000000 --95.654261:1.353972:-900.000000 +-57.932570:7.880653:-900.000000 +-18.232570:-2.119347:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX BOX creaVtk:PlaneVectorVisu_Widget:Box41 ISEXEC:FALSE --268.440972:51.457315:-900.000000 --157.542180:41.457315:-900.000000 +-147.291399:48.531904:-900.000000 +-97.341399:38.531904:-900.000000 FIN_BOX BOX wx:LayoutLine:Box14 ISEXEC:FALSE --232.798631:5.736817:-900.000000 --98.441282:-4.263183:-900.000000 +-144.819902:7.714371:-900.000000 +-87.259902:-2.285629:-900.000000 PORT WinTitle:"Field" FIN_BOX BOX creaVtk:VolumeVectorVisu_Widget:Box18 ISEXEC:FALSE --187.068807:50.505798:-900.000000 --133.195159:40.505798:-900.000000 +-52.700093:49.576898:-900.000000 +-0.650093:39.576898:-900.000000 FIN_BOX BOX vtk:vtkImageDataPointerRelay:Box26 ISEXEC:FALSE --226.504734:87.499150:-900.000000 --142.837799:77.499150:-900.000000 +-159.536072:87.017361:-900.000000 +-107.361072:77.017361:-900.000000 FIN_BOX BOX std:MagicBox:Box28 ISEXEC:FALSE --94.829944:83.888857:-900.000000 --58.754944:73.888857:-900.000000 +-21.330778:79.918028:-900.000000 +14.744222:69.918028:-900.000000 FIN_BOX CONNECTIONS:16 CONNECTION diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs index 9e27405..a518fcb 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) -# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Widget.bbs # ---------------------------------- include std diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg index db07e89..60c5cf0 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg # ---------------------------------- APP_START @@ -10,33 +10,37 @@ AUTHOR:Author ?? COMPLEXBOX:TRUE COMPLEXBOXNAME:VolumeVectorVisu_Interface PACKAGENAME:creaVtk -COMPLEXOUTPUTS:6 +COMPLEXOUTPUTS:7 COMPLEX_PORT boxChange --55.620936:-52.838253:-900.000000 +-52.001184:-76.860241:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT widget --7.184086:-56.055226:-900.000000 +23.090200:-76.457462:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT AcitiveVector -80.231895:-54.018263:-900.000000 +81.877237:-75.736772:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Opacity -102.436951:-54.580138:-900.000000 +107.702044:-78.602126:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT ScaleFactor -161.011397:-55.687721:-900.000000 +166.276490:-73.457411:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Ratio -91.228359:-50.583288:-900.000000 FIN_COMPLEX_PORT +COMPLEX_PORT +form +213.982353:-74.143348:-900.000000 +FIN_COMPLEX_PORT COMPLEXINPUTS:0 -BOXES:9 +BOXES:11 BOX wx:Slider:Box00 ISEXEC:FALSE @@ -58,30 +62,30 @@ FIN_BOX BOX std:MultipleInputs:Box02 ISEXEC:FALSE --57.320437:18.206815:-900.000000 --11.745437:8.206815:-900.000000 +-32.311244:15.574268:-900.000000 +7.388756:5.574268:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX BOX wx:LayoutLine:Box03 ISEXEC:FALSE --4.139184:17.027492:-900.000000 -53.420816:7.027492:-900.000000 +62.861204:-17.338021:-900.000000 +120.421204:-27.338021:-900.000000 PORT WinTitle:"Volume flield" FIN_BOX BOX wx:LayoutTab:Box04 ISEXEC:FALSE --10.200778:-7.513801:-900.000000 -47.359222:-17.513801:-900.000000 +6.581707:-36.142745:-900.000000 +64.141707:-46.142745:-900.000000 FIN_BOX BOX wx:CheckBox:Box05 ISEXEC:FALSE 40.200879:64.505359:-900.000000 -85.775879:54.505359:-900.000000 +76.525879:54.505359:-900.000000 PORT ReactiveOnKeystroke:"true" PORT @@ -109,7 +113,7 @@ BOX std:Div:Box07 ISEXEC:FALSE 97.629121:16.000693:-900.000000 -130.404121:6.000693:-900.000000 +126.954121:6.000693:-900.000000 PORT In2:"100.0" FIN_BOX @@ -125,7 +129,7 @@ In:"100" PORT Label:"true" PORT -Max:"500000" +Max:"5000" PORT Min:"1" PORT @@ -137,11 +141,29 @@ BOX std:Div:Box09 ISEXEC:FALSE 158.956759:16.879927:-900.000000 -191.731759:6.879927:-900.000000 +188.281759:6.879927:-900.000000 PORT In2:"100.0" FIN_BOX -CONNECTIONS:18 +BOX +wx:ComboBox:Box10 +ISEXEC:FALSE +217.700945:62.835923:-900.000000 +259.860945:52.835923:-900.000000 +PORT +In:"Line Arrow" +PORT +Title:"Form" +FIN_BOX +BOX +wx:LayoutLine:Box11 +ISEXEC:FALSE +170.175144:40.547736:-900.000000 +227.735144:30.547736:-900.000000 +PORT +Orientation:"H" +FIN_BOX +CONNECTIONS:22 CONNECTION Box00:BoxChange:Box02:In1 NumberOfControlPoints:0 @@ -179,9 +201,6 @@ CONNECTION Box08:BoxChange:Box02:In5 NumberOfControlPoints:0 CONNECTION -Box08:Widget:Box03:Widget5 -NumberOfControlPoints:0 -CONNECTION Box05:Out:AcitiveVector:AcitiveVector NumberOfControlPoints:0 CONNECTION @@ -196,4 +215,19 @@ NumberOfControlPoints:0 CONNECTION Box02:BoxChange:Box04:BoxExecute NumberOfControlPoints:0 +CONNECTION +Box10:Out:form:form +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box11:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box10:Widget:Box11:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box11:Widget:Box03:Widget5 +NumberOfControlPoints:0 +CONNECTION +Box10:BoxChange:Box02:In6 +NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs index 914eb27..eee2eb6 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) -# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs # ---------------------------------- include std @@ -15,7 +15,7 @@ description "Description ??" category "" -new Slider Box00 +new wx:Slider Box00 set Box00.In "30" set Box00.Label "true" set Box00.Max "1000" @@ -23,19 +23,19 @@ new Slider Box00 set Box00.ReactiveOnTrack "true" set Box00.Title "Ratio" -new MultipleInputs Box02 +new std:MultipleInputs Box02 set Box02.BoxProcessMode "Reactive" -new LayoutLine Box03 +new wx:LayoutLine Box03 set Box03.WinTitle "Volume flield" -new LayoutTab Box04 +new wx:LayoutTab Box04 -new CheckBox Box05 +new wx:CheckBox Box05 set Box05.ReactiveOnKeystroke "true" set Box05.Title "Active Vectors" -new Slider Box06 +new wx:Slider Box06 set Box06.In "100" set Box06.Label "true" set Box06.Max "100" @@ -43,21 +43,28 @@ new Slider Box06 set Box06.ReactiveOnTrack "true" set Box06.Title "Opacity" -new Div Box07 +new std:Div Box07 set Box07.In2 "100.0" -new Slider Box08 +new wx:Slider Box08 set Box08.ChangeResolution "true" set Box08.In "100" set Box08.Label "true" - set Box08.Max "500000" + set Box08.Max "5000" set Box08.Min "1" set Box08.ReactiveOnTrack "true" set Box08.Title "Scale Factor" -new Div Box09 +new std:Div Box09 set Box09.In2 "100.0" +new wx:ComboBox Box10 + set Box10.In "Line Arrow" + set Box10.Title "Form" + +new wx:LayoutLine Box11 + set Box11.Orientation "H" + connect Box00.BoxChange Box02.In1 connect Box00.Widget Box03.Widget2 @@ -69,8 +76,11 @@ connect Box06.Out Box07.In1 connect Box08.Out Box09.In1 connect Box06.BoxChange Box02.In4 connect Box08.BoxChange Box02.In5 -connect Box08.Widget Box03.Widget5 connect Box02.BoxChange Box04.BoxExecute +connect Box08.Widget Box11.Widget1 +connect Box10.Widget Box11.Widget2 +connect Box11.Widget Box03.Widget5 +connect Box10.BoxChange Box02.In6 # Complex input ports @@ -81,6 +91,7 @@ output AcitiveVector Box05.Out " " output Opacity Box07.Out " " output ScaleFactor Box09.Out " " output Ratio Box00.Out " " +output form Box10.Out " " endefine diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg index 5e24740..3efda85 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg # ---------------------------------- APP_START @@ -28,46 +28,52 @@ COMPLEX_PORT renderer -102.399936:88.482773:-900.000000 FIN_COMPLEX_PORT -BOXES:5 +BOXES:7 BOX creaVtk:VectorsVisu:Box00 ISEXEC:FALSE --34.809942:-4.756125:-900.000000 -10.765058:-14.756125:-900.000000 +-7.861447:-26.759942:-900.000000 +29.763553:-36.759942:-900.000000 FIN_BOX BOX vtk:MaskPoint:Box07 ISEXEC:FALSE --33.632255:27.751669:-900.000000 -11.942745:17.751669:-900.000000 +-62.558622:31.954645:-900.000000 +-26.408622:21.954645:-900.000000 FIN_BOX BOX creaVtk:VolumeVectorVisu_Interface:Box02 ISEXEC:FALSE -46.516412:57.888962:-900.000000 -117.691412:47.888962:-900.000000 +50.966622:84.837457:-900.000000 +104.916622:74.837457:-900.000000 FIN_BOX BOX vtk:UpdateRender:Box03 ISEXEC:FALSE --16.726909:-47.773066:-900.000000 -28.848091:-57.773066:-900.000000 +6.265844:-73.238158:-900.000000 +46.590844:-83.238158:-900.000000 PORT Active:"true" FIN_BOX BOX std:MagicBox:Box04 ISEXEC:FALSE --109.738661:31.553033:-900.000000 --64.163661:21.553033:-900.000000 +-119.133549:39.464518:-900.000000 +-83.058549:29.464518:-900.000000 FIN_BOX -CONNECTIONS:14 -CONNECTION -Box07:Out:Box00:In -NumberOfControlPoints:0 -CONNECTION -vtkImageData:vtkImageData:Box07:In -NumberOfControlPoints:0 +BOX +vtk:ProbeFilter:Box05 +ISEXEC:FALSE +-22.745519:24.352539:-900.000000 +13.654481:14.352539:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box06 +ISEXEC:FALSE +-30.904238:69.101876:-900.000000 +5.170762:59.101876:-900.000000 +FIN_BOX +CONNECTIONS:18 CONNECTION Box02:AcitiveVector:Box00:Active NumberOfControlPoints:0 @@ -104,4 +110,22 @@ NumberOfControlPoints:0 CONNECTION Box02:boxChange:Box03:BoxExecute NumberOfControlPoints:0 +CONNECTION +Box02:form:Box00:TypeForm +NumberOfControlPoints:0 +CONNECTION +vtkImageData:vtkImageData:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box07:In +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box05:Input +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box05:Source +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box00:In +NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs index 8e4a0ba..c50b422 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) -# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs # ---------------------------------- include std @@ -16,19 +16,22 @@ description "Description ??" category "" -new VectorsVisu Box00 +new creaVtk:VectorsVisu Box00 -new MaskPoint Box07 +new vtk:MaskPoint Box07 -new VolumeVectorVisu_Interface Box02 +new creaVtk:VolumeVectorVisu_Interface Box02 -new UpdateRender Box03 +new vtk:UpdateRender Box03 set Box03.Active "true" -new MagicBox Box04 +new std:MagicBox Box04 + +new vtk:ProbeFilter Box05 + +new std:MagicBox Box06 -connect Box07.Out Box00.In connect Box02.AcitiveVector Box00.Active connect Box02.Opacity Box00.Opacity connect Box02.Ratio Box07.Ratio @@ -38,10 +41,15 @@ connect Box02.boxChange Box00.BoxExecute connect Box04.Out Box00.Renderer connect Box04.Out Box03.Renderer connect Box02.boxChange Box03.BoxExecute +connect Box02.form Box00.TypeForm +connect Box06.Out Box07.In +connect Box06.Out Box05.Input +connect Box06.Out Box05.Source +connect Box05.Out Box00.In # Complex input ports -input vtkImageData Box07.In " " input renderer Box04.In " " +input vtkImageData Box06.In " " # Complex output ports output boxchange Box02.boxChange " " diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx index 34c6e66..4ed177a 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx @@ -9,7 +9,7 @@ #include "vtkCellArray.h" #include "vtkCleanPolyData.h" - +#include "vtkTriangleFilter.h" namespace bbcreaVtk { @@ -105,6 +105,10 @@ printf("EED CreateMeshFromPoints::Process Start\n"); clean->SetInputData(polydata); clean->Update(); + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInputData( clean->GetOutput() ); + triangle->Update(); + bbSetOutputOut( clean->GetOutput() ); }// if listXYZ size diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx new file mode 100644 index 0000000..7286c24 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx @@ -0,0 +1,140 @@ +//===== +// 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 "bbcreaVtkPolyDataToImageData.h" +#include "bbcreaVtkPackage.h" + +#include "vtkPolyDataToImageStencil.h" +#include "vtkImageStencil.h" + +#include "vtkCleanPolyData.h" +#include "vtkTriangleFilter.h" + +#include "vtkExtractVOI.h" +#include "vtkExtractVOI.h" + + + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PolyDataToImageData) +BBTK_BLACK_BOX_IMPLEMENTATION(PolyDataToImageData,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 PolyDataToImageData::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 = " <GetExtent( ext ); + + vtkCleanPolyData *clean1 = vtkCleanPolyData::New(); + clean1->SetInputData( bbGetInputInPolyData() ); + clean1->Update(); + vtkTriangleFilter *triangle1 = vtkTriangleFilter::New(); + triangle1->SetInputData( clean1->GetOutput() ); + triangle1->Update(); + + vtkPolyDataToImageStencil *dataToStencil = vtkPolyDataToImageStencil::New(); + dataToStencil->SetInputData( triangle1->GetOutput() ); + dataToStencil->SetOutputWholeExtent( ext ); + dataToStencil->Update(); + + vtkExtractVOI *extract = vtkExtractVOI::New(); + extract->SetVOI( ext ); + extract->SetSampleRate(1, 1, 1); + extract->SetInputData( bbGetInputInImage() ); + extract->ReleaseDataFlagOff(); + extract->Update(); + + vtkImageStencil *stencil = vtkImageStencil::New(); + stencil->SetInputData( extract->GetOutput() ); + stencil->Update(); + stencil->SetStencilData( dataToStencil->GetOutput() ); + stencil->ReverseStencilOn(); + stencil->SetBackgroundValue(128); + stencil->Update(); + + bbSetOutputOut( stencil->GetOutput() ); + } else { + printf("EED Warnning! PolyDataToImageData::Process > Missing Image or PolyData inputs\n"); + }// if In 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 PolyDataToImageData::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputInPolyData(NULL); + bbSetInputInImage(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 PolyDataToImageData::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 PolyDataToImageData::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/bbcreaVtkPolyDataToImageData.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.h new file mode 100644 index 0000000..5dd6602 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.h @@ -0,0 +1,51 @@ +//===== +// 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 __bbcreaVtkPolyDataToImageData_h_INCLUDED__ +#define __bbcreaVtkPolyDataToImageData_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkPolyData.h" +#include "vtkImageData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT PolyDataToImageData + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(PolyDataToImageData,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(InImage,vtkImageData*); + BBTK_DECLARE_INPUT(InPolyData,vtkPolyData*); + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + 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(PolyDataToImageData,bbtk::AtomicBlackBox); + BBTK_NAME("PolyDataToImageData"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(PolyDataToImageData,InImage,"Image to put Result",vtkImageData*,""); + BBTK_INPUT(PolyDataToImageData,InPolyData,"Input vtkPolyData",vtkPolyData*,""); + BBTK_OUTPUT(PolyDataToImageData,Out,"Output vtkImageData",vtkImageData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(PolyDataToImageData); +//===== +// 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 // __bbcreaVtkPolyDataToImageData_h_INCLUDED__ + -- 2.47.1