From 8eab35636049813a6ce1b8f0e2d99e62dd280e0e Mon Sep 17 00:00:00 2001 From: davila Date: Thu, 11 Sep 2014 17:08:13 +0200 Subject: [PATCH] #2446 creaVtk Feature New Normal - Stream Tracer, Stream Line (interface, widget) --- .../bbs/boxes/StreamLineVisu_Interface.bbg | 152 +++++++++++------- .../bbs/boxes/StreamLineVisu_Interface.bbs | 44 +++-- .../bbs/boxes/StreamLine_Visu_Widget.bbg | 8 +- .../bbs/boxes/StreamLine_Visu_Widget.bbs | 2 + .../boxes/StreamlineExploration_Wideget.bbg | 112 +++++++++++++ .../boxes/StreamlineExploration_Wideget.bbs | 55 +++++++ .../bbs/boxes/TensorsExploration_Wideget.bbg | 134 +++++++++++++++ .../bbs/boxes/TensorsExploration_Wideget.bbs | 63 ++++++++ .../bbs/boxes/VectorsExploration_Wideget.bbg | 134 +++++++++++++++ .../bbs/boxes/VectorsExploration_Wideget.bbs | 63 ++++++++ .../src/bbcreaVtkStreamLineColorInfo.cxx | 82 ++++++++++ .../src/bbcreaVtkStreamLineColorInfo.h | 47 ++++++ .../src/bbcreaVtkStreamLineVisu.cxx | 4 +- .../src/bbcreaVtkStreamLineVisu.h | 8 +- lib/creaVtk/creaVtkStreamLine.cpp | 142 +++++++++++----- lib/creaVtk/creaVtkStreamLine.h | 7 - lib/creaVtk/creaVtkStreamTracer.cpp | 5 + lib/creaVtk/vtkStreamLineCreateColorInfo.cpp | 150 +++++++++++++++++ lib/creaVtk/vtkStreamLineCreateColorInfo.h | 69 ++++++++ lib/creaVtk/vtkTensorsVisu.cpp | 10 +- lib/creaVtk/vtkVectorsTensorsVisuBase.cpp | 32 +++- lib/creaVtk/vtkVectorsTensorsVisuBase.h | 8 +- lib/creaVtk/vtkVectorsVisu.cpp | 34 ++-- 23 files changed, 1212 insertions(+), 153 deletions(-) create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbs create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.h create mode 100644 lib/creaVtk/vtkStreamLineCreateColorInfo.cpp create mode 100644 lib/creaVtk/vtkStreamLineCreateColorInfo.h diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbg b/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbg index 9f2807d..a85677f 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbg @@ -10,50 +10,58 @@ AUTHOR:Author ?? COMPLEXBOX:TRUE COMPLEXBOXNAME:StreamLineVisu_Interface PACKAGENAME:creaVtk -COMPLEXOUTPUTS:6 +COMPLEXOUTPUTS:8 COMPLEX_PORT boxChange --151.416636:-79.170789:-900.000000 +-113.369025:-150.034464:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT widget --52.910690:-81.750377:-900.000000 +-48.630334:-149.760482:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT ActivePlane --99.469419:-81.033052:-900.000000 +-135.139054:-148.567562:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT TypeStreamLine -25.946770:-77.571286:-900.000000 +28.800341:-147.959366:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Opacity -51.069337:-77.325576:-900.000000 +89.116948:-151.518417:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT ScaleFactor -120.779151:-78.998068:-900.000000 +110.791653:-147.483768:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +ColorLaw +46.032088:-147.643538:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +SolidColor +63.483808:-147.675570:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:1 COMPLEX_PORT title --40.055135:89.461664:-900.000000 +61.722224:146.533080:-900.000000 FIN_COMPLEX_PORT -BOXES:11 +BOXES:13 BOX wx:LayoutLine:Box01 ISEXEC:FALSE --74.929187:-22.244359:-900.000000 --17.369187:-32.244359:-900.000000 +-38.566043:-18.841960:-900.000000 +18.993957:-28.841960:-900.000000 PORT -Orientation:"V" +Orientation:"H" FIN_BOX BOX wx:Slider:Box03 ISEXEC:FALSE -46.074662:58.311372:-900.000000 -97.474662:48.311372:-900.000000 +-21.459848:57.360182:-900.000000 +29.940152:47.360182:-900.000000 PORT In:"100" PORT @@ -68,26 +76,10 @@ PORT Title:"Opacity" FIN_BOX BOX -wx:RadioButton:Box04 -ISEXEC:FALSE -39.133296:87.337484:-900.000000 -102.853296:77.337484:-900.000000 -PORT -In:"2" -PORT -In0:"Tube" -PORT -In1:"Ribbon" -PORT -In2:"Line" -PORT -Title:"Form" -FIN_BOX -BOX wx:CheckBox:Box06 ISEXEC:FALSE --102.563782:79.117358:-900.000000 --56.988782:69.117358:-900.000000 +-149.172105:78.641763:-900.000000 +-103.597105:68.641763:-900.000000 PORT In:"false" PORT @@ -98,8 +90,8 @@ FIN_BOX BOX std:MultipleInputs:Box07 ISEXEC:FALSE --151.450986:-36.762937:-900.000000 --105.875986:-46.762937:-900.000000 +-111.025399:-98.590305:-900.000000 +-65.450399:-108.590305:-900.000000 PORT BoxProcessMode:"Reactive" FIN_BOX @@ -114,8 +106,8 @@ FIN_BOX BOX wx:Slider:Box09 ISEXEC:FALSE -73.828180:37.041549:-900.000000 -125.228180:27.041549:-900.000000 +54.804375:61.772496:-900.000000 +106.204375:51.772496:-900.000000 PORT ChangeResolution:"true" PORT @@ -145,25 +137,53 @@ ISEXEC:FALSE -49.451026:-44.289828:-900.000000 8.108974:-54.289828:-900.000000 PORT -Orientation:"H" +Orientation:"V" PORT WinTitle:"StreamLine" FIN_BOX BOX wx:LayoutTab:Box16 ISEXEC:FALSE --60.941887:-62.362352:-900.000000 --3.381887:-72.362352:-900.000000 +-55.035744:-61.476431:-900.000000 +2.524256:-71.476431:-900.000000 FIN_BOX BOX wx:LayoutLine:Box14 ISEXEC:FALSE -37.283684:5.910521:-900.000000 -94.843684:-4.089479:-900.000000 +27.278677:10.555703:-900.000000 +84.838677:0.555703:-900.000000 PORT Orientation:"H" FIN_BOX -CONNECTIONS:20 +BOX +wx:ComboBox:Box15 +ISEXEC:FALSE +-77.204288:85.611035:-900.000000 +-31.629288:75.611035:-900.000000 +PORT +In:"Tube Ribbon Line " +PORT +Selection:"2" +PORT +Title:"Form" +FIN_BOX +BOX +wx:ComboBox:Box17 +ISEXEC:FALSE +-45.746054:70.570954:-900.000000 +-0.171054:60.570954:-900.000000 +PORT +In:"Direction Magnitude Solide" +PORT +Title:"Color law" +FIN_BOX +BOX +wx:ColourSelectorButton:Box18 +ISEXEC:FALSE +12.845442:104.821885:-900.000000 +84.020442:94.821885:-900.000000 +FIN_BOX +CONNECTIONS:26 CONNECTION Box06:BoxChange:Box07:In2 NumberOfControlPoints:0 @@ -171,12 +191,6 @@ CONNECTION Box06:Out:ActivePlane:ActivePlane NumberOfControlPoints:0 CONNECTION -Box04:Out:TypeStreamLine:TypeStreamLine -NumberOfControlPoints:0 -CONNECTION -Box04:BoxChange:Box07:In4 -NumberOfControlPoints:0 -CONNECTION Box03:BoxChange:Box07:In6 NumberOfControlPoints:0 CONNECTION @@ -198,30 +212,54 @@ CONNECTION Box10:Out:ScaleFactor:ScaleFactor NumberOfControlPoints:0 CONNECTION -Box01:Widget:Box12:Widget1 +Box12:Widget:Box16:Widget1 NumberOfControlPoints:0 CONNECTION -Box06:Widget:Box01:Widget1 +Box16:Widget:widget:widget NumberOfControlPoints:0 CONNECTION -Box12:Widget:Box16:Widget1 +title:title:Box12:WinTitle NumberOfControlPoints:0 CONNECTION -Box16:Widget:widget:widget +Box15:BoxChange:Box07:In5 NumberOfControlPoints:0 CONNECTION -title:title:Box12:WinTitle +Box17:BoxChange:Box07:In3 +NumberOfControlPoints:0 +CONNECTION +Box15:Out:TypeStreamLine:TypeStreamLine +NumberOfControlPoints:0 +CONNECTION +Box17:Out:ColorLaw:ColorLaw +NumberOfControlPoints:0 +CONNECTION +Box09:Widget:Box14:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box14:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box15:Widget:Box01:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:Box01:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box18:Out:SolidColor:SolidColor +NumberOfControlPoints:0 +CONNECTION +Box18:BoxChange:Box07:In4 NumberOfControlPoints:0 CONNECTION -Box03:Widget:Box14:Widget1 +Box06:Widget:Box14:Widget1 NumberOfControlPoints:0 CONNECTION -Box09:Widget:Box14:Widget2 +Box18:Widget:Box01:Widget3 NumberOfControlPoints:0 CONNECTION -Box14:Widget:Box01:Widget2 +Box14:Widget:Box12:Widget1 NumberOfControlPoints:0 CONNECTION -Box04:Widget:Box12:Widget2 +Box01:Widget:Box12:Widget2 NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbs b/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbs index 22c7878..a8dfdc5 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamLineVisu_Interface.bbs @@ -16,7 +16,7 @@ description "Description ??" category "" new LayoutLine Box01 - set Box01.Orientation "V" + set Box01.Orientation "H" new Slider Box03 set Box03.In "100" @@ -26,13 +26,6 @@ new Slider Box03 set Box03.ReactiveOnTrack "true" set Box03.Title "Opacity" -new RadioButton Box04 - set Box04.In "2" - set Box04.In0 "Tube" - set Box04.In1 "Ribbon" - set Box04.In2 "Line" - set Box04.Title "Form" - new CheckBox Box06 set Box06.In "false" set Box06.ReactiveOnKeystroke "true" @@ -57,7 +50,7 @@ new Div Box10 set Box10.In2 "100" new LayoutLine Box12 - set Box12.Orientation "H" + set Box12.Orientation "V" set Box12.WinTitle "StreamLine" new LayoutTab Box16 @@ -65,31 +58,48 @@ new LayoutTab Box16 new LayoutLine Box14 set Box14.Orientation "H" +new ComboBox Box15 + set Box15.In "Tube Ribbon Line " + set Box15.Selection "2" + set Box15.Title "Form" + +new ComboBox Box17 + set Box17.In "Direction Magnitude Solide" + set Box17.Title "Color law" + +new ColourSelectorButton Box18 + connect Box06.BoxChange Box07.In2 -connect Box04.BoxChange Box07.In4 connect Box03.BoxChange Box07.In6 connect Box03.Out Box08.In1 connect Box09.Out Box10.In1 connect Box09.BoxChange Box07.In7 -connect Box01.Widget Box12.Widget1 -connect Box06.Widget Box01.Widget1 connect Box12.Widget Box16.Widget1 -connect Box03.Widget Box14.Widget1 -connect Box09.Widget Box14.Widget2 -connect Box14.Widget Box01.Widget2 -connect Box04.Widget Box12.Widget2 +connect Box15.BoxChange Box07.In5 +connect Box17.BoxChange Box07.In3 +connect Box09.Widget Box14.Widget3 +connect Box03.Widget Box14.Widget2 +connect Box15.Widget Box01.Widget1 +connect Box17.Widget Box01.Widget2 +connect Box18.BoxChange Box07.In4 +connect Box06.Widget Box14.Widget1 +connect Box18.Widget Box01.Widget3 +connect Box14.Widget Box12.Widget1 +connect Box01.Widget Box12.Widget2 # Complex input ports input title Box12.WinTitle " " # Complex output ports output ActivePlane Box06.Out " " -output TypeStreamLine Box04.Out " " output boxChange Box07.BoxChange " " output Opacity Box08.Out " " output ScaleFactor Box10.Out " " output widget Box16.Widget " " +output TypeStreamLine Box15.Out " " +output ColorLaw Box17.Out " " +output SolidColor Box18.Out " " message diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbg index 526528b..d20666e 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbg +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbg @@ -67,7 +67,7 @@ ISEXEC:FALSE 44.739035:48.135067:-900.000000 90.314035:38.135067:-900.000000 FIN_BOX -CONNECTIONS:14 +CONNECTIONS:16 CONNECTION Box01:ActivePlane:Box00:Active NumberOfControlPoints:0 @@ -110,4 +110,10 @@ NumberOfControlPoints:0 CONNECTION Title:Title:Box01:title NumberOfControlPoints:0 +CONNECTION +Box01:SolidColor:Box00:Color +NumberOfControlPoints:0 +CONNECTION +Box01:ColorLaw:Box00:ColorLaw +NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbs index 03463e2..0a7c285 100644 --- a/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbs +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamLine_Visu_Widget.bbs @@ -38,6 +38,8 @@ connect Box02.BoxChange Box00.BoxExecute connect Box04.Out Box00.Renderer connect Box04.Out Box03.Renderer connect Box02.BoxChange Box03.BoxExecute +connect Box01.SolidColor Box00.Color +connect Box01.ColorLaw Box00.ColorLaw # Complex input ports input polydata Box00.PolyData " " diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbg new file mode 100644 index 0000000..ad2d054 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbg @@ -0,0 +1,112 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:StreamlineExploration_Widget +PACKAGENAME:creaVtk +COMPLEXOUTPUTS:1 +COMPLEX_PORT +widget +-87.086702:-131.675720:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:3 +COMPLEX_PORT +vtkImageData_vectors +-202.201495:171.786415:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +vtkRenderer +128.828216:174.474869:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Title +-83.966322:173.231649:-900.000000 +FIN_COMPLEX_PORT +BOXES:7 +BOX +vtk:UpdateRender:Box22 +ISEXEC:FALSE +168.162416:-18.581651:-900.000000 +213.737416:-28.581651:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +wx:LayoutTab:Box17 +ISEXEC:FALSE +-89.942511:-71.713124:-900.000000 +-32.382511:-81.713124:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box23 +ISEXEC:FALSE +76.506639:18.351379:-900.000000 +122.081639:8.351379:-900.000000 +PORT +BoxProcessMode:"Reactive" +FIN_BOX +BOX +creaVtk:PlaneWidget_StreamLineVisu_Widget:Box30 +ISEXEC:FALSE +-128.471084:73.231403:-900.000000 +-57.296084:63.231403:-900.000000 +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box26 +ISEXEC:FALSE +-208.540015:141.393307:-900.000000 +-137.365015:131.393307:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box28 +ISEXEC:FALSE +123.517825:137.982960:-900.000000 +169.092825:127.982960:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box14 +ISEXEC:FALSE +-114.309291:-7.256705:-900.000000 +-56.749291:-17.256705:-900.000000 +FIN_BOX +CONNECTIONS:11 +CONNECTION +Box23:BoxChange:Box22:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box30:boxchange:Box23:In5 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:widget:widget +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Box30:In +NumberOfControlPoints:0 +CONNECTION +vtkImageData_vectors:vtkImageData_vectors:Box26:In +NumberOfControlPoints:0 +CONNECTION +vtkRenderer:vtkRenderer:Box28:In +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box22:Renderer +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box30:Renderer +NumberOfControlPoints:0 +CONNECTION +Title:Title:Box14:WinTitle +NumberOfControlPoints:0 +CONNECTION +Box30:Widget:Box14:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box17:Widget1 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbs new file mode 100644 index 0000000..7759d21 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbs @@ -0,0 +1,55 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/StreamlineExploration_Wideget.bbs +# ---------------------------------- + +include std +include itkvtk +include vtk +include wx +include std +include creaVtk + +define StreamlineExploration_Widget creaVtk + +author "Author ??" +description "Description ??" + +category "" + +new UpdateRender Box22 + set Box22.Active "true" + +new LayoutTab Box17 + +new MultipleInputs Box23 + set Box23.BoxProcessMode "Reactive" + +new PlaneWidget_StreamLineVisu_Widget Box30 + +new vtkImageDataPointerRelay Box26 + +new MagicBox Box28 + +new LayoutLine Box14 + + +connect Box23.BoxChange Box22.BoxExecute +connect Box30.boxchange Box23.In5 +connect Box26.Out Box30.In +connect Box28.Out Box22.Renderer +connect Box28.Out Box30.Renderer +connect Box30.Widget Box14.Widget1 +connect Box14.Widget Box17.Widget1 + +# Complex input ports +input vtkImageData_vectors Box26.In " " +input vtkRenderer Box28.In " " +input Title Box14.WinTitle " " + +# Complex output ports +output widget Box17.Widget " " + +message + +endefine diff --git a/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbg new file mode 100644 index 0000000..1f823c2 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbg @@ -0,0 +1,134 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:TensorsExploration_Widget +PACKAGENAME:creaVtk +COMPLEXOUTPUTS:1 +COMPLEX_PORT +widget +-152.287466:-34.191082:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:3 +COMPLEX_PORT +vtkImageData_tensors +-84.383009:173.600108:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +vtkRenderer +28.811510:167.511681:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Title +-134.616966:175.362823:-900.000000 +FIN_COMPLEX_PORT +BOXES:8 +BOX +vtk:UpdateRender:Box22 +ISEXEC:FALSE +50.421230:29.527651:-900.000000 +95.996230:19.527651:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +wx:LayoutTab:Box17 +ISEXEC:FALSE +-155.143275:4.881948:-900.000000 +-97.583275:-5.118052:-900.000000 +PORT +WinTitle:"VectorsTensors Analysis" +FIN_BOX +BOX +std:MultipleInputs:Box23 +ISEXEC:FALSE +3.709669:55.066372:-900.000000 +49.284669:45.066372:-900.000000 +PORT +BoxProcessMode:"Reactive" +FIN_BOX +BOX +wx:LayoutLine:Box16 +ISEXEC:FALSE +-66.220097:53.516083:-900.000000 +-8.660097:43.516083:-900.000000 +PORT +WinTitle:"Tensors" +FIN_BOX +BOX +creaVtk:VolumeTensorVisu_Widget:Box19 +ISEXEC:FALSE +15.919649:97.987432:-900.000000 +87.094649:87.987432:-900.000000 +FIN_BOX +BOX +creaVtk:PlaneTensorVisu_Widget:Box21 +ISEXEC:FALSE +-83.100097:95.241049:-900.000000 +-11.925097:85.241049:-900.000000 +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box27 +ISEXEC:FALSE +-89.314298:137.998626:-900.000000 +-18.139298:127.998626:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box28 +ISEXEC:FALSE +21.602067:137.982960:-900.000000 +67.177067:127.982960:-900.000000 +FIN_BOX +CONNECTIONS:15 +CONNECTION +Box23:BoxChange:Box22:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box19:boxchange:Box23:In3 +NumberOfControlPoints:0 +CONNECTION +Box19:Widget:Box16:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box21:boxchange:Box23:In4 +NumberOfControlPoints:0 +CONNECTION +Box21:Widget:Box16:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:widget:widget +NumberOfControlPoints:0 +CONNECTION +Box27:Out:Box21:vtkImageData +NumberOfControlPoints:0 +CONNECTION +Box27:Out:Box19:vtkImageData +NumberOfControlPoints:0 +CONNECTION +vtkImageData_tensors:vtkImageData_tensors:Box27:In +NumberOfControlPoints:0 +CONNECTION +vtkRenderer:vtkRenderer:Box28:In +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box22:Renderer +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box21:renderer +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box19:renderer +NumberOfControlPoints:0 +CONNECTION +Box16:Widget:Box17:Widget1 +NumberOfControlPoints:0 +CONNECTION +Title:Title:Box17:WinTitle +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbs new file mode 100644 index 0000000..6d962b5 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbs @@ -0,0 +1,63 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/TensorsExploration_Wideget.bbs +# ---------------------------------- + +include std +include itkvtk +include vtk +include wx +include std +include creaVtk + +define TensorsExploration_Widget creaVtk + +author "Author ??" +description "Description ??" + +category "" + +new UpdateRender Box22 + set Box22.Active "true" + +new LayoutTab Box17 + set Box17.WinTitle "VectorsTensors Analysis" + +new MultipleInputs Box23 + set Box23.BoxProcessMode "Reactive" + +new LayoutLine Box16 + set Box16.WinTitle "Tensors" + +new VolumeTensorVisu_Widget Box19 + +new PlaneTensorVisu_Widget Box21 + +new vtkImageDataPointerRelay Box27 + +new MagicBox Box28 + + +connect Box23.BoxChange Box22.BoxExecute +connect Box19.boxchange Box23.In3 +connect Box19.Widget Box16.Widget2 +connect Box21.boxchange Box23.In4 +connect Box21.Widget Box16.Widget1 +connect Box27.Out Box21.vtkImageData +connect Box27.Out Box19.vtkImageData +connect Box28.Out Box22.Renderer +connect Box28.Out Box21.renderer +connect Box28.Out Box19.renderer +connect Box16.Widget Box17.Widget1 + +# Complex input ports +input vtkImageData_tensors Box27.In " " +input vtkRenderer Box28.In " " +input Title Box17.WinTitle " " + +# Complex output ports +output widget Box17.Widget " " + +message + +endefine diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbg b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbg new file mode 100644 index 0000000..1efcce9 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbg @@ -0,0 +1,134 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:VectorsExploration_Widget +PACKAGENAME:creaVtk +COMPLEXOUTPUTS:1 +COMPLEX_PORT +widget +-153.237662:-116.543147:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:3 +COMPLEX_PORT +vtkImageData_vectors +-202.201495:171.786415:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +vtkRenderer +-59.902043:169.419594:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Title +-96.827992:172.211702:-900.000000 +FIN_COMPLEX_PORT +BOXES:8 +BOX +vtk:UpdateRender:Box22 +ISEXEC:FALSE +-20.567843:-23.636926:-900.000000 +25.007157:-33.636926:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +wx:LayoutTab:Box17 +ISEXEC:FALSE +-180.737946:-42.745057:-900.000000 +-123.177946:-52.745057:-900.000000 +PORT +WinTitle:"VectorsTensors Analysis" +FIN_BOX +BOX +std:MultipleInputs:Box23 +ISEXEC:FALSE +-112.223620:13.296104:-900.000000 +-66.648620:3.296104:-900.000000 +PORT +BoxProcessMode:"Reactive" +FIN_BOX +BOX +creaVtk:PlaneVectorVisu_Widget:Box41 +ISEXEC:FALSE +-290.289955:71.849699:-900.000000 +-219.114955:61.849699:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box14 +ISEXEC:FALSE +-221.145840:-2.517243:-900.000000 +-163.585840:-12.517243:-900.000000 +PORT +WinTitle:"Field" +FIN_BOX +BOX +creaVtk:VolumeVectorVisu_Widget:Box18 +ISEXEC:FALSE +-214.258652:71.383715:-900.000000 +-143.083652:61.383715:-900.000000 +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box26 +ISEXEC:FALSE +-208.540015:141.393307:-900.000000 +-137.365015:131.393307:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box28 +ISEXEC:FALSE +-65.212434:132.927685:-900.000000 +-19.637434:122.927685:-900.000000 +FIN_BOX +CONNECTIONS:15 +CONNECTION +Box23:BoxChange:Box22:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box41:boxchange:Box23:In1 +NumberOfControlPoints:0 +CONNECTION +Box41:Widget:Box14:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box18:Widget:Box14:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box18:boxchange:Box23:In2 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:widget:widget +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Box18:vtkImageData +NumberOfControlPoints:0 +CONNECTION +vtkImageData_vectors:vtkImageData_vectors:Box26:In +NumberOfControlPoints:0 +CONNECTION +vtkRenderer:vtkRenderer:Box28:In +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box22:Renderer +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box41:renderer +NumberOfControlPoints:0 +CONNECTION +Box28:Out:Box18:renderer +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Box41:vtkImageData +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box17:Widget1 +NumberOfControlPoints:0 +CONNECTION +Title:Title:Box14:WinTitle +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbs b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbs new file mode 100644 index 0000000..bec8a33 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbs @@ -0,0 +1,63 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsExploration_Wideget.bbs +# ---------------------------------- + +include std +include itkvtk +include vtk +include wx +include std +include creaVtk + +define VectorsExploration_Widget creaVtk + +author "Author ??" +description "Description ??" + +category "" + +new UpdateRender Box22 + set Box22.Active "true" + +new LayoutTab Box17 + set Box17.WinTitle "VectorsTensors Analysis" + +new MultipleInputs Box23 + set Box23.BoxProcessMode "Reactive" + +new PlaneVectorVisu_Widget Box41 + +new LayoutLine Box14 + set Box14.WinTitle "Field" + +new VolumeVectorVisu_Widget Box18 + +new vtkImageDataPointerRelay Box26 + +new MagicBox Box28 + + +connect Box23.BoxChange Box22.BoxExecute +connect Box41.boxchange Box23.In1 +connect Box41.Widget Box14.Widget1 +connect Box18.Widget Box14.Widget2 +connect Box18.boxchange Box23.In2 +connect Box26.Out Box18.vtkImageData +connect Box28.Out Box22.Renderer +connect Box28.Out Box41.renderer +connect Box28.Out Box18.renderer +connect Box26.Out Box41.vtkImageData +connect Box14.Widget Box17.Widget1 + +# Complex input ports +input vtkImageData_vectors Box26.In " " +input vtkRenderer Box28.In " " +input Title Box14.WinTitle " " + +# Complex output ports +output widget Box17.Widget " " + +message + +endefine diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.cxx new file mode 100644 index 0000000..1a89926 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.cxx @@ -0,0 +1,82 @@ +//===== +// 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 "bbcreaVtkStreamLineColorInfo.h" +#include "bbcreaVtkPackage.h" + + +#include "vtkStreamLineCreateColorInfo.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StreamLineColorInfo) +BBTK_BLACK_BOX_IMPLEMENTATION(StreamLineColorInfo,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 StreamLineColorInfo::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 = " < ); BBTK_DECLARE_OUTPUT(Out,vtkProp3D*); BBTK_PROCESS(Process); void Process(); @@ -55,15 +57,15 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(StreamLineVisu,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("vtk Stream Line"); BBTK_CATEGORY("empty"); - BBTK_INPUT(StreamLineVisu,In,"(needed) vtkDataObject. (Example vtkDataObject<-vtkDataSet<-vtkPointSet<-vtkPolyData (parrent class) )",vtkDataObject*,""); - BBTK_INPUT(StreamLineVisu,Source,"(needed) vtkDataSet. (Example vtkPointSource->GetOutput() )",vtkDataSet*,""); - BBTK_INPUT(StreamLineVisu,Active,"Active (false default)",bool,""); BBTK_INPUT(StreamLineVisu,PolyData,"(needed) vtkPolyData.",vtkPolyData*,""); BBTK_INPUT(StreamLineVisu,Opacity,"Opacity (1 default)",double,""); BBTK_INPUT(StreamLineVisu,Renderer,"vtkRenderer",vtkRenderer*,""); BBTK_INPUT(StreamLineVisu,ScaleFactor,"Scale factor",double,""); BBTK_INPUT(StreamLineVisu,TypeForm,"Type of form : 0(default) Tubes, 1 Ribbons,2 Lines",int,""); + BBTK_INPUT(StreamLineVisu,ColorLaw,"(default 0) 0=Direction 1=MagnitudDirection 2=Solid",int,""); + BBTK_INPUT(StreamLineVisu,Color,"In case of ColorLaw=Solid the color is [R,G,B] 0..1",std::vector,""); + BBTK_OUTPUT(StreamLineVisu,Out,"vtkProp3D of an vtkActor",vtkProp3D*,""); BBTK_END_DESCRIBE_BLACK_BOX(StreamLineVisu); diff --git a/lib/creaVtk/creaVtkStreamLine.cpp b/lib/creaVtk/creaVtkStreamLine.cpp index 31ea59b..fedfcb6 100644 --- a/lib/creaVtk/creaVtkStreamLine.cpp +++ b/lib/creaVtk/creaVtkStreamLine.cpp @@ -32,12 +32,12 @@ #include "vtkProperty.h" #include "vtkPolyDataWriter.h" + creaVtkStreamLine::creaVtkStreamLine() { - _source = vtkPointSource::New(); - _vPointWidget = vtkPointWidget::New(); +// _source = vtkPointSource::New(); +// _vPointWidget = vtkPointWidget::New(); _streamMapper2 = vtkPolyDataMapper::New(); - _streamer = vtkStreamTracer::New(); _tubefilter = vtkTubeFilter::New(); _ribbonfilter = vtkRibbonFilter::New(); } @@ -48,11 +48,6 @@ creaVtkStreamLine::~creaVtkStreamLine() { } -//--------------------------------------------- -void creaVtkStreamLine::SetSourcePoints( vtkDataSet* sourcepoints) -{ - _sourcePoints = sourcepoints; -} //--------------------------------------------- void creaVtkStreamLine::SetPolyData( vtkPolyData* polydata) @@ -65,13 +60,10 @@ void creaVtkStreamLine::Process() { printf("EED creaVtkStreamLine::Process Start \n"); - if (_polydata!=NULL){ - - if (_active==false) - { //bbGetInputPlaneFieldShow - _vPointWidget->Off(); - } else { - + if (_polydata!=NULL) + { + if (_active==true) + { /* //---------------------------Stream Lines----------------------- _vPointWidget->SetInput( (vtkDataSet*) GetDataObject() ); @@ -106,57 +98,85 @@ void creaVtkStreamLine::Process() // _streamer->Print(std::cout); // _streamer->GetOutput()->Print(std::cout); -//EED -//vtkPolyDataWriter *writer3 = vtkPolyDataWriter::New(); -//writer3->SetFileName( "/home/davila/Borrame/streamline-eed.vtk" ); -//writer3->SetInput( _streamer->GetOutput() ); -//writer3->Write(); //EED 3aout2011 _tubefilter->SetInput( _streamer->GetOutput() ); _ribbonfilter->SetInput(_streamer->GetOutput()); */ - _tubefilter->SetInput( _polydata ); - _ribbonfilter->SetInput( _polydata ); - + _polydata->Modified(); - _tubefilter->SetRadius( GetScaleFactor() ); - _tubefilter->SetNumberOfSides(12); - _tubefilter->SetVaryRadiusToVaryRadiusOff(); - - _ribbonfilter->SetWidth( GetScaleFactor() ); - _ribbonfilter->SetWidthFactor( GetScaleFactor()*10 ); - _ribbonfilter->GlobalWarningDisplayOff (); //EED this is to avoid the "BEVEL WARNING" + printf("EED creaVtkStreamLine::Process 0 %p \n", _polydata); - _polydata->Modified(); -//BORRAME _streamer->GetOutput()->GetScalarRange( range ); if (GetTypeForm()==0) { + printf("EED creaVtkStreamLine::Process 1 \n"); + _tubefilter->SetInput( _polydata ); + _tubefilter->SetRadius( GetScaleFactor() ); + _tubefilter->SetNumberOfSides(12); + _tubefilter->SetVaryRadiusToVaryRadiusOff(); + _tubefilter->Modified(); + _tubefilter->Update(); _streamMapper2->SetInput( _tubefilter->GetOutput() ); } if (GetTypeForm()==1) { + printf("EED creaVtkStreamLine::Process 2 \n"); + _ribbonfilter->SetInput( _polydata ); + _ribbonfilter->SetWidth( GetScaleFactor() ); + _ribbonfilter->SetWidthFactor( GetScaleFactor()*10 ); + _ribbonfilter->GlobalWarningDisplayOff (); //EED this is to avoid the "BEVEL WARNING" + _ribbonfilter->Modified(); + _ribbonfilter->Update(); _streamMapper2->SetInput( _ribbonfilter->GetOutput() ); } if (GetTypeForm()==2) { + printf("EED creaVtkStreamLine::Process 3 \n"); _streamMapper2->SetInput( _polydata ); } + printf("EED creaVtkStreamLine::Process 4 \n"); //EED _streamMapper2->SetLookupTable(vGreenToRedLut); - - -/* - vtkPolyData *pd = _streamer->GetOutput(); - vtkPointData *pointdata = pd->GetPointData(); + +/* +vtkDoubleArray* _velocity = vtkDoubleArray::New(); +_velocity->SetName("velocity"); // ... fill the colors array +for (int ivelocity=0; ivelocity<=4000; ivelocity++ ) +{ + _velocity->InsertTuple3 (ivelocity, 1, 0, 0); +} +_polydata->GetPointData()->AddArray(_velocity); +*/ + printf("EED creaVtkStreamLine::Process A \n" ); + + vtkPointData *data = _polydata->GetPointData(); + +printf("EED -------------------------------------------\n"); + _polydata->Print(std::cout); +printf("EED -------------------------------------------\n"); + data->Print(std::cout); +printf("EED -------------------------------------------\n"); + +// vtkFieldData *data = _polydata->GetFieldData(); // vtkDataArray *da = pointdata->GetArray("Normals"); - int i,sizeDa = pointdata->GetNumberOfArrays(); + int i,sizeDa = data->GetNumberOfArrays(); printf("EED creaVtkStreamLine::Process sizeDa %d \n", sizeDa ); for (i=0;iGetArrayName(i) ); + printf("EED creaVtkStreamLine::Process-name %d, %s \n", i, data->GetArrayName(i) ); + data->GetArray(i)->Print(std::cout); +printf("EED -------------------------------------------\n"); } + + + +/* +//EED + vtkPolyDataWriter *writer3 = vtkPolyDataWriter::New(); + writer3->SetFileName( "/home/davila/Borrame/streamline-eed-c.vtk" ); + writer3->SetInput( _polydata ); + writer3->Write(); */ @@ -175,15 +195,52 @@ void creaVtkStreamLine::Process() //Config 1 (Normals) // _streamMapper2->ScalarVisibilityOn(); // _streamMapper2->SetScalarModeToUsePointFieldData(); -// _streamMapper2->SetLookupTable( vLutEED ); +// _streamMapper2->SetLookupTable( _LutEED ); // _streamMapper2->SelectColorArray( "Normals" ); + //Config 2 Orientation vectors _streamMapper2->ScalarVisibilityOn(); _streamMapper2->SetScalarModeToUsePointFieldData(); _streamMapper2->SetLookupTable( _LutEED ); - _streamMapper2->SelectColorArray( "velocity" ); + + if (_colorlaw==0) + { + _LutEED->SetVectorModeToRGBColors(); + _streamMapper2->SelectColorArray( "creaColorDirection" ); + } + if (_colorlaw==1) + { +// _LutEED->SetVectorModeToMagnitude(); + vtkLookupTable *lookuptable = vtkLookupTable::New(); + _streamMapper2->SetLookupTable( lookuptable ); + _streamMapper2->SelectColorArray( "creaMagnitud" ); + } + if (_colorlaw==2) + { + + _streamMapper2->SelectColorArray( "xx" ); + _actor->GetProperty()->SetColor(_colorR,_colorG,_colorB); + } + +/* + _vtkglyph->SetInput( GetDataObject() ); + _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); + _vtkglyph->SetScaleModeToScaleByVector(); + _vtkglyph->SetColorModeToColorByVector(); + _vtkglyph->SetScaleFactor( GetScaleFactor() ); + _vtkglyph->Update(); + _pdm->SetInput( _vtkglyph->GetOutput()); + _pdm->SetScalarModeToUsePointFieldData(); + _pdm->SetLookupTable( _LutEED ); + _pdm->SelectColorArray( "GlyphVector" ); +*/ + + + + + //Config 3 Position // ??????? @@ -194,6 +251,9 @@ void creaVtkStreamLine::Process() VisibilityActor(); } // polydata + + printf("EED creaVtkStreamLine::Process End \n"); + } diff --git a/lib/creaVtk/creaVtkStreamLine.h b/lib/creaVtk/creaVtkStreamLine.h index 4f9c7fb..be264e7 100644 --- a/lib/creaVtk/creaVtkStreamLine.h +++ b/lib/creaVtk/creaVtkStreamLine.h @@ -38,7 +38,6 @@ #include "vtkPolyData.h" #include "vtkPolyDataMapper.h" #include "vtkRibbonFilter.h" -#include "vtkStreamTracer.h" #include "vtkTubeFilter.h" //--------------------------------------------- @@ -72,13 +71,7 @@ protected: //--------------------------------------------- private: - vtkPointWidget *_vPointWidget; - vtkDataSet *_sourcePoints; - vtkPointSource *_source; - vtkStreamTracer *_streamer; - vtkPolyData *_polydata; - vtkTubeFilter *_tubefilter; vtkRibbonFilter *_ribbonfilter; vtkPolyDataMapper *_streamMapper2; diff --git a/lib/creaVtk/creaVtkStreamTracer.cpp b/lib/creaVtk/creaVtkStreamTracer.cpp index ba22dee..5c44dc0 100644 --- a/lib/creaVtk/creaVtkStreamTracer.cpp +++ b/lib/creaVtk/creaVtkStreamTracer.cpp @@ -67,8 +67,11 @@ void creaVtkStreamTracer::SetSourcePoints( vtkDataSet* sourcepoints) //----------------------------------------------------------------------------- void creaVtkStreamTracer::Process() { +printf("EED creaVtkStreamTracer::Process() Start \n"); if (_active==true) { +printf("EED creaVtkStreamTracer::Process() A\n"); + // if (_firsttime==true) // { // _firsttime=false; @@ -98,8 +101,10 @@ void creaVtkStreamTracer::Process() // _streamer->Print(std::cout); // _streamer->GetOutput()->Print(std::cout); +printf("EED creaVtkStreamTracer::Process() B\n"); } // active +printf("EED creaVtkStreamTracer::Process() End \n"); } diff --git a/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp b/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp new file mode 100644 index 0000000..c088d5e --- /dev/null +++ b/lib/creaVtk/vtkStreamLineCreateColorInfo.cpp @@ -0,0 +1,150 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sante) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ +*/ + +#include "vtkStreamLineCreateColorInfo.h" +#include "vtkIdList.h" +#include "vtkCellArray.h" +#include "vtkCharArray.h" +#include "vtkDoubleArray.h" +#include "vtkPointData.h" + + +vtkStreamLineCreateColorInfo::vtkStreamLineCreateColorInfo() +{ + _StreamLinesIn = NULL; + _vtkidlist = vtkIdList::New(); + +} + +vtkStreamLineCreateColorInfo::~vtkStreamLineCreateColorInfo() +{ +} + +//--------------------------------------------- +void vtkStreamLineCreateColorInfo::SetStreamLinesIn(vtkPolyData* streamlinein) +{ + _StreamLinesIn = streamlinein; +} + +//--------------------------------------------- +vtkPolyData *vtkStreamLineCreateColorInfo::GetStreamLinesOut() +{ + return _StreamLinesIn; +} + +//--------------------------------------------- +void vtkStreamLineCreateColorInfo::Run() +{ + vtkCellArray *vtkcellarray = _StreamLinesIn->GetLines(); + long int nLinesCell = vtkcellarray->GetNumberOfCells(); + long int numberofids; + long int ii,jj,iLine; + double point1[3]; + double point2[3]; + long int id,id1,id2; + double vx,vy,vz,mag; + double colorDirX,colorDirY,colorDirZ; + + _StreamLinesIn->Update(); + vtkCharArray *mask = vtkCharArray::New(); + vtkDoubleArray *magnitud = vtkDoubleArray::New(); + vtkDoubleArray *velocity = vtkDoubleArray::New(); + vtkDoubleArray *colorDirection = vtkDoubleArray::New(); + + mask->SetName("creaMask"); // ... fill the colors array + mask->SetNumberOfComponents(1); //3d normals (ie x,y,z) + mask->SetNumberOfTuples(_StreamLinesIn->GetNumberOfPoints()); + + magnitud->SetName("creaMagnitud"); // ... fill the colors array + magnitud->SetNumberOfComponents(1); //3d normals (ie x,y,z) + magnitud->SetNumberOfTuples(_StreamLinesIn->GetNumberOfPoints()); + + velocity->SetName("creaVelocity"); // ... fill the colors array + velocity->SetNumberOfComponents(3); //3d normals (ie x,y,z) + velocity->SetNumberOfTuples(_StreamLinesIn->GetNumberOfPoints()); + + colorDirection->SetName("creaColorDirection"); // ... fill the colors array + colorDirection->SetNumberOfComponents(3); //3d normals (ie x,y,z) + colorDirection->SetNumberOfTuples(_StreamLinesIn->GetNumberOfPoints()); + + + for (ii=0;ii<_StreamLinesIn->GetNumberOfPoints();ii++) + { + mask->SetTuple1 (ii, 0); + magnitud->SetTuple1 (ii, 0); + velocity->SetTuple3 (ii, 0, 0, 0); + colorDirection->SetTuple3 (ii, 0, 0, 0); + } + + // FOR EACH LINE + ii=0; + for ( iLine=0 ; iLineGetCell(ii, _vtkidlist ); + numberofids = _vtkidlist->GetNumberOfIds(); + + for (jj=0;jjGetId(jj); + if (jj-1>=0) { id1 = _vtkidlist->GetId(jj-1); } else {id1=id;} + if (jj+1GetId(jj+1);} else {id2=id;} + _StreamLinesIn->GetPoint( id1 ,point1); + _StreamLinesIn->GetPoint( id2 ,point2); + vx= point1[0]-point2[0]; + vy= point1[1]-point2[1]; + vz= point1[2]-point2[2]; + mag= sqrt( vx*vx +vy*vy + vz*vz ); + colorDirX=fabs(vx/mag); + colorDirY=fabs(vy/mag); + colorDirZ=fabs(vz/mag); + + mask->SetTuple1 (id, 1); + magnitud->SetTuple1 (id, mag); + velocity->SetTuple3 (id, vx,vy,vz); + colorDirection->SetTuple3 (id, colorDirX,colorDirY,colorDirZ); +} + + ii=ii+numberofids+1; + } // for iLine + + _StreamLinesIn->GetPointData()->AddArray( mask ); + _StreamLinesIn->GetPointData()->AddArray( magnitud ); + _StreamLinesIn->GetPointData()->AddArray( velocity ); + _StreamLinesIn->GetPointData()->AddArray( colorDirection ); + +} + +//--------------------------------------------- +void vtkStreamLineCreateColorInfo::Process() +{ + if (_StreamLinesIn!=NULL) + { + Run(); + } +} + + diff --git a/lib/creaVtk/vtkStreamLineCreateColorInfo.h b/lib/creaVtk/vtkStreamLineCreateColorInfo.h new file mode 100644 index 0000000..c6ae0c4 --- /dev/null +++ b/lib/creaVtk/vtkStreamLineCreateColorInfo.h @@ -0,0 +1,69 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sante) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ +*/ + +#ifndef _VTKSTREAMLINECREATECOLORINFO_H_ +#define _VTKSTREAMLINECREATECOLORINFO_H_ + +#include "vtkPolyData.h" + +//--------------------------------------------- +// Class Name: vtkStreamLineCreateColorInfo +// [classdescription] +//--------------------------------------------- + +class vtkStreamLineCreateColorInfo +{ + +//--------------------------------------------- +//Methods and attributes exposed to other classes +//--------------------------------------------- +public : + vtkStreamLineCreateColorInfo(); + ~vtkStreamLineCreateColorInfo(); + +//--Method template---------------------------- + void SetStreamLinesIn(vtkPolyData* streamlinein); + void Process(); + vtkPolyData* GetStreamLinesOut(); + +//--------------------------------------------- +//Methods and attributes exposed only to classes +//that are derived from this class +//--------------------------------------------- +protected: +//--------------------------------------------- +//Methods and attributes only visible by this class +//--------------------------------------------- +private: + vtkIdList* _vtkidlist; + vtkPolyData* _StreamLinesIn; + void Run(); + +}; + +//-end of _VTKSTREAMLINECREATECOLORINFO_H_------------------------------------------------------ +#endif diff --git a/lib/creaVtk/vtkTensorsVisu.cpp b/lib/creaVtk/vtkTensorsVisu.cpp index 5ed091f..c834ada 100644 --- a/lib/creaVtk/vtkTensorsVisu.cpp +++ b/lib/creaVtk/vtkTensorsVisu.cpp @@ -112,21 +112,21 @@ printf("EED vtkTensorsVisu::Process Start\n"); _pdm->SetInput( pdn->GetOutput() ); _pdm->ImmediateModeRenderingOn(); - _pdm->ScalarVisibilityOn(); - _pdm->SetScalarModeToUsePointFieldData(); + _pdm->ScalarVisibilityOn(); + _pdm->SetScalarModeToUsePointFieldData(); //EED _pdm->Update(); _actor->SetMapper( _pdm ); - _actor->GetProperty()->SetOpacity( GetOpacity() ); + _actor->GetProperty()->SetOpacity( GetOpacity() ); tg->ColorGlyphsOn(); // tg->ExtractEigenvaluesOn(); tg->SetColorModeToEigenvalues(); - _pdm->SetLookupTable( _LutEED ); - _pdm->SelectColorArray( "Normals" ); + _pdm->SetLookupTable( _LutEED ); + _pdm->SelectColorArray( "Normals" ); //int tcg = tg->GetColorGlyphs(); diff --git a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp index 0e52ef3..4c28724 100644 --- a/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp +++ b/lib/creaVtk/vtkVectorsTensorsVisuBase.cpp @@ -118,6 +118,7 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input double dirx,diry,dirz; +inIncr=3; printf("EED length %d %p\n", length,input); // mag = new double[length]; for (i = 0; i < length; ++i) @@ -125,7 +126,7 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input dirx = 0; diry = 0; dirz = 0; - sum = 0; + sum = 0; for (j = 0; j < inIncr; ++j) { if (j==0) dirx= static_cast(*input); @@ -141,6 +142,7 @@ void vtkLookupTableMapDirVectorEED(vtkLookupTableDirectionVector *self, T *input *output++ = (unsigned char) abs( (255*dirz/sum) ); *output++ = 255; // printf("%d %d %d ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum)); +// printf(" C %d %f %f %f \n",inIncr,dirx,diry,dirz); } // vtkLookupTableMapData(self, mag, output, length, 1, outFormat); @@ -312,20 +314,40 @@ void vtkVectorsTensorsVisuBase::VisibilityActor() if ( (_active==true) && (_actorAdded==false) ){ if (GetRenderer()!=NULL) { - GetRenderer()->AddActor(_actor); + GetRenderer()->AddActor(_actor); _actorAdded=true; - } // if Renderer + } // if Renderer } // if _active==true if ( (_active==false) && (_actorAdded==true) ){ if (GetRenderer()!=NULL) { - GetRenderer()->RemoveActor(_actor); + GetRenderer()->RemoveActor(_actor); _actorAdded=false; - } // if Renderer + } // if Renderer } // if _active==false } +//------------------------------------------------------------------------------ +void vtkVectorsTensorsVisuBase::SetColorLaw(int colorlaw) +{ + _colorlaw = colorlaw; +} + +//------------------------------------------------------------------------------ +void vtkVectorsTensorsVisuBase::SetColor(std::vector rgb) +{ + if (rgb.size()==3) + { + _colorR=rgb[0]; + _colorG=rgb[1]; + _colorB=rgb[2]; + } else { + _colorR=1; + _colorG=1; + _colorB=1; + } +} diff --git a/lib/creaVtk/vtkVectorsTensorsVisuBase.h b/lib/creaVtk/vtkVectorsTensorsVisuBase.h index c889b5b..2ca0d49 100644 --- a/lib/creaVtk/vtkVectorsTensorsVisuBase.h +++ b/lib/creaVtk/vtkVectorsTensorsVisuBase.h @@ -114,6 +114,8 @@ public : void SetScaleFactor(double); void SetOpacity(double); void SetTypeForm(int); + void SetColorLaw(int); + void SetColor(std::vector); bool GetActive(); vtkDataObject* GetDataObject(); @@ -148,12 +150,14 @@ private: protected: - bool _firsttime; - bool _active; + bool _firsttime; + bool _active; vtkSmartPointer _pdm; vtkSmartPointer _actor; vtkLookupTableDirectionVector *_LutEED; + int _colorlaw; + double _colorR,_colorG,_colorB; }; diff --git a/lib/creaVtk/vtkVectorsVisu.cpp b/lib/creaVtk/vtkVectorsVisu.cpp index 43df474..c8045e5 100644 --- a/lib/creaVtk/vtkVectorsVisu.cpp +++ b/lib/creaVtk/vtkVectorsVisu.cpp @@ -29,12 +29,16 @@ #include "vtkProperty.h" +//Borrame +#include "vtkPointData.h" + + //------------------------------------------------------------------------------ vtkVectorsVisu::vtkVectorsVisu() :vtkVectorsTensorsVisuBase() { _vtkarrowsource = vtkArrowSource::New(); - _vtkglyph = vtkGlyph3D::New(); + _vtkglyph = vtkGlyph3D::New(); } @@ -49,20 +53,30 @@ void vtkVectorsVisu::Process() printf("EED vtkVectorsVisu::Process() start\n"); if(_active==true) { -printf("EED vtkVectorsVisu::Process() 1\n"); _vtkglyph->SetInput( GetDataObject() ); -printf("EED vtkVectorsVisu::Process() 2\n"); _vtkglyph->SetSource( _vtkarrowsource->GetOutput() ); -printf("EED vtkVectorsVisu::Process() 3\n"); _vtkglyph->SetScaleModeToScaleByVector(); _vtkglyph->SetColorModeToColorByVector(); _vtkglyph->SetScaleFactor( GetScaleFactor() ); -printf("EED vtkVectorsVisu::Process() 4\n"); _vtkglyph->Update(); -printf("EED vtkVectorsVisu::Process() 5\n"); _pdm->SetInput( _vtkglyph->GetOutput()); -printf("EED vtkVectorsVisu::Process() 5.1\n"); + +vtkPointData *data = _vtkglyph->GetOutput()->GetPointData(); +printf("EED -------------------------------------------\n"); +_vtkglyph->GetOutput()->Print(std::cout); +printf("EED -------------------------------------------\n"); +data->Print(std::cout); +printf("EED -------------------------------------------\n"); +int i,sizeDa = data->GetNumberOfArrays(); +printf("EED vtkVectorsVisu::Process sizeDa %d \n", sizeDa ); +for (i=0;iGetArrayName(i) ); + data->GetArray(i)->Print(std::cout); + printf("EED -------------------------------------------\n"); +} + //EED _pdm->SetScalarRange( range ); //EED vtkPolyData *pd = vGlyphFlowPlane->GetOutput(); //EED vtkPointData *pointdata = pd->GetPointData(); @@ -74,23 +88,17 @@ printf("EED vtkVectorsVisu::Process() 5.1\n"); //EED pointdata->AddArray( nda ); //EED bbGetInputIn()->GetPointData()->AddArray( nda ); //EED2 _pdm->ScalarVisibilityOn(); -printf("EED vtkVectorsVisu::Process() 6\n"); _pdm->SetScalarModeToUsePointFieldData(); - _pdm->SetLookupTable( _LutEED ); -printf("EED vtkVectorsVisu::Process() 7\n"); _pdm->SelectColorArray( "GlyphVector" ); // vSliceMapperVec->SetLookupTable( vGreenToRedLut ); // vSliceMapperVec->SetColorModeToMapScalars(); _actor->SetMapper( _pdm ); -printf("EED vtkVectorsVisu::Process() 8\n"); _actor->GetProperty()->SetOpacity( GetOpacity() ); -printf ("EED vtkVectorsVisu::Process opacity:%f\n",GetOpacity() ); }// if _active -printf("EED vtkVectorsVisu::Process() 9\n"); VisibilityActor(); printf("EED vtkVectorsVisu::Process() end\n"); } -- 2.45.0