From b146797e0ad985788de697dcb3e6a48f4a2a488a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 8 Jul 2019 09:57:23 +0200 Subject: [PATCH] #3274 creaVtk Feature New Normal - BooleanOperationPolyDataFilter BoxWidget ClipPolyData VoxelGrid --- .../exampleBooleanOperationPolyDataFilter.bbg | 108 +++++++ .../exampleBooleanOperationPolyDataFilter.bbs | 67 ++++ .../bbs/appli/exampleDelaunay3D.bbg | 134 ++++++++ .../bbs/appli/exampleDelaunay3D.bbs | 82 +++++ .../exampleVectorsExploration_Widget.bbg | 2 +- .../exampleVectorsExploration_Widget.bbs | 2 +- .../appli/example_BoxWidget_ClipPolydata.bbg | 104 ++++++ .../appli/example_BoxWidget_ClipPolydata.bbs | 66 ++++ .../bbs/boxes/VolumeVectorVisu_Interface.bbg | 90 ++++-- .../bbs/boxes/VolumeVectorVisu_Interface.bbs | 23 +- .../bbs/boxes/VolumeVectorVisu_Widget.bbg | 78 +++-- .../bbs/boxes/VolumeVectorVisu_Widget.bbs | 24 +- ...bcreaVtkBooleanOperationPolyDataFilter.cxx | 123 +++++++ .../bbcreaVtkBooleanOperationPolyDataFilter.h | 55 ++++ bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.cxx | 132 ++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h | 60 ++++ .../src/bbcreaVtkClipPolyData.cxx | 115 +++++++ bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.h | 58 ++++ bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.cxx | 145 +-------- bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.h | 6 +- bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h | 3 + bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.cxx | 91 ++++++ bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.h | 59 ++++ lib/creaVtk/vtkVectorsTensorsVisuBase.cpp | 1 - lib/creaVtk/vtkVectorsVisu.cpp | 306 +++++++++--------- 25 files changed, 1572 insertions(+), 362 deletions(-) create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbs create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.h diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbg new file mode 100644 index 0000000..83f571a --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbg @@ -0,0 +1,108 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:8 +BOX +vtk:LoadHola:Box00 +ISEXEC:FALSE +20.514225:65.842216:-900.000000 +56.064225:55.842216:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box01 +ISEXEC:FALSE +10.074288:34.484577:-900.000000 +73.794288:24.484577:-900.000000 +FIN_BOX +BOX +creaVtk:BooleanOperationPolyDataFilter:Box02 +ISEXEC:FALSE +-84.931667:-3.883455:-900.000000 +-27.731667:-13.883455:-900.000000 +PORT +Operation:"2" +FIN_BOX +BOX +vtk:SphereSource:Box03 +ISEXEC:FALSE +-66.750036:38.292380:-900.000000 +-26.925036:28.292380:-900.000000 +PORT +CenterX:"50" +PORT +CenterY:"50" +PORT +CenterZ:"50" +PORT +Radius:"10" +FIN_BOX +BOX +vtk:SphereSource:Box04 +ISEXEC:FALSE +-115.429192:38.610324:-900.000000 +-75.604192:28.610324:-900.000000 +PORT +CenterX:"60" +PORT +CenterY:"60" +PORT +CenterZ:"60" +PORT +Radius:"15" +FIN_BOX +BOX +wx:LayoutSplit:Box05 +ISEXEC:TRUE +17.589025:-59.260516:-900.000000 +56.669025:-69.260516:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:CommandButton:Box06 +ISEXEC:FALSE +-129.629226:-22.380301:-900.000000 +-86.854226:-32.380301:-900.000000 +PORT +Label:"Run" +FIN_BOX +BOX +vtk:PolyDataToActor:Box07 +ISEXEC:FALSE +-77.744753:-60.735724:-900.000000 +-35.344753:-70.735724:-900.000000 +FIN_BOX +CONNECTIONS:8 +CONNECTION +Box00:Out:Box01:In +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box02:Out:Box07:In +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box07:Renderer +NumberOfControlPoints:0 +CONNECTION +Box06:BoxChange:Box07:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box04:Out:Box02:In1 +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box02:In2 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbs new file mode 100644 index 0000000..cadee93 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbs @@ -0,0 +1,67 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleBooleanOperationPolyDataFilter.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include creaMaracasVisu +include creaVtk +include wx + +author "Author ??" +description "Description ??" +category "" + +new vtk:LoadHola Box00 + +new creaMaracasVisu:ViewerNV Box01 + +new creaVtk:BooleanOperationPolyDataFilter Box02 + set Box02.Operation "2" + +new vtk:SphereSource Box03 + set Box03.CenterX "50" + set Box03.CenterY "50" + set Box03.CenterZ "50" + set Box03.Radius "10" + +new vtk:SphereSource Box04 + set Box04.CenterX "60" + set Box04.CenterY "60" + set Box04.CenterZ "60" + set Box04.Radius "15" + +new wx:LayoutSplit Box05 + set Box05.Orientation "H" + +new wx:CommandButton Box06 + set Box06.Label "Run" + +new vtk:PolyDataToActor Box07 + + +connect Box00.Out Box01.In + +connect Box01.Widget Box05.Widget2 + +connect Box06.Widget Box05.Widget1 + +connect Box02.Out Box07.In + +connect Box01.Renderer1 Box07.Renderer + +connect Box06.BoxChange Box07.BoxExecute + +connect Box04.Out Box02.In1 + +connect Box03.Out Box02.In2 + + + +# Complex input ports +exec Box05 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbg new file mode 100644 index 0000000..18ad355 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbg @@ -0,0 +1,134 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:10 +BOX +creaVtk:Delaunay3D:Box03 +ISEXEC:FALSE +-2.472015:3.957655:-900.000000 +35.727985:-6.042345:-900.000000 +PORT +Alpha:"0" +PORT +Tolerance:"0" +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box04 +ISEXEC:FALSE +-126.280141:32.405606:-900.000000 +-62.560141:22.405606:-900.000000 +FIN_BOX +BOX +vtk:LoadHola:Box05 +ISEXEC:FALSE +-120.467476:57.400064:-900.000000 +-84.917476:47.400064:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box06 +ISEXEC:FALSE +-5.919702:-30.569827:-900.000000 +36.480298:-40.569827:-900.000000 +PORT +Opacity:"0.4" +FIN_BOX +BOX +wx:LayoutSplit:Box07 +ISEXEC:TRUE +-161.991926:-50.380782:-900.000000 +-122.911926:-60.380782:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:CommandButton:Box08 +ISEXEC:FALSE +-179.483711:26.604189:-900.000000 +-136.708711:16.604189:-900.000000 +PORT +Label:"Run" +FIN_BOX +BOX +creaMaracasVisu:DrawAxe3D:Box10 +ISEXEC:FALSE +-99.671144:-20.425965:-900.000000 +-61.971144:-30.425965:-900.000000 +PORT +Colour:"0 0 1" +FIN_BOX +BOX +std:ConcatStrings:Box11 +ISEXEC:FALSE +-67.014817:80.569084:-900.000000 +-27.289817:70.569084:-900.000000 +PORT +In1:"10 10 10 30 50" +FIN_BOX +BOX +std:ConcatStrings:Box12 +ISEXEC:FALSE +-31.127956:68.291016:-900.000000 +8.597044:58.291016:-900.000000 +PORT +In1:"80 20 10 30 50" +FIN_BOX +BOX +std:ConcatStrings:Box13 +ISEXEC:FALSE +-15.540973:57.652069:-900.000000 +24.184027:47.652069:-900.000000 +PORT +In1:"40 60 30 30 50" +FIN_BOX +CONNECTIONS:14 +CONNECTION +Box05:Out:Box04:In +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box07:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box07:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box04:Renderer1:Box06:Renderer +NumberOfControlPoints:0 +CONNECTION +Box11:Out:Box10:lstPointX +NumberOfControlPoints:0 +CONNECTION +Box12:Out:Box10:lstPointY +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box10:lstPointZ +NumberOfControlPoints:0 +CONNECTION +Box11:Out:Box03:LstPointsX +NumberOfControlPoints:0 +CONNECTION +Box12:Out:Box03:LstPointsY +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box03:LstPointsZ +NumberOfControlPoints:0 +CONNECTION +Box04:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box10:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box06:BoxExecute +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbs new file mode 100644 index 0000000..d488f3f --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbs @@ -0,0 +1,82 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleDelaunay3D.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include creaMaracasVisu +include vtk +include wx +include std + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:Delaunay3D Box03 + set Box03.Alpha "0" + set Box03.Tolerance "0" + +new creaMaracasVisu:ViewerNV Box04 + +new vtk:LoadHola Box05 + +new vtk:PolyDataToActor Box06 + set Box06.Opacity "0.4" + +new wx:LayoutSplit Box07 + set Box07.Orientation "H" + +new wx:CommandButton Box08 + set Box08.Label "Run" + +new creaMaracasVisu:DrawAxe3D Box10 + set Box10.Colour "0 0 1" + +new std:ConcatStrings Box11 + set Box11.In1 "10 10 10 30 50" + +new std:ConcatStrings Box12 + set Box12.In1 "80 20 10 30 50" + +new std:ConcatStrings Box13 + set Box13.In1 "40 60 30 30 50" + + +connect Box05.Out Box04.In + +connect Box03.Out Box06.In + +connect Box04.Widget Box07.Widget2 + +connect Box08.Widget Box07.Widget1 + +connect Box04.Renderer1 Box06.Renderer + +connect Box11.Out Box10.lstPointX + +connect Box12.Out Box10.lstPointY + +connect Box13.Out Box10.lstPointZ + +connect Box11.Out Box03.LstPointsX + +connect Box12.Out Box03.LstPointsY + +connect Box13.Out Box03.LstPointsZ + +connect Box04.Renderer1 Box10.Renderer + +connect Box08.BoxChange Box10.BoxExecute + +connect Box08.BoxChange Box06.BoxExecute + + + +# Complex input ports +exec Box07 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg index 7b82938..26c68ed 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbg # ---------------------------------- APP_START diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs index c999230..f8724a1 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script -# - /tmpEED/creaTools2/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleVectorsExploration_Widget.bbs # ---------------------------------- # BBTK GEditor Script diff --git a/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbg b/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbg new file mode 100644 index 0000000..f68c584 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbg @@ -0,0 +1,104 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:8 +BOX +vtk:LoadHola:Box00 +ISEXEC:FALSE +-13.850748:68.721067:-900.000000 +21.699252:58.721067:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box01 +ISEXEC:FALSE +-19.979284:45.126531:-900.000000 +43.740716:35.126531:-900.000000 +FIN_BOX +BOX +creaVtk:BoxWidget:Box02 +ISEXEC:FALSE +-38.184214:4.379120:-900.000000 +-1.509214:-5.620880:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box03 +ISEXEC:TRUE +11.848896:-90.117759:-900.000000 +50.928896:-100.117759:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:CommandButton:Box04 +ISEXEC:FALSE +-85.584870:31.037853:-900.000000 +-42.809870:21.037853:-900.000000 +PORT +Label:"Refresh" +FIN_BOX +BOX +vtk:SphereSource:Box05 +ISEXEC:FALSE +26.306848:5.863047:-900.000000 +66.131848:-4.136953:-900.000000 +PORT +CenterX:"50" +PORT +CenterY:"50" +PORT +CenterZ:"50" +PORT +Radius:"20" +FIN_BOX +BOX +creaVtk:ClipPolyData:Box06 +ISEXEC:FALSE +-49.518922:-34.972985:-900.000000 +-10.693922:-44.972985:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box07 +ISEXEC:FALSE +-52.136645:-67.077861:-900.000000 +-9.736645:-77.077861:-900.000000 +FIN_BOX +CONNECTIONS:10 +CONNECTION +Box00:Out:Box01:In +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box02:Renderer +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box04:BoxChange:Box02:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box02:ImplicitFunction:Box06:ImplicitFunction +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box07:In +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box07:Renderer +NumberOfControlPoints:0 +CONNECTION +Box06:BoxChange:Box07:BoxExecute +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbs b/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbs new file mode 100644 index 0000000..f57eb60 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbs @@ -0,0 +1,66 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/example_BoxWidget_ClipPolydata.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include creaMaracasVisu +include creaVtk +include wx + +author "Author ??" +description "Description ??" +category "" + +new vtk:LoadHola Box00 + +new creaMaracasVisu:ViewerNV Box01 + +new creaVtk:BoxWidget Box02 + +new wx:LayoutSplit Box03 + set Box03.Orientation "H" + +new wx:CommandButton Box04 + set Box04.Label "Refresh" + +new vtk:SphereSource Box05 + set Box05.CenterX "50" + set Box05.CenterY "50" + set Box05.CenterZ "50" + set Box05.Radius "20" + +new creaVtk:ClipPolyData Box06 + +new vtk:PolyDataToActor Box07 + + +connect Box00.Out Box01.In + +connect Box01.Renderer1 Box02.Renderer + +connect Box01.Widget Box03.Widget2 + +connect Box04.Widget Box03.Widget1 + +connect Box04.BoxChange Box02.BoxExecute + +connect Box05.Out Box06.In + +connect Box02.ImplicitFunction Box06.ImplicitFunction + +connect Box06.Out Box07.In + +connect Box01.Renderer1 Box07.Renderer + +connect Box06.BoxChange Box07.BoxExecute + + + +# Complex input ports +exec Box03 diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg index 60c5cf0..8d14a6d 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbg @@ -10,18 +10,18 @@ AUTHOR:Author ?? COMPLEXBOX:TRUE COMPLEXBOXNAME:VolumeVectorVisu_Interface PACKAGENAME:creaVtk -COMPLEXOUTPUTS:7 +COMPLEXOUTPUTS:8 COMPLEX_PORT boxChange -52.001184:-76.860241:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT widget -23.090200:-76.457462:-900.000000 +-9.312745:-74.872535:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT AcitiveVector -81.877237:-75.736772:-900.000000 +38.732011:-76.441184:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Opacity @@ -33,25 +33,31 @@ ScaleFactor FIN_COMPLEX_PORT COMPLEX_PORT Ratio --91.228359:-50.583288:-900.000000 +59.515777:-74.885497:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT form 213.982353:-74.143348:-900.000000 FIN_COMPLEX_PORT +COMPLEX_PORT +ActiveBoxWidget +-77.397252:-75.636223:-900.000000 +FIN_COMPLEX_PORT COMPLEXINPUTS:0 -BOXES:11 +BOXES:13 BOX wx:Slider:Box00 ISEXEC:FALSE --50.906743:62.037478:-900.000000 -0.493257:52.037478:-900.000000 +37.599484:64.834591:-900.000000 +88.999484:54.834591:-900.000000 +PORT +ChangeResolution:"true" PORT In:"30" PORT Label:"true" PORT -Max:"1000" +Max:"50" PORT Min:"1" PORT @@ -62,8 +68,8 @@ FIN_BOX BOX std:MultipleInputs:Box02 ISEXEC:FALSE --32.311244:15.574268:-900.000000 -7.388756:5.574268:-900.000000 +-26.820557:-11.948057:-900.000000 +12.879443:-21.948057:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX @@ -78,14 +84,14 @@ FIN_BOX BOX wx:LayoutTab:Box04 ISEXEC:FALSE -6.581707:-36.142745:-900.000000 -64.141707:-46.142745:-900.000000 +-12.965722:-34.557818:-900.000000 +44.594278:-44.557818:-900.000000 FIN_BOX BOX wx:CheckBox:Box05 ISEXEC:FALSE -40.200879:64.505359:-900.000000 -76.525879:54.505359:-900.000000 +-1.305237:90.909899:-900.000000 +35.019763:80.909899:-900.000000 PORT ReactiveOnKeystroke:"true" PORT @@ -163,14 +169,31 @@ ISEXEC:FALSE PORT Orientation:"H" FIN_BOX -CONNECTIONS:22 +BOX +wx:LayoutLine:Box12 +ISEXEC:FALSE +-45.693959:64.121913:-900.000000 +11.866041:54.121913:-900.000000 +PORT +Orientation:"H" +PORT +WinTitle:"Volume flield" +FIN_BOX +BOX +wx:CheckBox:Box13 +ISEXEC:FALSE +-82.036132:89.953646:-900.000000 +-45.711132:79.953646:-900.000000 +PORT +ReactiveOnKeystroke:"true" +PORT +Title:"Active Box" +FIN_BOX +CONNECTIONS:26 CONNECTION Box00:BoxChange:Box02:In1 NumberOfControlPoints:0 CONNECTION -Box00:Widget:Box03:Widget2 -NumberOfControlPoints:0 -CONNECTION Box02:BoxChange:boxChange:boxChange NumberOfControlPoints:0 CONNECTION @@ -180,15 +203,9 @@ CONNECTION Box04:Widget:widget:widget NumberOfControlPoints:0 CONNECTION -Box05:Widget:Box03:Widget3 -NumberOfControlPoints:0 -CONNECTION Box05:BoxChange:Box02:In3 NumberOfControlPoints:0 CONNECTION -Box06:Widget:Box03:Widget4 -NumberOfControlPoints:0 -CONNECTION Box06:Out:Box07:In1 NumberOfControlPoints:0 CONNECTION @@ -225,9 +242,30 @@ CONNECTION Box10:Widget:Box11:Widget2 NumberOfControlPoints:0 CONNECTION -Box11:Widget:Box03:Widget5 +Box10:BoxChange:Box02:In6 NumberOfControlPoints:0 CONNECTION -Box10:BoxChange:Box02:In6 +Box11:Widget:Box03:Widget7 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box03:Widget6 +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box12:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box13:Widget:Box12:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box13:BoxChange:Box02:In2 +NumberOfControlPoints:0 +CONNECTION +Box13:Out:ActiveBoxWidget:ActiveBoxWidget 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 eee2eb6..1540add 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Interface.bbs @@ -16,9 +16,10 @@ description "Description ??" category "" new wx:Slider Box00 + set Box00.ChangeResolution "true" set Box00.In "30" set Box00.Label "true" - set Box00.Max "1000" + set Box00.Max "50" set Box00.Min "1" set Box00.ReactiveOnTrack "true" set Box00.Title "Ratio" @@ -65,13 +66,18 @@ new wx:ComboBox Box10 new wx:LayoutLine Box11 set Box11.Orientation "H" +new wx:LayoutLine Box12 + set Box12.Orientation "H" + set Box12.WinTitle "Volume flield" + +new wx:CheckBox Box13 + set Box13.ReactiveOnKeystroke "true" + set Box13.Title "Active Box" + connect Box00.BoxChange Box02.In1 -connect Box00.Widget Box03.Widget2 connect Box03.Widget Box04.Widget1 -connect Box05.Widget Box03.Widget3 connect Box05.BoxChange Box02.In3 -connect Box06.Widget Box03.Widget4 connect Box06.Out Box07.In1 connect Box08.Out Box09.In1 connect Box06.BoxChange Box02.In4 @@ -79,8 +85,14 @@ connect Box08.BoxChange Box02.In5 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 +connect Box11.Widget Box03.Widget7 +connect Box06.Widget Box03.Widget6 +connect Box00.Widget Box03.Widget2 +connect Box12.Widget Box03.Widget1 +connect Box05.Widget Box12.Widget2 +connect Box13.Widget Box12.Widget1 +connect Box13.BoxChange Box02.In2 # Complex input ports @@ -92,6 +104,7 @@ output Opacity Box07.Out " " output ScaleFactor Box09.Out " " output Ratio Box00.Out " " output form Box10.Out " " +output ActiveBoxWidget Box13.Out " " endefine diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg index 3efda85..c432ae2 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbg @@ -28,18 +28,18 @@ COMPLEX_PORT renderer -102.399936:88.482773:-900.000000 FIN_COMPLEX_PORT -BOXES:7 +BOXES:9 BOX creaVtk:VectorsVisu:Box00 ISEXEC:FALSE --7.861447:-26.759942:-900.000000 -29.763553:-36.759942:-900.000000 +-17.900845:-12.462724:-900.000000 +19.724155:-22.462724:-900.000000 FIN_BOX BOX vtk:MaskPoint:Box07 ISEXEC:FALSE --62.558622:31.954645:-900.000000 --26.408622:21.954645:-900.000000 +-16.666033:44.572575:-900.000000 +19.483967:34.572575:-900.000000 FIN_BOX BOX creaVtk:VolumeVectorVisu_Interface:Box02 @@ -50,22 +50,16 @@ FIN_BOX BOX vtk:UpdateRender:Box03 ISEXEC:FALSE -6.265844:-73.238158:-900.000000 -46.590844:-83.238158:-900.000000 +-4.196952:-69.750559:-900.000000 +36.128048:-79.750559:-900.000000 PORT Active:"true" FIN_BOX BOX std:MagicBox:Box04 ISEXEC:FALSE --119.133549:39.464518:-900.000000 --83.058549:29.464518:-900.000000 -FIN_BOX -BOX -vtk:ProbeFilter:Box05 -ISEXEC:FALSE --22.745519:24.352539:-900.000000 -13.654481:14.352539:-900.000000 +-112.198808:64.555673:-900.000000 +-76.123808:54.555673:-900.000000 FIN_BOX BOX std:MagicBox:Box06 @@ -73,7 +67,29 @@ ISEXEC:FALSE -30.904238:69.101876:-900.000000 5.170762:59.101876:-900.000000 FIN_BOX -CONNECTIONS:18 +BOX +creaVtk:ClipPolyData:Box08 +ISEXEC:FALSE +-15.381729:23.829285:-900.000000 +23.443271:13.829285:-900.000000 +PORT +Inside:"true" +PORT +Type:"1" +FIN_BOX +BOX +creaVtk:BoxWidget:Box09 +ISEXEC:FALSE +-65.717137:44.169788:-900.000000 +-29.042137:34.169788:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box10 +ISEXEC:FALSE +-64.370903:22.659312:-900.000000 +-24.670903:12.659312:-900.000000 +FIN_BOX +CONNECTIONS:22 CONNECTION Box02:AcitiveVector:Box00:Active NumberOfControlPoints:0 @@ -93,12 +109,6 @@ CONNECTION Box02:widget:Widget:Widget NumberOfControlPoints:0 CONNECTION -Box02:boxChange:Box07:BoxExecute -NumberOfControlPoints:0 -CONNECTION -Box02:boxChange:Box00:BoxExecute -NumberOfControlPoints:0 -CONNECTION renderer:renderer:Box04:In NumberOfControlPoints:0 CONNECTION @@ -120,12 +130,30 @@ CONNECTION Box06:Out:Box07:In NumberOfControlPoints:0 CONNECTION -Box06:Out:Box05:Input +Box07:Out:Box08:In +NumberOfControlPoints:0 +CONNECTION +Box08:Out:Box00:In +NumberOfControlPoints:0 +CONNECTION +Box09:ImplicitFunction:Box08:ImplicitFunction +NumberOfControlPoints:0 +CONNECTION +Box04:Out:Box09:Renderer +NumberOfControlPoints:0 +CONNECTION +Box02:boxChange:Box10:In2 +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box10:In1 +NumberOfControlPoints:0 +CONNECTION +Box10:BoxChange:Box00:BoxExecute NumberOfControlPoints:0 CONNECTION -Box06:Out:Box05:Source +Box02:ActiveBoxWidget:Box09:Active NumberOfControlPoints:0 CONNECTION -Box05:Out:Box00:In +Box02:AcitiveVector:Box07:Active 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 c50b422..3fb51ac 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/VolumeVectorVisu_Widget.bbs @@ -27,25 +27,35 @@ new vtk:UpdateRender Box03 new std:MagicBox Box04 -new vtk:ProbeFilter Box05 - new std:MagicBox Box06 +new creaVtk:ClipPolyData Box08 + set Box08.Inside "true" + set Box08.Type "1" + +new creaVtk:BoxWidget Box09 + +new std:MultipleInputs Box10 + connect Box02.AcitiveVector Box00.Active connect Box02.Opacity Box00.Opacity connect Box02.Ratio Box07.Ratio connect Box02.ScaleFactor Box00.ScaleFactor -connect Box02.boxChange Box07.BoxExecute -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 +connect Box07.Out Box08.In +connect Box08.Out Box00.In +connect Box09.ImplicitFunction Box08.ImplicitFunction +connect Box04.Out Box09.Renderer +connect Box02.boxChange Box10.In2 +connect Box09.BoxChange Box10.In1 +connect Box10.BoxChange Box00.BoxExecute +connect Box02.ActiveBoxWidget Box09.Active +connect Box02.AcitiveVector Box07.Active # Complex input ports input renderer Box04.In " " diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.cxx new file mode 100644 index 0000000..9017e5b --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.cxx @@ -0,0 +1,123 @@ +//===== +// 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 "bbcreaVtkBooleanOperationPolyDataFilter.h" +#include "bbcreaVtkPackage.h" + +#include "vtkBooleanOperationPolyDataFilter.h" +#include "vtkCleanPolyData.h" +#include "vtkTriangleFilter.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,BooleanOperationPolyDataFilter) +BBTK_BLACK_BOX_IMPLEMENTATION(BooleanOperationPolyDataFilter,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 BooleanOperationPolyDataFilter::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( bbGetInputIn1() ); + clean2->SetInputData( bbGetInputIn2() ); + clean1->Update(); + clean2->Update(); + vtkTriangleFilter *triangle1 = vtkTriangleFilter::New(); + vtkTriangleFilter *triangle2 = vtkTriangleFilter::New(); + triangle1->SetInputData( clean1->GetOutput() ); + triangle2->SetInputData( clean2->GetOutput() ); + triangle1->Update(); + triangle2->Update(); + + vtkBooleanOperationPolyDataFilter *booleanOperation = vtkBooleanOperationPolyDataFilter::New(); + booleanOperation->SetInputData(0, triangle1->GetOutput() ); + booleanOperation->SetInputData(1, triangle2->GetOutput() ); + + if (bbGetInputOperation()==0 ) + { + booleanOperation->SetOperationToUnion(); + } + if (bbGetInputOperation()==1 ) + { + booleanOperation->SetOperationToIntersection(); + } + if (bbGetInputOperation()==2 ) + { + booleanOperation->SetOperationToDifference(); + } + booleanOperation->Update(); + bbSetOutputOut( booleanOperation->GetOutput() ); + } else { + printf("EED Warnning! BooleanOperationPolyDataFilter::Process vtkPolyData In1 or In2 is EMPTY\n"); + } // if In1 In2 != 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 BooleanOperationPolyDataFilter::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn1(NULL); + bbSetInputIn2(NULL); + bbSetInputOperation(0); + +} +//===== +// 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 BooleanOperationPolyDataFilter::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 BooleanOperationPolyDataFilter::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/bbcreaVtkBooleanOperationPolyDataFilter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.h new file mode 100644 index 0000000..f604191 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBooleanOperationPolyDataFilter.h @@ -0,0 +1,55 @@ +//===== +// 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 __bbcreaVtkBooleanOperationPolyDataFilter_h_INCLUDED__ +#define __bbcreaVtkBooleanOperationPolyDataFilter_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkPolyData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT BooleanOperationPolyDataFilter + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(BooleanOperationPolyDataFilter,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(In1,vtkPolyData*); + BBTK_DECLARE_INPUT(In2,vtkPolyData*); + BBTK_DECLARE_INPUT(Operation,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(BooleanOperationPolyDataFilter,bbtk::AtomicBlackBox); + BBTK_NAME("BooleanOperationPolyDataFilter"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(BooleanOperationPolyDataFilter,In1,"vtkPolyData",vtkPolyData*,""); + BBTK_INPUT(BooleanOperationPolyDataFilter,In2,"vtkPolyData",vtkPolyData*,""); + BBTK_INPUT(BooleanOperationPolyDataFilter,Operation,"(defalut 0) 0:Union 1:Intersection 2:Difference",int,""); + + BBTK_OUTPUT(BooleanOperationPolyDataFilter,Out,"vtkPolyData",vtkPolyData*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(BooleanOperationPolyDataFilter); +//===== +// 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 // __bbcreaVtkBooleanOperationPolyDataFilter_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.cxx new file mode 100644 index 0000000..d16cf2a --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.cxx @@ -0,0 +1,132 @@ +//===== +// 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.h" +#include "bbcreaVtkPackage.h" + +#include "vtkRenderWindow.h" +#include "vtkCommand.h" + + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,BoxWidget) +BBTK_BLACK_BOX_IMPLEMENTATION(BoxWidget,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) +//===== + +class bbBoxWidgetCallback : public vtkCommand + { + public: + BoxWidget *_box; + static bbBoxWidgetCallback *New() + { + return new bbBoxWidgetCallback; + } + void SetBox( BoxWidget* box ) + { + _box=box; + } + + void Execute(vtkObject *caller, unsigned long, void*) override + { + vtkBoxWidget *vtkwidget = reinterpret_cast(caller); + vtkwidget->GetPlanes( _box->planes ); + _box->bbSignalOutputModification(std::string("ImplicitFunction")); + } + }; + + + +void BoxWidget::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 = " <SetInteractor( bbGetInputRenderer()->GetRenderWindow()->GetInteractor() ); + boxWidget->SetPlaceFactor(1.25); + boxWidget->PlaceWidget(0,500,0,500,0,500); + boxWidget->GetPlanes( planes ); + } + + // boxWidget->SetProp3D(coneActor); + bbBoxWidgetCallback *callback = bbBoxWidgetCallback::New(); + callback->SetBox( this ); + boxWidget->AddObserver(vtkCommand::InteractionEvent, callback); + + if (bbGetInputActive()==true) + { + boxWidget->On(); + } else { + boxWidget->Off(); + } // if Active + bbSetOutputImplicitFunction( planes ); + } else { + printf("EED Warnning! BoxWidget::Process vtkRenderer not set.\n"); + }// vtkRenderer != 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::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + firsttime=true; + bbSetInputRenderer(NULL); + bbSetInputActive( false ); + +} +//===== +// 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::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::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.h b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h new file mode 100644 index 0000000..ca223de --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h @@ -0,0 +1,60 @@ +//===== +// 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_h_INCLUDED__ +#define __bbcreaVtkBoxWidget_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkBoxWidget.h" +#include "vtkRenderer.h" +#include "vtkImplicitFunction.h" +#include "vtkPlanes.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT BoxWidget + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(BoxWidget,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( Active , bool ); + BBTK_DECLARE_INPUT( Renderer , vtkRenderer* ); + BBTK_DECLARE_OUTPUT( ImplicitFunction , vtkImplicitFunction* ); + BBTK_PROCESS(Process); + void Process(); + + bool firsttime; + vtkBoxWidget *boxWidget; + vtkPlanes *planes; +//===== +// 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,bbtk::AtomicBlackBox); + BBTK_NAME("BoxWidget"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(BoxWidget,Active,"(default false) true/false",bool,""); + BBTK_INPUT(BoxWidget,Renderer,"vtkRenderer",vtkRenderer*,""); + + BBTK_OUTPUT(BoxWidget,ImplicitFunction,"vtkImplicitFunction",vtkImplicitFunction*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(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) +//===== +} +// EO namespace bbcreaVtk + +#endif // __bbcreaVtkBoxWidget_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.cxx new file mode 100644 index 0000000..428518e --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.cxx @@ -0,0 +1,115 @@ +//===== +// 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 "bbcreaVtkClipPolyData.h" +#include "bbcreaVtkPackage.h" + +#include "vtkExtractPoints.h" +#include "vtkClipPolyData.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ClipPolyData) +BBTK_BLACK_BOX_IMPLEMENTATION(ClipPolyData,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 ClipPolyData::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() ); + clip->SetClipFunction( bbGetInputImplicitFunction() ); + clip->GenerateClipScalarsOn(); + clip->GenerateClippedOutputOff(); + if (bbGetInputInside()==true) + { + clip->InsideOutOn(); + } else { + clip->InsideOutOff(); + } + clip->Update(); + bbSetOutputOut( clip->GetOutput() ); + } // Type 0 + if (bbGetInputType()==1) + { + vtkExtractPoints *clip = vtkExtractPoints::New(); + clip->SetInputData( bbGetInputIn() ); + clip->SetImplicitFunction( bbGetInputImplicitFunction() ); + if (bbGetInputInside()==true) + { + clip->ExtractInsideOn(); + } else { + clip->ExtractInsideOff(); + } + clip->Update(); + bbSetOutputOut( clip->GetOutput() ); + } // type 1 + } else { + printf("EED Warnning! ClipPolyData::Process In or ImplicitFunction is EMPTY\n"); + } // if In ImplicitFunction != 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 ClipPolyData::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn( NULL ); + bbSetInputType( 0 ); + bbSetInputInside( true ); + bbSetInputImplicitFunction( 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 ClipPolyData::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 ClipPolyData::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/bbcreaVtkClipPolyData.h b/bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.h new file mode 100644 index 0000000..156b84f --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkClipPolyData.h @@ -0,0 +1,58 @@ +//===== +// 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 __bbcreaVtkClipPolyData_h_INCLUDED__ +#define __bbcreaVtkClipPolyData_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkPolyData.h" +#include "vtkImplicitFunction.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ClipPolyData + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ClipPolyData,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(In,vtkPolyData*); + BBTK_DECLARE_INPUT(Inside,bool); + BBTK_DECLARE_INPUT(ImplicitFunction,vtkImplicitFunction*); + 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(ClipPolyData,bbtk::AtomicBlackBox); + BBTK_NAME("ClipPolyData"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(ClipPolyData,Type,"(default 0) 0:surface vtkClipPolydata 1:points vtkExtractPoints",int,""); + BBTK_INPUT(ClipPolyData,In,"vtkPolyData",vtkPolyData*,""); + BBTK_INPUT(ClipPolyData,Inside,"(defalut true) Inside true, Outside false",bool,""); + BBTK_INPUT(ClipPolyData,ImplicitFunction,"vtkImplicitFunction",vtkImplicitFunction*,""); + + BBTK_OUTPUT(ClipPolyData,Out,"vtkPolyData",vtkPolyData*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(ClipPolyData); +//===== +// 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 // __bbcreaVtkClipPolyData_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.cxx index 02a26e7..baeb1f1 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.cxx @@ -48,8 +48,6 @@ void Delaunay3D::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " < lstX=bbGetInputLstPointsX(); std::vector lstY=bbGetInputLstPointsY(); std::vector lstZ=bbGetInputLstPointsZ(); @@ -72,150 +70,15 @@ printf("EED Delaunay3D::Process Start\n"); delaunay->SetAlpha( bbGetInputAlpha() ); //0.2 delaunay->BoundingTriangulationOff(); delaunay->Update(); - vtkGeometryFilter *geometry = vtkGeometryFilter::New(); geometry->SetInputData( delaunay->GetOutput() ); geometry->Update(); - bbSetOutputOut( geometry->GetOutput() ); - - -/* vtkExtractSurface - double bounds[6]; - inputpolydata->GetBounds(bounds); - double range[3]; - for (int i = 0; i < 3; ++i) - { - range[i] = bounds[2*i + 1] - bounds[2*i]; - } - - int sampleSize = inputpolydata->GetNumberOfPoints() * .00005; - if (sampleSize < 10) - { - sampleSize = 10; - } - std::cout << "Sample size is: " << sampleSize << std::endl; - // Do we need to estimate normals? - vtkSmartPointer distance = - vtkSmartPointer::New(); - if (inputpolydata->GetPointData()->GetNormals()) - { - std::cout << "Using normals from input file" << std::endl; - distance->SetInputData (inputpolydata); - } else{ - std::cout << "Estimating normals using PCANormalEstimation" << std::endl; - vtkSmartPointer normals = - vtkSmartPointer::New(); - normals->SetInputData (inputpolydata); - normals->SetSampleSize(sampleSize); - normals->SetNormalOrientationToGraphTraversal(); - normals->FlipNormalsOn(); - distance->SetInputConnection (normals->GetOutputPort()); - } - std::cout << "Range: " - << range[0] << ", " - << range[1] << ", " - << range[2] << std::endl; - int dimension = 256; - double radius; - - radius = std::max(std::max(range[0], range[1]), range[2]) - / static_cast(dimension) * 4; // ~4 voxels - -//EED - radius = bbGetInputTolerance(); - - - std::cout << "Radius: " << radius << std::endl; - - distance->SetRadius(radius); - distance->SetDimensions(dimension, dimension, dimension); - distance->SetBounds( - bounds[0] - range[0] * .1, - bounds[1] + range[0] * .1, - bounds[2] - range[1] * .1, - bounds[3] + range[1] * .1, - bounds[4] - range[2] * .1, - bounds[5] + range[2] * .1); - - - vtkExtractSurface *surface = vtkExtractSurface::New(); - surface->SetInputConnection (distance->GetOutputPort()); - surface->SetRadius(radius * .99 ); // - surface->Update(); - bbSetOutputOut( surface->GetOutput() ); -*/ - -/*vtkPoissonReconstruction - vtkPolyData *polyData=inputpolydata; - - vtkSmartPointer surface = - vtkSmartPointer::New(); - surface->SetDepth(12); - - int sampleSize = polyData->GetNumberOfPoints() * .00005; - if (sampleSize < 10) - { - sampleSize = 10; - } - if (polyData->GetPointData()->GetNormals()) - { - std::cout << "Using normals from input file" << std::endl; - surface->SetInputData (polyData); - } - else - { - std::cout << "Estimating normals using PCANormalEstimation" << std::endl; - vtkSmartPointer normals = - vtkSmartPointer::New(); - normals->SetInputData (polyData); - normals->SetSampleSize(sampleSize); - normals->SetNormalOrientationToGraphTraversal(); - normals->FlipNormalsOff(); - surface->SetInputConnection(normals->GetOutputPort()); - } - - surface->Update(); - bbSetOutputOut( surface->GetOutput() ); - -*/ - - - -/*SurfaceReconstructionFilter - - vtkPolyData *polydata=inputpolydata; - - // Construct the surface and create isosurface. - vtkSmartPointer surf = - vtkSmartPointer::New(); - surf->SetInputData(polydata); - - vtkSmartPointer cf = - vtkSmartPointer::New(); - cf->SetInputConnection(surf->GetOutputPort()); - cf->SetValue(0, 0.0); - - // Sometimes the contouring algorithm can create a volume whose gradient - // vector and ordering of polygon (using the right hand rule) are - // inconsistent. vtkReverseSense cures this problem. - vtkSmartPointer reverse = - vtkSmartPointer::New(); - reverse->SetInputConnection(cf->GetOutputPort()); - reverse->ReverseCellsOn(); - reverse->ReverseNormalsOn(); - - bbSetOutputOut( reverse->GetOutput() ); - -*/ - } else { printf("Warnning! Delaunay3D::Process: list of points empty. \n"); } // if lstX.size - -printf("EED Delaunay3D::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) //===== @@ -224,10 +87,8 @@ void Delaunay3D::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 - bbSetInputTolerance( 0.01 ); - bbSetInputAlpha( 0.2 ); - bbSetInputShrinkFactor( 0.9 ); - + bbSetInputTolerance( 0 ); + bbSetInputAlpha( 0 ); } //===== // 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) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.h b/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.h index 7f8f472..9761ddb 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkDelaunay3D.h @@ -24,7 +24,6 @@ class bbcreaVtk_EXPORT Delaunay3D BBTK_DECLARE_INPUT(Tolerance,double); BBTK_DECLARE_INPUT(Alpha,double); - BBTK_DECLARE_INPUT(ShrinkFactor,double); BBTK_DECLARE_INPUT(LstPointsX,std::vector); BBTK_DECLARE_INPUT(LstPointsY,std::vector); BBTK_DECLARE_INPUT(LstPointsZ,std::vector); @@ -42,9 +41,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Delaunay3D,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(Delaunay3D,Tolerance,"Delaunay Tolerance",double,""); - BBTK_INPUT(Delaunay3D,Alpha,"Delaunay Alpha",double,""); - BBTK_INPUT(Delaunay3D,ShrinkFactor,"Shrink Factor",double,""); + BBTK_INPUT(Delaunay3D,Tolerance,"(default 0) Delaunay Tolerance",double,""); + BBTK_INPUT(Delaunay3D,Alpha,"(default 0) Delaunay Alpha",double,""); BBTK_INPUT(Delaunay3D,LstPointsX,"Vector of points X",std::vector,""); BBTK_INPUT(Delaunay3D,LstPointsY,"Vector of points Y",std::vector,""); BBTK_INPUT(Delaunay3D,LstPointsZ,"Vector of points Z",std::vector,""); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h index 61a059f..4dfa23e 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.h @@ -49,6 +49,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorsVisu,bbtk::AtomicBlackBox); BBTK_AUTHOR("ED at InfoDev Creatis"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); + BBTK_INPUT(VectorsVisu,Active,"Active (false default)",bool,""); BBTK_INPUT(VectorsVisu,In,"(needed) vtkDataObject. (Example vtkDataObject<-vtkDataSet<-vtkPointSet<-vtkPolyData (parrent class) )",vtkDataObject*,""); BBTK_INPUT(VectorsVisu,ScaleFactor,"Scale factor (500 default)",double,""); @@ -57,7 +58,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorsVisu,bbtk::AtomicBlackBox); BBTK_INPUT(VectorsVisu,TypeForm,"0 Line, 1 Arrow (default 0)",int,""); BBTK_INPUT(VectorsVisu,Orientation,"(default -1) -1=3D, 0=yz, 1=xz, 2=xy",int,""); BBTK_INPUT(VectorsVisu,ExternalLut,"Lookuptable",vtkScalarsToColors*,""); + BBTK_OUTPUT(VectorsVisu,Out,"vtkProp3D of an vtkActor",vtkProp3D*,""); + BBTK_END_DESCRIBE_BLACK_BOX(VectorsVisu); //===== // 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) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.cxx new file mode 100644 index 0000000..676bde6 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.cxx @@ -0,0 +1,91 @@ +//===== +// 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 "bbcreaVtkVoxelGrid.h" +#include "bbcreaVtkPackage.h" + +#include "vtkVoxelGrid.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VoxelGrid) +BBTK_BLACK_BOX_IMPLEMENTATION(VoxelGrid,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 VoxelGrid::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( bbGetInputImage() ); + voxelgrid->SetConfigurationStyleToManual(); + voxelgrid->SetDivisions( bbGetInputDivisionsX(),bbGetInputDivisionsY(),bbGetInputDivisionsZ() ); + +// voxelgrid->SetConfigurationStyleToLeafSize(); +// voxelgrid->SetLeafSize( bbGetInputDivisionsX(),bbGetInputDivisionsY(),bbGetInputDivisionsZ() ); + +// voxelgrid->SetConfigurationStyleToAutomatic(); +// voxelgrid->SetNumberOfPointsPerBin( bbGetInputDivisionsX() ); + voxelgrid->Update(); + + bbSetOutputOut( voxelgrid->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 VoxelGrid::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputImage(NULL); + bbSetInputDivisionsX(100); + bbSetInputDivisionsY(100); + bbSetInputDivisionsZ(100); + +} +//===== +// 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 VoxelGrid::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 VoxelGrid::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/bbcreaVtkVoxelGrid.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.h new file mode 100644 index 0000000..654516c --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVoxelGrid.h @@ -0,0 +1,59 @@ +//===== +// 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 __bbcreaVtkVoxelGrid_h_INCLUDED__ +#define __bbcreaVtkVoxelGrid_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + + +#include "vtkDataObject.h" +#include "vtkPolyData.h" + + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT VoxelGrid + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(VoxelGrid,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(Image,vtkDataObject*); + BBTK_DECLARE_INPUT(DivisionsX,int); + BBTK_DECLARE_INPUT(DivisionsY,int); + BBTK_DECLARE_INPUT(DivisionsZ,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(VoxelGrid,bbtk::AtomicBlackBox); + BBTK_NAME("VoxelGrid"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(VoxelGrid,Image,"Input image",vtkDataObject*,""); + BBTK_INPUT(VoxelGrid,DivisionsX,"X divisions",int,""); + BBTK_INPUT(VoxelGrid,DivisionsY,"Y divisions",int,""); + BBTK_INPUT(VoxelGrid,DivisionsZ,"Z divisions",int,""); + + BBTK_OUTPUT(VoxelGrid,Out,"Output vtkPolydata",vtkPolyData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(VoxelGrid); +//===== +// 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 // __bbcreaVtkVoxelGrid_h_INCLUDED__ + diff --git a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp index c591a5f..9c53d97 100644 --- a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp +++ b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp @@ -283,7 +283,6 @@ void vtkVectorsTensorsVisuBase::Process() // virtual //------------------------------------------------------------------------------ void vtkVectorsTensorsVisuBase::VisibilityActor() { - if ( (_active==true) && (_actorAdded==false) ){ if (GetRenderer()!=NULL) { diff --git a/lib/creaVtk/vtkVectorsVisu.cpp b/lib/creaVtk/vtkVectorsVisu.cpp index c29dace..f88c650 100644 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@ -65,167 +65,173 @@ vtkVectorsVisu::~vtkVectorsVisu() //------------------------------------------------------------------------------ void vtkVectorsVisu::Process() { + if (_vtkglyph==NULL) + { + if (GetOrientation()==-1) + { + _vtkglyph = vtkGlyph3D::New(); + } // _orientation + if ((GetOrientation()>=0) && (GetOrientation()<=2)) + { + _vtkglyph = vtkGlyph3D::New(); +// _vtkglyph = vtkGlyph2D::New(); + } // _orientation + } // _vtkglyph NULL + + if(_active==true) { - if (_vtkglyph==NULL) + + if (GetDataObject()!=NULL) { - if (GetOrientation()==-1) + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetInput( GetDataObject() ); + #else + _vtkglyph->SetInputData( GetDataObject() ); + #endif + if(GetTypeForm()==1) // source Arrow + { + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); + #else + _vtkarrowsource->Update(); + _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() ); + #endif + } else { // source Line + #if VTK_MAJOR_VERSION <= 5 + _vtkglyph->SetSource( _vtklinesource->GetOutput() ); + #else + _vtklinesource->Update(); + _vtkglyph->SetSourceData( _vtklinesource->GetOutput() ); + #endif + } + _vtkglyph->SetScaleModeToScaleByVector(); + + + if (_externalLut==NULL) { - _vtkglyph = vtkGlyph3D::New(); - } // _orientation - if ((GetOrientation()>=0) && (GetOrientation()<=2)) + _vtkglyph->SetColorModeToColorByVector(); + } else { + _vtkglyph->SetColorModeToColorByScalar(); + } // if _externalLut + + _vtkglyph->SetScaleFactor( GetScaleFactor() ); + _vtkglyph->Update(); + + #if VTK_MAJOR_VERSION <= 5 + _pdm->SetInput( _vtkglyph->GetOutput()); + #else + _pdm->SetInputData( _vtkglyph->GetOutput()); + #endif + + vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); + //printf("EED -------------------------------------------\n"); + //_vtkglyph->GetOutput()->Print(std::cout); + //printf("EED -------------------------------------------\n"); + //data->Print(std::cout); + //int i,sizeDa = data->GetNumberOfArrays(); + //for (i=0;iGetArray(i)->Print(std::cout); + //} + + if (_externalLut==NULL) { - _vtkglyph = vtkGlyph3D::New(); -// _vtkglyph = vtkGlyph2D::New(); - } // _orientation - } // _vtkglyph NULL - - -#if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetInput( GetDataObject() ); -#else - _vtkglyph->SetInputData( GetDataObject() ); -#endif - if(GetTypeForm()==1) // source Arrow + _pdm->ScalarVisibilityOn(); + _pdm->SetColorModeToMapScalars(); + // _pdm->SetColorModeToDefault(); + // _pdm->SetColorModeToDirectScalars(); // NOT compile + _pdm->SetScalarModeToUsePointFieldData(); + // _pdm->ImmediateModeRenderingOn(); // obsolete + _LutEED->SetVectorModeToComponent(); + //_LutEED->SetVectorModeToRGBColors(); + //_LutEED->SetVectorModeToMagnitud(); + // _pdm->SetScalarModeToUsePointFieldData(); + _pdm->SetLookupTable( _LutEED ); + _pdm->SelectColorArray( "GlyphVector" ); + } else { + data->SetActiveScalars("angle"); + + _pdm->ScalarVisibilityOn(); + double scalarRange[2]; + scalarRange[0]=0; + scalarRange[1]=40; + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); + _pdm->SetScalarRange(scalarRange); + _pdm->SetColorModeToMapScalars(); + // _pdm->SetColorModeToDefault(); + // _pdm->SetColorModeToDirectScalars(); // NOT compile + // _pdm->SetScalarModeToUsePointFieldData(); + _pdm->ImmediateModeRenderingOn(); // obsolete + _pdm->SetLookupTable( _externalLut ); + _pdm->SelectColorArray( "angle" ); + } // if _externalLut + + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); + + /* + _vtkglyph->Update(); + vtkPointData *pointdata=_vtkglyph->GetOutput()->GetPointData(); + int i,size=pointdata->GetNumberOfArrays(); + for (i=0;iGetArray(i); + printf(" vtkVectorsVisu::Process array name %d:<%s> size:%d\n", i, array->GetName(), array->GetSize() ); + } + */ + + + // vSliceMapperVec->SetLookupTable( vGreenToRedLut ); + // vSliceMapperVec->SetColorModeToMapScalars(); + + #if VTK_MAJOR_VERSION <= 5 + // .. + #else + _pdm->Update(); + #endif + + // Orientation -1 3D OK + + // Orientation 0 2D yz + if (GetOrientation()==0) { -#if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); -#else - _vtkarrowsource->Update(); - _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() ); -#endif - } else { // source Line -#if VTK_MAJOR_VERSION <= 5 - _vtkglyph->SetSource( _vtklinesource->GetOutput() ); -#else - _vtklinesource->Update(); - _vtkglyph->SetSourceData( _vtklinesource->GetOutput() ); -#endif + _trans->Identity(); + _trans->Translate(900,0,0); + _actor->SetUserTransform(_trans); + } + // Orientation 1 2D xz + if (GetOrientation()==1) + { + _trans->Identity(); + _trans->Translate(0,-900,0); + _actor->SetUserTransform(_trans); + } + // Orientation 2 2D xy + if (GetOrientation()==2) + { + _trans->Identity(); + _trans->Translate(0,0,-900); + _actor->SetUserTransform(_trans); } - _vtkglyph->SetScaleModeToScaleByVector(); - - if (_externalLut==NULL) - { - _vtkglyph->SetColorModeToColorByVector(); + _actor->SetMapper( _pdm ); + _actor->GetProperty()->SetOpacity( GetOpacity() ); } else { - _vtkglyph->SetColorModeToColorByScalar(); - } // if _externalLut + printf("EED Warnning! vtkVectorsVisu::Process GetDataObject() is EMPTY\n"); + }// if GetDataObject()!=NULL - _vtkglyph->SetScaleFactor( GetScaleFactor() ); + } else { + _vtkglyph->SetInputData( NULL ); _vtkglyph->Update(); - -#if VTK_MAJOR_VERSION <= 5 - _pdm->SetInput( _vtkglyph->GetOutput()); -#else - _pdm->SetInputData( _vtkglyph->GetOutput()); -#endif - -vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); -//printf("EED -------------------------------------------\n"); -//_vtkglyph->GetOutput()->Print(std::cout); -//printf("EED -------------------------------------------\n"); -//data->Print(std::cout); -//int i,sizeDa = data->GetNumberOfArrays(); -//for (i=0;iGetArray(i)->Print(std::cout); -//} - - - if (_externalLut==NULL) - { - _pdm->ScalarVisibilityOn(); - _pdm->SetColorModeToMapScalars(); - // _pdm->SetColorModeToDefault(); - // _pdm->SetColorModeToDirectScalars(); // NOT compile - _pdm->SetScalarModeToUsePointFieldData(); - // _pdm->ImmediateModeRenderingOn(); // obsolete - _LutEED->SetVectorModeToComponent(); - //_LutEED->SetVectorModeToRGBColors(); - //_LutEED->SetVectorModeToMagnitud(); - // _pdm->SetScalarModeToUsePointFieldData(); - _pdm->SetLookupTable( _LutEED ); - _pdm->SelectColorArray( "GlyphVector" ); - } else { - data->SetActiveScalars("angle"); - - _pdm->ScalarVisibilityOn(); - double scalarRange[2]; - scalarRange[0]=0; - scalarRange[1]=40; -printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process clean scalar Range ......\n"); - _pdm->SetScalarRange(scalarRange); - _pdm->SetColorModeToMapScalars(); -// _pdm->SetColorModeToDefault(); -// _pdm->SetColorModeToDirectScalars(); // NOT compile -// _pdm->SetScalarModeToUsePointFieldData(); - _pdm->ImmediateModeRenderingOn(); // obsolete - _pdm->SetLookupTable( _externalLut ); - _pdm->SelectColorArray( "angle" ); - } // if _externalLut - -printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); -printf("EED warnnning ..... vtkVectorsVisu::Process Clean angle ......\n"); - -/* -_vtkglyph->Update(); -vtkPointData *pointdata=_vtkglyph->GetOutput()->GetPointData(); -int i,size=pointdata->GetNumberOfArrays(); -for (i=0;iGetArray(i); - printf(" vtkVectorsVisu::Process array name %d:<%s> size:%d\n", i, array->GetName(), array->GetSize() ); -} -*/ - - -// vSliceMapperVec->SetLookupTable( vGreenToRedLut ); -// vSliceMapperVec->SetColorModeToMapScalars(); - -#if VTK_MAJOR_VERSION <= 5 - // .. -#else - _pdm->Update(); -#endif - - // Orientation -1 3D OK - - // Orientation 0 2D yz - if (GetOrientation()==0) - { - _trans->Identity(); - _trans->Translate(900,0,0); - _actor->SetUserTransform(_trans); - } - - - // Orientation 1 2D xz - if (GetOrientation()==1) - { - _trans->Identity(); - _trans->Translate(0,-900,0); - _actor->SetUserTransform(_trans); - } - - // Orientation 2 2D xy - if (GetOrientation()==2) - { - _trans->Identity(); - _trans->Translate(0,0,-900); - _actor->SetUserTransform(_trans); - } - - _actor->SetMapper( _pdm ); - _actor->GetProperty()->SetOpacity( GetOpacity() ); - }// if _active + }// if _active VisibilityActor(); } -- 2.47.1