]> Creatis software - creaVtk.git/commitdiff
#3534 MeshFromPoints MeshToImageData vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 17 Jun 2025 13:19:34 +0000 (15:19 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 17 Jun 2025 13:19:34 +0000 (15:19 +0200)
47 files changed:
appli/template_wx_appli/winApp.cpp
bbtk_creaVtk_PKG/.DS_Store
bbtk_creaVtk_PKG/bbs/boxes/PlaneTensorVisu_Widget.bbg
bbtk_creaVtk_PKG/bbs/boxes/PlaneTensorVisu_Widget.bbs
bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbg
bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbs
bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbg
bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbs
bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbg
bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkActor.h
bbtk_creaVtk_PKG/src/bbcreaVtkAddPolyDataToVector.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkAddPolyDataToVector.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h
bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkCreateMeshFromPoints.h
bbtk_creaVtk_PKG/src/bbcreaVtkHausdorffDistancePointSetFilter.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkHausdorffDistancePointSetFilter.h
bbtk_creaVtk_PKG/src/bbcreaVtkHttpDataSetReader.xml
bbtk_creaVtk_PKG/src/bbcreaVtkImageAppendComponents.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageGaussianSmooth2.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageGaussianSmooth2.h
bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageMaskDice.h
bbtk_creaVtk_PKG/src/bbcreaVtkImageThreshold.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkImageThreshold.h
bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.h
bbtk_creaVtk_PKG/src/bbcreaVtkMarchingCubes2.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkMarchingCubes2.h
bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIimageWriter.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIimageWriter.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.h
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPolyDataToImageData.h
bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkTurnImage.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkTurnImage.h
bbtk_creaVtk_PKG/src/bbcreaVtkVectorsVisu.cxx
lib/creaVtk/CMakeLists.txt
lib/creaVtk/MeshFromPoints.cpp [new file with mode: 0644]
lib/creaVtk/MeshFromPoints.h [new file with mode: 0644]
lib/creaVtk/MeshToImageData.cpp [new file with mode: 0644]
lib/creaVtk/MeshToImageData.h [new file with mode: 0644]
lib/creaVtk/vtkVectorsVisu.cpp

index 17670cbadc474f647e755070a4123f873696fc80..606275be25aa23d218e18b0875995e42b9351406 100644 (file)
@@ -41,7 +41,7 @@
 class myApp : public wxApp
 {
 public:
-  bool OnInit( ); 
+  bool OnInit(); 
   int  OnExit() { return true; }
 };
 
@@ -55,7 +55,6 @@ bool myApp::OnInit( )
   setlocale(LC_NUMERIC, "C");
 #endif
 
-
        wxFrame *frame = new wxFrame(NULL , -1 ,_T("My window.."));
        SetTopWindow(frame);  
        frame->Show(true);
index 8fd3482ce295b13412c4a47a718c628794e1ca1a..afa815535c7de6d6e2d9472d3384e822300392fe 100644 (file)
Binary files a/bbtk_creaVtk_PKG/.DS_Store and b/bbtk_creaVtk_PKG/.DS_Store differ
index 47294a7eba7b8b0b0d9ab481c5c1113cb3427113..db082017ad0401786d04755f7bb39fe97dbc0b2a 100644 (file)
@@ -62,7 +62,7 @@ ISEXEC:FALSE
 -23.855784:52.258658:-900.000000
 FIN_BOX
 BOX
-creaVtk:PlaneVectorViso_Interface:Box06
+creaVtk:PlaneVectorVisu_Interface:Box06
 ISEXEC:FALSE
 54.274543:36.839315:-900.000000
 125.449543:26.839315:-900.000000
index b8a99f5bb18500404e7f8f0ecf82a6aa17380b92..798da78a792d53de138fa029c5aa4a0811b60841 100644 (file)
@@ -27,7 +27,7 @@ new vtkImageDataPointerRelay Box04
 
 new MagicBox Box05
 
-new PlaneVectorViso_Interface Box06
+new PlaneVectorVisu_Interface Box06
   set Box06.typeFormsStr "Cube Sphere Superquadric"
 
 new TensorsVisu Box07
index 63b92d40455b98ed51ef3420f6c9daba6f1a29b2..c1a6005990eb3f18c10d4871539d23fbc6dfc2c7 100644 (file)
@@ -1,59 +1,72 @@
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbg
+# - BBTKGEditor v 1.6 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbg
 # ----------------------------------
 
 APP_START
 CATEGORY:<VOID>
 DESCRIPTION:Description ??
 AUTHOR:Author ??
+EXPORTFORMAT:0
 COMPLEXBOX:TRUE
-COMPLEXBOXNAME:PlaneVectorViso_Interface
+COMPLEXBOXNAME:PlaneVectorVisu_Interface
 PACKAGENAME:creaVtk
-COMPLEXOUTPUTS:8
+COMPLEXOUTPUTS:11
 COMPLEX_PORT
 boxChange
--55.620936:-52.838253:-900.000000
+-38.934655:-15.851476:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 widget
-5.487815:-55.801788:-900.000000
+3.841470:-16.740536:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 ActivePlaneControl
--22.349772:-52.654549:-900.000000
+-15.644840:-15.796365:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 AcitiveVector
-80.231895:-54.018263:-900.000000
+56.162326:-16.205479:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 Opacity
-136.144207:-52.806072:-900.000000
+95.300945:-15.841822:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 ScaleFactor
-170.388604:-54.927407:-900.000000
+119.272023:-16.478222:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 Ratio
-68.944467:-60.974247:-900.000000
+48.261127:-18.292274:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 typeForm
-102.276330:-54.205701:-900.000000
+71.593431:-16.261710:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+active_xy
+-69.649214:-16.573658:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+avtive_xz
+-64.107295:-16.761520:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+active_yz
+-58.471446:-16.479727:-900.000000
 FIN_COMPLEX_PORT
 COMPLEXINPUTS:1
 COMPLEX_PORT
 typeFormsStr
-107.913964:117.907952:-900.000000
+82.718534:85.458673:-900.000000
 FIN_COMPLEX_PORT
-BOXES:14
+BOXES:20
 BOX
 wx:Slider:Box00
 ISEXEC:FALSE
-31.999641:48.109206:-900.000000
-83.399641:38.109206:-900.000000
+25.012707:20.758872:-900.000000
+54.812707:18.258872:-900.000000
 PORT
 In:"30"
 PORT
@@ -70,44 +83,44 @@ FIN_BOX
 BOX
 wx:CheckBox:Box01
 ISEXEC:FALSE
--29.436005:97.853036:-900.000000
-16.138995:87.853036:-900.000000
+-8.448071:48.911842:-900.000000
+13.181929:46.411842:-900.000000
 PORT
 In:"false"
 PORT
 ReactiveOnKeystroke:"true"
 PORT
-Title:"Plane control"
+Title:"control"
 FIN_BOX
 BOX
 wx:LayoutLine:Box03
 ISEXEC:FALSE
-20.799855:-14.759536:-900.000000
-78.359855:-24.759536:-900.000000
+14.559898:-4.427861:-900.000000
+47.879898:-6.927861:-900.000000
 PORT
 WinTitle:"Plane flield"
 FIN_BOX
 BOX
 wx:LayoutTab:Box04
 ISEXEC:FALSE
-10.485060:-37.613537:-900.000000
-68.045060:-47.613537:-900.000000
+7.339542:-11.284061:-900.000000
+40.659542:-13.784061:-900.000000
 FIN_BOX
 BOX
 wx:CheckBox:Box05
 ISEXEC:FALSE
-27.771749:97.805412:-900.000000
-73.346749:87.805412:-900.000000
+4.711390:44.359258:-900.000000
+26.341390:41.859258:-900.000000
 PORT
 ReactiveOnKeystroke:"true"
 PORT
-Title:"Active Vectors"
+Title:"Free"
 FIN_BOX
 BOX
 wx:Slider:Box06
 ISEXEC:FALSE
-96.421419:49.928393:-900.000000
-147.821419:39.928393:-900.000000
+66.807373:29.968648:-900.000000
+96.607373:27.468648:-900.000000
 PORT
 In:"100"
 PORT
@@ -124,16 +137,16 @@ FIN_BOX
 BOX
 std:Div:Box07
 ISEXEC:FALSE
-124.614860:-26.900311:-900.000000
-157.389860:-36.900311:-900.000000
+87.230402:-8.070093:-900.000000
+108.155402:-10.570093:-900.000000
 PORT
 In2:"100.0"
 FIN_BOX
 BOX
 wx:Slider:Box08
 ISEXEC:FALSE
-191.649098:61.508736:-900.000000
-243.049098:51.508736:-900.000000
+133.466748:33.442751:-900.000000
+163.266748:30.942751:-900.000000
 PORT
 ChangeResolution:"true"
 PORT
@@ -152,32 +165,32 @@ FIN_BOX
 BOX
 std:Div:Box09
 ISEXEC:FALSE
-170.827909:-26.212517:-900.000000
-203.602909:-36.212517:-900.000000
+119.579536:-7.863755:-900.000000
+140.504536:-10.363755:-900.000000
 PORT
 In2:"100.0"
 FIN_BOX
 BOX
 wx:LayoutLine:Box10
 ISEXEC:FALSE
-8.365236:62.514618:-900.000000
-65.925236:52.514618:-900.000000
+3.792803:28.243550:-900.000000
+37.112803:25.743550:-900.000000
 PORT
-Orientation:"H"
+Orientation:"V"
 FIN_BOX
 BOX
 wx:LayoutLine:Box11
 ISEXEC:FALSE
-47.351525:19.503081:-900.000000
-104.911525:9.503081:-900.000000
+31.495778:7.913786:-900.000000
+64.815778:5.413786:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
 BOX
 wx:ComboBox:Box12
 ISEXEC:FALSE
-113.883224:81.760768:-900.000000
-159.458224:71.760768:-900.000000
+79.030636:39.518360:-900.000000
+105.310636:37.018360:-900.000000
 PORT
 In:"A B C"
 PORT
@@ -186,18 +199,74 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box13
 ISEXEC:FALSE
-124.445059:13.148288:-900.000000
-170.020059:3.148288:-900.000000
+87.111541:3.944486:-900.000000
+120.431541:1.444486:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
 BOX
 std:SharedMemory:Box15
 ISEXEC:FALSE
--76.284843:36.368355:-900.000000
--30.709843:26.368355:-900.000000
+-43.218130:9.877267:-900.000000
+-20.458130:7.377267:-900.000000
+FIN_BOX
+BOX
+wx:LayoutLine:Box16
+ISEXEC:FALSE
+-85.271364:42.217201:-900.000000
+-51.951364:39.717201:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+wx:CheckBox:Box17
+ISEXEC:FALSE
+-85.405279:58.765018:-900.000000
+-63.775279:56.265018:-900.000000
+PORT
+In:"false"
+PORT
+ReactiveOnKeystroke:"true"
+PORT
+Title:"XY"
+FIN_BOX
+BOX
+wx:CheckBox:Box18
+ISEXEC:FALSE
+-76.281134:53.888110:-900.000000
+-54.651134:51.388110:-900.000000
+PORT
+In:"false"
+PORT
+ReactiveOnKeystroke:"true"
+PORT
+Title:"XZ"
+FIN_BOX
+BOX
+wx:CheckBox:Box19
+ISEXEC:FALSE
+-70.157516:49.511289:-900.000000
+-48.527516:47.011289:-900.000000
+PORT
+In:"false"
+PORT
+ReactiveOnKeystroke:"true"
+PORT
+Title:"YZ"
+FIN_BOX
+BOX
+wx:OutputText:Box20
+ISEXEC:FALSE
+19.192871:38.142357:-900.000000
+40.862871:35.642357:-900.000000
 FIN_BOX
-CONNECTIONS:28
+BOX
+std:MultipleInputs:Box21
+ISEXEC:FALSE
+-54.970140:33.506544:-900.000000
+-33.000140:31.006544:-900.000000
+FIN_BOX
+CONNECTIONS:40
 CONNECTION
 Box03:Widget:Box04:Widget1
 NumberOfControlPoints:0
@@ -238,21 +307,12 @@ CONNECTION
 Box06:Widget:Box11:Widget2
 NumberOfControlPoints:0
 CONNECTION
-Box10:Widget:Box03:Widget1
-NumberOfControlPoints:0
-CONNECTION
-Box11:Widget:Box03:Widget2
-NumberOfControlPoints:0
-CONNECTION
 Box08:Widget:Box13:Widget1
 NumberOfControlPoints:0
 CONNECTION
 Box12:Widget:Box13:Widget2
 NumberOfControlPoints:0
 CONNECTION
-Box13:Widget:Box03:Widget3
-NumberOfControlPoints:0
-CONNECTION
 Box12:Out:typeForm:typeForm
 NumberOfControlPoints:0
 CONNECTION
@@ -282,4 +342,49 @@ NumberOfControlPoints:0
 CONNECTION
 Box15:BoxChange:Box04:BoxExecute
 NumberOfControlPoints:0
+CONNECTION
+Box11:Widget:Box03:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box13:Widget:Box03:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box17:Widget:Box16:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box16:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box19:Widget:Box16:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box16:Widget:Box03:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box10:Widget:Box16:Widget8
+NumberOfControlPoints:0
+CONNECTION
+Box20:Widget:Box10:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box17:BoxChange:Box21:In1
+NumberOfControlPoints:0
+CONNECTION
+Box18:BoxChange:Box21:In2
+NumberOfControlPoints:0
+CONNECTION
+Box19:BoxChange:Box21:In3
+NumberOfControlPoints:0
+CONNECTION
+Box21:BoxChange:Box15:In6
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:active_xy:active_xy
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:avtive_xz:avtive_xz
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:active_yz:active_yz
+NumberOfControlPoints:0
 APP_END
index 23766a147e16dfd8083ce649c687be3067635e60..d853c9118c767b66610947e922cb0a299394eb5c 100644 (file)
@@ -1,6 +1,6 @@
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbs
+# - BBTKGEditor v 1.6 BBS BlackBox Script (Complex Box)
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Interface.bbs
 # ----------------------------------
 
 include std
@@ -8,7 +8,7 @@ include itkvtk
 include wx
 include std
 
-define PlaneVectorViso_Interface creaVtk
+define PlaneVectorVisu_Interface creaVtk
 
 author "Author ??"
 description "Description ??"
@@ -26,7 +26,7 @@ new wx:Slider Box00
 new wx:CheckBox Box01
   set Box01.In "false"
   set Box01.ReactiveOnKeystroke "true"
-  set Box01.Title "Plane control"
+  set Box01.Title "control"
 
 new wx:LayoutLine Box03
   set Box03.WinTitle "Plane flield"
@@ -35,7 +35,7 @@ new wx:LayoutTab Box04
 
 new wx:CheckBox Box05
   set Box05.ReactiveOnKeystroke "true"
-  set Box05.Title "Active Vectors"
+  set Box05.Title "Free"
 
 new wx:Slider Box06
   set Box06.In "100"
@@ -61,7 +61,7 @@ new std:Div Box09
   set Box09.In2 "100.0"
 
 new wx:LayoutLine Box10
-  set Box10.Orientation "H"
+  set Box10.Orientation "V"
 
 new wx:LayoutLine Box11
   set Box11.Orientation "H"
@@ -75,6 +75,28 @@ new wx:LayoutLine Box13
 
 new std:SharedMemory Box15
 
+new wx:LayoutLine Box16
+  set Box16.Orientation "H"
+
+new wx:CheckBox Box17
+  set Box17.In "false"
+  set Box17.ReactiveOnKeystroke "true"
+  set Box17.Title "XY"
+
+new wx:CheckBox Box18
+  set Box18.In "false"
+  set Box18.ReactiveOnKeystroke "true"
+  set Box18.Title "XZ"
+
+new wx:CheckBox Box19
+  set Box19.In "false"
+  set Box19.ReactiveOnKeystroke "true"
+  set Box19.Title "YZ"
+
+new wx:OutputText Box20
+
+new std:MultipleInputs Box21
+
 
 connect Box03.Widget Box04.Widget1
 connect Box06.Out Box07.In1
@@ -83,11 +105,8 @@ connect Box01.Widget Box10.Widget1
 connect Box05.Widget Box10.Widget2
 connect Box00.Widget Box11.Widget1
 connect Box06.Widget Box11.Widget2
-connect Box10.Widget Box03.Widget1
-connect Box11.Widget Box03.Widget2
 connect Box08.Widget Box13.Widget1
 connect Box12.Widget Box13.Widget2
-connect Box13.Widget Box03.Widget3
 connect Box00.BoxChange Box15.In
 connect Box01.BoxChange Box15.In1
 connect Box05.BoxChange Box15.In2
@@ -95,6 +114,18 @@ connect Box06.BoxChange Box15.In3
 connect Box08.BoxChange Box15.In4
 connect Box12.BoxChange Box15.In5
 connect Box15.BoxChange Box04.BoxExecute
+connect Box11.Widget Box03.Widget4
+connect Box13.Widget Box03.Widget6
+connect Box17.Widget Box16.Widget2
+connect Box18.Widget Box16.Widget4
+connect Box19.Widget Box16.Widget6
+connect Box16.Widget Box03.Widget2
+connect Box10.Widget Box16.Widget8
+connect Box20.Widget Box10.Widget4
+connect Box17.BoxChange Box21.In1
+connect Box18.BoxChange Box21.In2
+connect Box19.BoxChange Box21.In3
+connect Box21.BoxChange Box15.In6
 
 # Complex input ports
 input typeFormsStr Box12.In " "
@@ -108,6 +139,9 @@ output ScaleFactor Box09.Out " "
 output Ratio Box00.Out " "
 output typeForm Box12.Out " "
 output boxChange Box15.BoxChange " "
+output active_xy Box17.Out " "
+output avtive_xz Box18.Out " "
+output active_yz Box19.Out " "
 
 
 endefine
index aff184d18c06fb827c41cba9efb0fc664c6c0611..09439d2f884588cbf030260bdc4a133815f3f303 100644 (file)
@@ -1,81 +1,86 @@
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbg
+# - BBTKGEditor v 1.6 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbg
 # ----------------------------------
 
 APP_START
 CATEGORY:<VOID>
 DESCRIPTION:Description ??
 AUTHOR:Author ??
+EXPORTFORMAT:0
 COMPLEXBOX:TRUE
 COMPLEXBOXNAME:PlaneVectorVisu_Widget
 PACKAGENAME:creaVtk
 COMPLEXOUTPUTS:2
 COMPLEX_PORT
 Widget
-86.258910:-108.178434:-900.000000
+57.919555:-90.419950:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 boxchange
--75.932205:-101.708611:-900.000000
+-46.276337:-89.923007:-900.000000
 FIN_COMPLEX_PORT
-COMPLEXINPUTS:3
+COMPLEXINPUTS:4
 COMPLEX_PORT
 vtkImageData
-38.028121:89.676762:-900.000000
+34.045988:67.335122:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 renderer
--52.117833:88.203991:-900.000000
+-37.376390:69.162439:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 boxexecute
--104.232070:88.823851:-900.000000
+-65.536146:67.079249:-900.000000
 FIN_COMPLEX_PORT
-BOXES:9
+COMPLEX_PORT
+_point
+-100.903572:70.586075:-900.000000
+FIN_COMPLEX_PORT
+BOXES:36
 BOX
 creaVtk:VectorsVisu:Box00
 ISEXEC:FALSE
--4.465574:-69.418679:-900.000000
-33.159426:-79.418679:-900.000000
+-6.756539:-48.963041:-900.000000
+15.013461:-51.463041:-900.000000
 FIN_BOX
 BOX
 creaVtk:PlaneWidget:Box01
 ISEXEC:FALSE
--66.409855:2.022991:-900.000000
--27.884855:-7.977009:-900.000000
+-19.408397:-19.512883:-900.000000
+2.436603:-22.012883:-900.000000
 FIN_BOX
 BOX
 vtk:ProbeFilter:Box03
 ISEXEC:FALSE
--29.657798:-23.712064:-900.000000
-6.742202:-33.712064:-900.000000
+-10.171101:-27.687229:-900.000000
+11.468899:-30.187229:-900.000000
 FIN_BOX
 BOX
 vtk:vtkImageDataPointerRelay:Box04
 ISEXEC:FALSE
-31.994878:59.395975:-900.000000
-84.169878:49.395975:-900.000000
+29.822718:58.250886:-900.000000
+53.032718:55.750886:-900.000000
 FIN_BOX
 BOX
 std:MagicBox:Box05
 ISEXEC:FALSE
--63.018802:49.434694:-900.000000
--26.943802:39.434694:-900.000000
+-36.686858:55.262502:-900.000000
+-15.086858:52.762502:-900.000000
 FIN_BOX
 BOX
-creaVtk:PlaneVectorViso_Interface:Box06
+creaVtk:PlaneVectorVisu_Interface:Box06
 ISEXEC:FALSE
-53.843860:42.438188:-900.000000
-105.768860:32.438188:-900.000000
+-45.951472:29.990734:-900.000000
+-22.756472:27.490734:-900.000000
 PORT
 typeFormsStr:"Line Arrow"
 FIN_BOX
 BOX
 vtk:UpdateRender:Box13
 ISEXEC:FALSE
--129.325679:-71.617843:-900.000000
--89.000679:-81.617843:-900.000000
+-18.754133:-69.343749:-900.000000
+3.270867:-71.843749:-900.000000
 PORT
 Active:"true"
 PORT
@@ -84,16 +89,220 @@ FIN_BOX
 BOX
 std:SharedMemory:Box15
 ISEXEC:FALSE
--79.072661:-36.761184:-900.000000
--37.897661:-46.761184:-900.000000
+-29.331298:-35.383878:-900.000000
+-6.571298:-37.883878:-900.000000
 FIN_BOX
 BOX
 std:MagicBox:Box11
 ISEXEC:FALSE
--116.304953:49.494646:-900.000000
--80.229953:39.494646:-900.000000
+-73.987164:55.280487:-900.000000
+-52.387164:52.780487:-900.000000
+FIN_BOX
+BOX
+vtk:ImageVtkProperties:Box10
+ISEXEC:FALSE
+-160.286184:40.103245:-900.000000
+-137.751184:37.603245:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box12
+ISEXEC:FALSE
+-122.136747:39.285446:-900.000000
+-100.536747:36.785446:-900.000000
+FIN_BOX
+BOX
+std:GetVectorIntElement:Box14
+ISEXEC:FALSE
+-125.320317:31.887685:-900.000000
+-102.660317:29.387685:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorIntElement:Box16
+ISEXEC:FALSE
+-116.596868:28.048158:-900.000000
+-93.936868:25.548158:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:GetVectorIntElement:Box17
+ISEXEC:FALSE
+-101.756321:23.766568:-900.000000
+-79.096321:21.266568:-900.000000
+PORT
+I:"2"
+FIN_BOX
+BOX
+std:MathOperationVector:Box18
+ISEXEC:FALSE
+-162.886078:32.173145:-900.000000
+-138.366078:29.673145:-900.000000
+PORT
+In1:"2 2 2"
+PORT
+Type:"3"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box19
+ISEXEC:FALSE
+-172.137701:24.046719:-900.000000
+-149.012701:21.546719:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box20
+ISEXEC:FALSE
+-162.475962:17.994604:-900.000000
+-139.350962:15.494604:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box21
+ISEXEC:FALSE
+-152.826726:13.255220:-900.000000
+-129.701726:10.755220:-900.000000
+PORT
+I:"2"
+FIN_BOX
+BOX
+std:ConcatStrings:Box22
+ISEXEC:FALSE
+-201.969184:-23.042793:-900.000000
+-179.209184:-25.542793:-900.000000
+PORT
+In2:"  "
+PORT
+In4:"  "
+FIN_BOX
+BOX
+std:MathOperationVector:Box23
+ISEXEC:FALSE
+-204.084512:-32.495504:-900.000000
+-179.564512:-34.995504:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaVtk:PlaneSource:Box24
+ISEXEC:FALSE
+-204.507130:-42.671237:-900.000000
+-182.662130:-45.171237:-900.000000
+PORT
+Normal:"0 0 1"
+FIN_BOX
+BOX
+std:MagicBox:Box25
+ISEXEC:FALSE
+-129.630243:-1.345236:-900.000000
+-108.030243:-3.845236:-900.000000
+FIN_BOX
+BOX
+vtk:ProbeFilter:Box26
+ISEXEC:FALSE
+-201.956683:-50.060033:-900.000000
+-180.316683:-52.560033:-900.000000
+FIN_BOX
+BOX
+creaVtk:VectorsVisu:Box27
+ISEXEC:FALSE
+-206.598747:-60.964446:-900.000000
+-184.828747:-63.464446:-900.000000
+FIN_BOX
+BOX
+std:MultipleInputs:Box28
+ISEXEC:FALSE
+-104.850896:2.020354:-900.000000
+-82.880896:-0.479646:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box29
+ISEXEC:FALSE
+-147.262043:-18.473044:-900.000000
+-124.502043:-20.973044:-900.000000
+PORT
+In2:"  "
+PORT
+In4:"  "
+FIN_BOX
+BOX
+std:MathOperationVector:Box30
+ISEXEC:FALSE
+-148.277177:-33.014147:-900.000000
+-123.757177:-35.514147:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaVtk:PlaneSource:Box31
+ISEXEC:FALSE
+-151.147725:-41.759629:-900.000000
+-129.302725:-44.259629:-900.000000
+PORT
+Normal:"0 1 0"
+FIN_BOX
+BOX
+vtk:ProbeFilter:Box32
+ISEXEC:FALSE
+-150.962693:-49.616008:-900.000000
+-129.322693:-52.116008:-900.000000
+FIN_BOX
+BOX
+creaVtk:VectorsVisu:Box33
+ISEXEC:FALSE
+-152.070387:-60.135353:-900.000000
+-130.300387:-62.635353:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box34
+ISEXEC:FALSE
+-100.283757:-13.807028:-900.000000
+-77.523757:-16.307028:-900.000000
+PORT
+In2:"  "
+PORT
+In4:"  "
+FIN_BOX
+BOX
+std:MathOperationVector:Box35
+ISEXEC:FALSE
+-100.886319:-28.210608:-900.000000
+-76.366319:-30.710608:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaVtk:PlaneSource:Box36
+ISEXEC:FALSE
+-101.446461:-38.111292:-900.000000
+-79.601461:-40.611292:-900.000000
+PORT
+Normal:"1 0 0"
+FIN_BOX
+BOX
+vtk:ProbeFilter:Box37
+ISEXEC:FALSE
+-99.941197:-44.358638:-900.000000
+-78.301197:-46.858638:-900.000000
 FIN_BOX
-CONNECTIONS:23
+BOX
+creaVtk:VectorsVisu:Box38
+ISEXEC:FALSE
+-102.506647:-58.646145:-900.000000
+-80.736647:-61.146145:-900.000000
+FIN_BOX
+BOX
+std:MathOperationVector:Box41
+ISEXEC:FALSE
+-168.025554:-1.857037:-900.000000
+-143.505554:-4.357037:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+CONNECTIONS:91
 CONNECTION
 Box03:Out:Box00:In
 NumberOfControlPoints:0
@@ -163,4 +372,208 @@ NumberOfControlPoints:0
 CONNECTION
 Box01:BoxChange:Box15:In3
 NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box10:In
+NumberOfControlPoints:0
+CONNECTION
+_point:_point:Box12:In
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box14:In
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box16:In
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box10:Size:Box18:In0
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box19:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box21:In
+NumberOfControlPoints:0
+CONNECTION
+Box22:Out:Box23:In0
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box24:Center
+NumberOfControlPoints:0
+CONNECTION
+Box10:Spacing:Box23:In1
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box24:XResolution
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box24:YResolution
+NumberOfControlPoints:0
+CONNECTION
+Box06:Ratio:Box25:In
+NumberOfControlPoints:0
+CONNECTION
+Box24:PolyData:Box26:Input
+NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box26:Source
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box27:In
+NumberOfControlPoints:0
+CONNECTION
+Box06:active_xy:Box27:Active
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box22:In1
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box22:In3
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:Box22:In5
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box28:In1
+NumberOfControlPoints:0
+CONNECTION
+Box28:BoxChange:Box27:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box06:boxChange:Box28:In2
+NumberOfControlPoints:0
+CONNECTION
+Box06:Opacity:Box27:Opacity
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box27:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box06:ScaleFactor:Box27:ScaleFactor
+NumberOfControlPoints:0
+CONNECTION
+Box06:typeForm:Box27:TypeForm
+NumberOfControlPoints:0
+CONNECTION
+Box29:Out:Box30:In0
+NumberOfControlPoints:0
+CONNECTION
+Box30:Out:Box31:Center
+NumberOfControlPoints:0
+CONNECTION
+Box31:PolyData:Box32:Input
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box33:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box29:In1
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box29:In5
+NumberOfControlPoints:0
+CONNECTION
+Box16:Out:Box29:In3
+NumberOfControlPoints:0
+CONNECTION
+Box10:Spacing:Box30:In1
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box31:XResolution
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box31:YResolution
+NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box32:Source
+NumberOfControlPoints:0
+CONNECTION
+Box28:BoxChange:Box33:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box06:Opacity:Box33:Opacity
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box33:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box06:ScaleFactor:Box33:ScaleFactor
+NumberOfControlPoints:0
+CONNECTION
+Box06:typeForm:Box33:TypeForm
+NumberOfControlPoints:0
+CONNECTION
+Box34:Out:Box35:In0
+NumberOfControlPoints:0
+CONNECTION
+Box35:Out:Box36:Center
+NumberOfControlPoints:0
+CONNECTION
+Box36:PolyData:Box37:Input
+NumberOfControlPoints:0
+CONNECTION
+Box37:Out:Box38:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box34:In3
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box34:In5
+NumberOfControlPoints:0
+CONNECTION
+Box14:Out:Box34:In1
+NumberOfControlPoints:0
+CONNECTION
+Box10:Spacing:Box35:In1
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box36:XResolution
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box36:YResolution
+NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box37:Source
+NumberOfControlPoints:0
+CONNECTION
+Box28:BoxChange:Box38:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box06:Opacity:Box38:Opacity
+NumberOfControlPoints:0
+CONNECTION
+Box06:ScaleFactor:Box38:ScaleFactor
+NumberOfControlPoints:0
+CONNECTION
+Box06:typeForm:Box38:TypeForm
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box38:Renderer
+NumberOfControlPoints:0
+CONNECTION
+Box06:avtive_xz:Box33:Active
+NumberOfControlPoints:0
+CONNECTION
+Box06:active_yz:Box38:Active
+NumberOfControlPoints:0
+CONNECTION
+Box10:Size:Box41:In0
+NumberOfControlPoints:0
+CONNECTION
+Box10:Spacing:Box41:In1
+NumberOfControlPoints:0
+CONNECTION
+Box41:Out:Box31:VolumeSize
+NumberOfControlPoints:0
+CONNECTION
+Box41:Out:Box36:VolumeSize
+NumberOfControlPoints:0
+CONNECTION
+Box41:Out:Box24:VolumeSize
+NumberOfControlPoints:0
 APP_END
index 443ca11df87a9d93d2f0cf036f826455870dcbf9..49f336f763eacbffc0fb3514b4f7083e2ca9a18a 100644 (file)
@@ -1,6 +1,6 @@
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbs
+# - BBTKGEditor v 1.6 BBS BlackBox Script (Complex Box)
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/PlaneVectorVisu_Widget.bbs
 # ----------------------------------
 
 include std
@@ -26,7 +26,7 @@ new vtk:vtkImageDataPointerRelay Box04
 
 new std:MagicBox Box05
 
-new creaVtk:PlaneVectorViso_Interface Box06
+new creaVtk:PlaneVectorVisu_Interface Box06
   set Box06.typeFormsStr "Line Arrow"
 
 new vtk:UpdateRender Box13
@@ -37,6 +37,81 @@ new std:SharedMemory Box15
 
 new std:MagicBox Box11
 
+new vtk:ImageVtkProperties Box10
+
+new std:MagicBox Box12
+
+new std:GetVectorIntElement Box14
+  set Box14.I "0"
+
+new std:GetVectorIntElement Box16
+  set Box16.I "1"
+
+new std:GetVectorIntElement Box17
+  set Box17.I "2"
+
+new std:MathOperationVector Box18
+  set Box18.In1 "2 2 2"
+  set Box18.Type "3"
+
+new std:GetVectorDoubleElement Box19
+  set Box19.I "0"
+
+new std:GetVectorDoubleElement Box20
+  set Box20.I "1"
+
+new std:GetVectorDoubleElement Box21
+  set Box21.I "2"
+
+new std:ConcatStrings Box22
+  set Box22.In2 "  "
+  set Box22.In4 "  "
+
+new std:MathOperationVector Box23
+  set Box23.Type "2"
+
+new creaVtk:PlaneSource Box24
+  set Box24.Normal "0 0 1"
+
+new std:MagicBox Box25
+
+new vtk:ProbeFilter Box26
+
+new creaVtk:VectorsVisu Box27
+
+new std:MultipleInputs Box28
+
+new std:ConcatStrings Box29
+  set Box29.In2 "  "
+  set Box29.In4 "  "
+
+new std:MathOperationVector Box30
+  set Box30.Type "2"
+
+new creaVtk:PlaneSource Box31
+  set Box31.Normal "0 1 0"
+
+new vtk:ProbeFilter Box32
+
+new creaVtk:VectorsVisu Box33
+
+new std:ConcatStrings Box34
+  set Box34.In2 "  "
+  set Box34.In4 "  "
+
+new std:MathOperationVector Box35
+  set Box35.Type "2"
+
+new creaVtk:PlaneSource Box36
+  set Box36.Normal "1 0 0"
+
+new vtk:ProbeFilter Box37
+
+new creaVtk:VectorsVisu Box38
+
+new std:MathOperationVector Box41
+  set Box41.Type "2"
+
 
 connect Box03.Out Box00.In
 connect Box01.Out Box03.Input
@@ -56,11 +131,79 @@ connect Box06.boxChange Box15.In1
 connect Box15.Out Box13.BoxExecute
 connect Box11.Out Box15.In2
 connect Box01.BoxChange Box15.In3
+connect Box04.Out Box10.In
+connect Box12.Out Box14.In
+connect Box12.Out Box16.In
+connect Box12.Out Box17.In
+connect Box10.Size Box18.In0
+connect Box18.Out Box19.In
+connect Box18.Out Box20.In
+connect Box18.Out Box21.In
+connect Box22.Out Box23.In0
+connect Box23.Out Box24.Center
+connect Box10.Spacing Box23.In1
+connect Box25.Out Box24.XResolution
+connect Box25.Out Box24.YResolution
+connect Box06.Ratio Box25.In
+connect Box24.PolyData Box26.Input
+connect Box04.Out Box26.Source
+connect Box26.Out Box27.In
+connect Box06.active_xy Box27.Active
+connect Box19.Out Box22.In1
+connect Box20.Out Box22.In3
+connect Box17.Out Box22.In5
+connect Box11.Out Box28.In1
+connect Box28.BoxChange Box27.BoxExecute
+connect Box06.boxChange Box28.In2
+connect Box06.Opacity Box27.Opacity
+connect Box05.Out Box27.Renderer
+connect Box06.ScaleFactor Box27.ScaleFactor
+connect Box06.typeForm Box27.TypeForm
+connect Box29.Out Box30.In0
+connect Box30.Out Box31.Center
+connect Box31.PolyData Box32.Input
+connect Box32.Out Box33.In
+connect Box19.Out Box29.In1
+connect Box21.Out Box29.In5
+connect Box16.Out Box29.In3
+connect Box10.Spacing Box30.In1
+connect Box25.Out Box31.XResolution
+connect Box25.Out Box31.YResolution
+connect Box04.Out Box32.Source
+connect Box28.BoxChange Box33.BoxExecute
+connect Box06.Opacity Box33.Opacity
+connect Box05.Out Box33.Renderer
+connect Box06.ScaleFactor Box33.ScaleFactor
+connect Box06.typeForm Box33.TypeForm
+connect Box34.Out Box35.In0
+connect Box35.Out Box36.Center
+connect Box36.PolyData Box37.Input
+connect Box37.Out Box38.In
+connect Box20.Out Box34.In3
+connect Box21.Out Box34.In5
+connect Box14.Out Box34.In1
+connect Box10.Spacing Box35.In1
+connect Box25.Out Box36.XResolution
+connect Box25.Out Box36.YResolution
+connect Box04.Out Box37.Source
+connect Box28.BoxChange Box38.BoxExecute
+connect Box06.Opacity Box38.Opacity
+connect Box06.ScaleFactor Box38.ScaleFactor
+connect Box06.typeForm Box38.TypeForm
+connect Box05.Out Box38.Renderer
+connect Box06.avtive_xz Box33.Active
+connect Box06.active_yz Box38.Active
+connect Box10.Size Box41.In0
+connect Box10.Spacing Box41.In1
+connect Box41.Out Box31.VolumeSize
+connect Box41.Out Box36.VolumeSize
+connect Box41.Out Box24.VolumeSize
 
 # Complex input ports
 input vtkImageData Box04.In " "
 input renderer Box05.In " "
 input boxexecute Box11.BoxExecute " "
+input _point Box12.In " "
 
 # Complex output ports
 output Widget Box06.widget " "
index f1a04f4cc732878b458f4d45ffbf5d066db7d00e..cee937b37da233d2c552af5d5c8317f1b2395f05 100644 (file)
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbg
+# - BBTKGEditor v 1.6 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbg
 # ----------------------------------
 
 APP_START
 CATEGORY:<VOID>
 DESCRIPTION:Description ??
 AUTHOR:Author ??
+EXPORTFORMAT:0
 COMPLEXBOX:TRUE
 COMPLEXBOXNAME:VectorsTensors_Widget
 PACKAGENAME:creaVtk
 COMPLEXOUTPUTS:1
 COMPLEX_PORT
 widget
--133.205566:-215.108938:-900.000000
+-93.243896:-64.532681:-900.000000
 FIN_COMPLEX_PORT
-COMPLEXINPUTS:3
+COMPLEXINPUTS:5
 COMPLEX_PORT
 vtkImageData_vectors
--202.201495:171.786415:-900.000000
+-141.541046:51.535925:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 vtkImageData_tensors
--84.383009:173.600108:-900.000000
+-59.068106:52.080032:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 vtkRenderer
-128.828216:174.474869:-900.000000
+90.179751:52.342461:-900.000000
 FIN_COMPLEX_PORT
-BOXES:14
+COMPLEX_PORT
+_viewerExecute
+-181.613941:51.790685:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+_pointViewer
+-209.411741:54.697096:-900.000000
+FIN_COMPLEX_PORT
+BOXES:16
 BOX
 vtk:UpdateRender:Box22
 ISEXEC:FALSE
-91.911565:-119.753930:-900.000000
-132.236565:-129.753930:-900.000000
+64.338095:-35.926179:-900.000000
+86.363095:-38.426179:-900.000000
 PORT
 Active:"true"
 FIN_BOX
 BOX
 wx:LayoutTab:Box17
 ISEXEC:FALSE
--148.219985:-138.795108:-900.000000
--90.659985:-148.795108:-900.000000
+-103.753990:-41.638532:-900.000000
+-70.433990:-44.138532:-900.000000
 PORT
 WinTitle:"VectorsTensors Analysis"
 FIN_BOX
 BOX
 std:MultipleInputs:Box23
 ISEXEC:FALSE
-32.484087:-86.883484:-900.000000
-72.184087:-96.883484:-900.000000
+22.738861:-26.065045:-900.000000
+44.708861:-28.565045:-900.000000
 PORT
 BoxProcessMode:"Reactive"
 FIN_BOX
 BOX
 creaVtk:PlaneVectorVisu_Widget:Box41
 ISEXEC:FALSE
--290.289955:71.849699:-900.000000
--240.339955:61.849699:-900.000000
+-203.202968:21.554910:-900.000000
+-180.202968:19.054910:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box14
 ISEXEC:FALSE
--249.537648:23.883192:-900.000000
--191.977648:13.883192:-900.000000
+-174.676354:7.164958:-900.000000
+-141.356354:4.664958:-900.000000
 PORT
 WinTitle:"Field"
 FIN_BOX
 BOX
 creaVtk:VolumeVectorVisu_Widget:Box18
 ISEXEC:FALSE
--214.258652:71.383715:-900.000000
--162.208652:61.383715:-900.000000
+-149.981056:21.415114:-900.000000
+-126.761056:18.915114:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box16
 ISEXEC:FALSE
--107.142871:-103.536135:-900.000000
--49.582871:-113.536135:-900.000000
+-75.000010:-31.060840:-900.000000
+-41.680010:-33.560840:-900.000000
 PORT
 WinTitle:"Tensors"
 FIN_BOX
 BOX
 creaVtk:VolumeTensorVisu_Widget:Box19
 ISEXEC:FALSE
-60.863865:72.033730:-900.000000
-112.563865:62.033730:-900.000000
+42.604705:21.610119:-900.000000
+65.789705:19.110119:-900.000000
 FIN_BOX
 BOX
 creaVtk:PlaneTensorVisu_Widget:Box21
 ISEXEC:FALSE
--17.702072:72.444185:-900.000000
-31.897928:62.444185:-900.000000
+-12.391450:21.733256:-900.000000
+10.573550:19.233256:-900.000000
 FIN_BOX
 BOX
 creaVtk:PlaneWidget_StreamLineVisu_Widget:Box30
 ISEXEC:FALSE
--156.561665:28.789589:-900.000000
--94.686665:18.789589:-900.000000
+-109.593165:8.636877:-900.000000
+-85.398165:6.136877:-900.000000
 FIN_BOX
 BOX
 vtk:vtkImageDataPointerRelay:Box26
 ISEXEC:FALSE
--208.540015:141.393307:-900.000000
--154.090517:131.393307:-900.000000
+-145.978011:42.417992:-900.000000
+-122.768011:39.917992:-900.000000
 FIN_BOX
 BOX
 vtk:vtkImageDataPointerRelay:Box27
 ISEXEC:FALSE
--89.314298:137.998626:-900.000000
--37.139298:127.998626:-900.000000
+-62.520009:41.399588:-900.000000
+-39.310009:38.899588:-900.000000
 FIN_BOX
 BOX
 std:MagicBox:Box28
 ISEXEC:FALSE
-123.517825:137.982960:-900.000000
-159.592825:127.982960:-900.000000
+86.462477:41.394888:-900.000000
+108.062477:38.894888:-900.000000
 FIN_BOX
 BOX
 wx:LayoutTab:Box29
 ISEXEC:FALSE
--175.679382:-102.651254:-900.000000
--118.119382:-112.651254:-900.000000
+-122.975567:-30.795376:-900.000000
+-89.655567:-33.295376:-900.000000
 PORT
 WinTitle:"Vectors"
 FIN_BOX
-CONNECTIONS:31
+BOX
+std:MagicBox:Box15
+ISEXEC:FALSE
+-193.706938:37.145989:-900.000000
+-172.106938:34.645989:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box20
+ISEXEC:FALSE
+-219.964001:37.144937:-900.000000
+-198.364001:34.644937:-900.000000
+FIN_BOX
+CONNECTIONS:35
 CONNECTION
 Box23:BoxChange:Box22:BoxExecute
 NumberOfControlPoints:0
@@ -219,4 +240,16 @@ NumberOfControlPoints:0
 CONNECTION
 Box18:boxchange:Box29:BoxExecute
 NumberOfControlPoints:0
+CONNECTION
+_viewerExecute:_viewerExecute:Box15:In
+NumberOfControlPoints:0
+CONNECTION
+Box15:BoxChange:Box41:boxexecute
+NumberOfControlPoints:0
+CONNECTION
+_pointViewer:_pointViewer:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box41:_point
+NumberOfControlPoints:0
 APP_END
index 8117a5041508c49af308c5c86afe12b88cd3d77f..b4e28b4e280aac03063dce43eafeec6a367e859a 100644 (file)
@@ -1,6 +1,6 @@
 # ----------------------------------
-# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbs
+# - BBTKGEditor v 1.6 BBS BlackBox Script (Complex Box)
+# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/VectorsTensors_Widget.bbs
 # ----------------------------------
 
 include std
@@ -51,6 +51,10 @@ new std:MagicBox Box28
 new wx:LayoutTab Box29
   set Box29.WinTitle "Vectors"
 
+new std:MagicBox Box15
+
+new std:MagicBox Box20
+
 
 connect Box23.BoxChange Box22.BoxExecute
 connect Box41.boxchange Box23.In1
@@ -79,11 +83,15 @@ connect Box29.Widget Box17.Widget1
 connect Box16.Widget Box17.Widget2
 connect Box41.boxchange Box14.BoxExecute
 connect Box18.boxchange Box29.BoxExecute
+connect Box15.BoxChange Box41.boxexecute
+connect Box20.Out Box41._point
 
 # Complex input ports
 input vtkImageData_vectors Box26.In " "
 input vtkImageData_tensors Box27.In " "
 input vtkRenderer Box28.In " "
+input _viewerExecute Box15.In " "
+input _pointViewer Box20.In " "
 
 # Complex output ports
 output widget Box17.Widget " "
index 5fed993f6bde1d53cfd1b96778abc196f7ca5c46..e2ae8e59fb4b058a7905c73ea7496665651fa0bc 100644 (file)
@@ -15,51 +15,51 @@ namespace bbcreaVtk
 {
 
 class bbcreaVtk_EXPORT Actor
- : 
-   public bbtk::AtomicBlackBox
+:
+public bbtk::AtomicBlackBox
 {
-  BBTK_BLACK_BOX_INTERFACE(Actor,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(In,vtkProp3D*);
-  BBTK_DECLARE_INPUT(Opacity,double);
-  BBTK_DECLARE_INPUT(Color,std::vector<double>);
-  BBTK_DECLARE_INPUT(LineWidth,double);
-  BBTK_DECLARE_INPUT(Transform,vtkTransform*);
-  BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
-//  BBTK_DECLARE_OUTPUT(Out,double);
-  BBTK_PROCESS(Process);
-  void Process();
-
-  bool backActive;
-//===== 
-// 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_BLACK_BOX_INTERFACE(Actor,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(In,vtkProp3D*);
+    BBTK_DECLARE_INPUT(Opacity,double);
+    BBTK_DECLARE_INPUT(Color,std::vector<double>);
+    BBTK_DECLARE_INPUT(LineWidth,double);
+    BBTK_DECLARE_INPUT(Transform,vtkTransform*);
+    BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+    //  BBTK_DECLARE_OUTPUT(Out,double);
+    BBTK_PROCESS(Process);
+    void Process();
+    
+    bool backActive;
+    //=====
+    // 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(Actor,bbtk::AtomicBlackBox);
- BBTK_NAME("Actor");
- BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("No Description.");
- BBTK_CATEGORY("empty");
+BBTK_NAME("Actor");
+BBTK_AUTHOR("Info-Dev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
 
- BBTK_INPUT(Actor,Active,"Active true/false  (default false)",bool,"");
- BBTK_INPUT(Actor,In,"First input",vtkProp3D*,"");
- BBTK_INPUT(Actor,Opacity,"Opacity 0..1 (default 1)",double,"");
- BBTK_INPUT(Actor,Color,"(default [1 0 0]red )  RGB color vector [0..1, 0..1, 0..1]   )", std::vector<double>,"");
- BBTK_INPUT(Actor,LineWidth,"(default 0.5 ) With ligne   )",double,"");
- BBTK_INPUT(Actor,Transform,"Transform",vtkTransform*,"");
- BBTK_INPUT(Actor,Renderer,"Renderer",vtkRenderer*,"");
+BBTK_INPUT(Actor,Active,"Active true/false  (default false)",bool,"");
+BBTK_INPUT(Actor,In,"First input",vtkProp3D*,"");
+BBTK_INPUT(Actor,Opacity,"Opacity 0..1 (default 1)",double,"");
+BBTK_INPUT(Actor,Color,"(default [1 0 0]red )  RGB color vector [0..1, 0..1, 0..1]   )", std::vector<double>,"");
+BBTK_INPUT(Actor,LineWidth,"(default 0.5 ) With ligne   )",double,"");
+BBTK_INPUT(Actor,Transform,"Transform",vtkTransform*,"");
+BBTK_INPUT(Actor,Renderer,"Renderer",vtkRenderer*,"");
 
 // BBTK_OUTPUT(Actor,Out,"First output",double,"");
 BBTK_END_DESCRIBE_BLACK_BOX(Actor);
-//===== 
+//=====
 // 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
+//=====
+
+}// EO namespace bbcreaVtk
 
 #endif // __bbcreaVtkActor_h_INCLUDED__
 
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkAddPolyDataToVector.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkAddPolyDataToVector.cxx
new file mode 100644 (file)
index 0000000..b1b0aee
--- /dev/null
@@ -0,0 +1,90 @@
+//===== 
+// 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 "bbcreaVtkAddPolyDataToVector.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,AddPolyDataToVector)
+BBTK_BLACK_BOX_IMPLEMENTATION(AddPolyDataToVector,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 AddPolyDataToVector::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 = " <<bbGetOutputOut() << std::endl;
+    std::vector<vtkPolyData*> lstPolyData=bbGetInputPolyDataVector();
+    if (bbGetInputIn0()!=NULL) { lstPolyData.push_back( bbGetInputIn0() ); }
+    if (bbGetInputIn1()!=NULL) { lstPolyData.push_back( bbGetInputIn1() ); }
+    if (bbGetInputIn2()!=NULL) { lstPolyData.push_back( bbGetInputIn2() ); }
+    if (bbGetInputIn3()!=NULL) { lstPolyData.push_back( bbGetInputIn3() ); }
+    if (bbGetInputIn4()!=NULL) { lstPolyData.push_back( bbGetInputIn4() ); }
+    if (bbGetInputIn5()!=NULL) { lstPolyData.push_back( bbGetInputIn5() ); }
+    if (bbGetInputIn6()!=NULL) { lstPolyData.push_back( bbGetInputIn6() ); }
+    if (bbGetInputIn7()!=NULL) { lstPolyData.push_back( bbGetInputIn7() ); }
+    if (bbGetInputIn8()!=NULL) { lstPolyData.push_back( bbGetInputIn8() ); }
+    if (bbGetInputIn9()!=NULL) { lstPolyData.push_back( bbGetInputIn9() ); }
+    bbSetOutputOut(lstPolyData);
+
+}
+
+//=====
+// 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 AddPolyDataToVector::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+    bbSetInputIn0(NULL);
+    bbSetInputIn1(NULL);
+    bbSetInputIn2(NULL);
+    bbSetInputIn3(NULL);
+    bbSetInputIn4(NULL);
+    bbSetInputIn5(NULL);
+    bbSetInputIn6(NULL);
+    bbSetInputIn7(NULL);
+    bbSetInputIn8(NULL);
+    bbSetInputIn9(NULL);
+    std::vector<vtkPolyData*> lstPolyData;
+    bbSetInputPolyDataVector(lstPolyData);
+}
+
+//=====
+// 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 AddPolyDataToVector::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 AddPolyDataToVector::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/bbcreaVtkAddPolyDataToVector.h b/bbtk_creaVtk_PKG/src/bbcreaVtkAddPolyDataToVector.h
new file mode 100644 (file)
index 0000000..c9df2f9
--- /dev/null
@@ -0,0 +1,68 @@
+//=====
+// 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 __bbcreaVtkAddPolyDataToVector_h_INCLUDED__
+#define __bbcreaVtkAddPolyDataToVector_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkPolyData.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT AddPolyDataToVector
+ :
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(AddPolyDataToVector,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(PolyDataVector,std::vector<vtkPolyData*>);
+    BBTK_DECLARE_INPUT(In0,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In1,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In2,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In3,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In4,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In5,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In6,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In7,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In8,vtkPolyData*);
+    BBTK_DECLARE_INPUT(In9,vtkPolyData*);
+    BBTK_DECLARE_OUTPUT(Out,std::vector<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(AddPolyDataToVector,bbtk::AtomicBlackBox);
+  BBTK_NAME("AddPolyDataToVector");
+  BBTK_AUTHOR("Info-Dev");
+  BBTK_DESCRIPTION("eduardo.davila@creatis.insa-lyon.fr - Concat at the end of the PolyDataVector all the inputs. Add vtkPolyData* to a vector of vtkPolyData*");
+  BBTK_CATEGORY("void");
+  BBTK_INPUT(AddPolyDataToVector,PolyDataVector,"Vector of vtkImagesData*",std::vector<vtkPolyData*>,"");
+  BBTK_INPUT(AddPolyDataToVector,In0,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In1,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In2,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In3,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In4,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In5,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In6,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In7,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In8,"Input polydata ",vtkPolyData*,"");
+  BBTK_INPUT(AddPolyDataToVector,In9,"Input polydata ",vtkPolyData*,"");
+  BBTK_OUTPUT(AddPolyDataToVector,Out,"Vector of vtkPolyData*",std::vector<vtkPolyData*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(AddPolyDataToVector);
+//=====
+// 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 // __bbcreaVtkAddPolyDataToVector_h_INCLUDED__
+
index 9f5d104cb531159e2bda64f42778ed25bc874e53..357365042c3f58eff686b6d8a2f3d2fc182ea449 100644 (file)
@@ -53,7 +53,7 @@ class bbcreaVtk_EXPORT BoxWidget
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(BoxWidget,bbtk::AtomicBlackBox);
   BBTK_NAME("BoxWidget");
   BBTK_AUTHOR("InfoDev");
-  BBTK_DESCRIPTION("(C++,Python) No Description.");
+  BBTK_DESCRIPTION("(C++,Python,JavaScript) No Description.");
   BBTK_CATEGORY("empty");
 
   BBTK_INPUT(BoxWidget,Active,"(default false)  true/false",bool,"");
index 2a4dd4402d441fb82b211c3fdc2511e9c45cb323..0009dd10b0c088c9a9a11ab4e2a9130b45482d32 100644 (file)
@@ -13,475 +13,473 @@ namespace bbcreaVtk
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,CreateMeshFromPoints)
 BBTK_BLACK_BOX_IMPLEMENTATION(CreateMeshFromPoints,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 CreateMeshFromPoints::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 = " <<bbGetOutputOut() << std::endl;
-
-               std::vector<double> lstX                = bbGetInputLstX();
-               std::vector<double> lstY                = bbGetInputLstY();
-               std::vector<double> lstZ                = bbGetInputLstZ();
-               std::vector<int> lstIndexs              = bbGetInputLstIndexs();
-               double pointsCentroid[3];
-               if ( (lstIndexs.size()<1) || (lstX.size()==0) || (lstX.size()!=lstY.size()) || (lstY.size()!=lstZ.size()) )
-               {
-                       printf("Warning! CreateMeshFromPoints::Process: List of points X Y Z  and LstIndexes is not correct\n");
-                       bbSetOutputOut(NULL);
-               } else  {
-                       int ii,sizeSegment1,sizeSegment2;
-                       int endSegment;
-//                     vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
-                       if (points!=NULL) points->Delete();
-                       points = vtkPoints::New();
-                       int i,sizeLstX  =       lstX.size();
-                       for (i=0;i<sizeLstX;i++)
-                       {
-                               points->InsertNextPoint(lstX[i],lstY[i],lstZ[i]);
-                               pointsCentroid[0] += lstX[i];
-                               pointsCentroid[1] += lstY[i];
-                               pointsCentroid[2] += lstZ[i];
-                       } // for i
-                       pointsCentroid[0] /= sizeLstX;
-                       pointsCentroid[1] /= sizeLstX;
-                       pointsCentroid[2] /= sizeLstX;
-                       
-                       if ((bbGetInputCloseSurface()==true)  && (lstIndexs.size()>=2) )
-            {  
-               //check if initial and end points are the same in all splines (splines are in line shape and not U shape)
-               //to not apply changes because clean polydata will take care of it.
-                               int count = 0;
-                               bool differentPoints = false;
-                               for(i=0; i < lstIndexs.size() && !differentPoints;i++){
-                                       bool sameStart = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
-                                       bool sameEnd = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
-                                       if(!(sameStart && sameEnd)) differentPoints = true;
-                                       count += lstIndexs[i];
-                               }
-                //Correct surface normals if needed
-                if(differentPoints)
-                       {
-                           double pointSurf1[3], pointSurf2[3], pointSurf3[3];
-                           double vect1[3], vect2[3];
-                           double surfNormal[3], vectorCenter[3];
-                           double dotNormalSurf = 0;
-                           for(int pIndex = 0; pIndex < lstIndexs[0]-1; pIndex++)
-                           {
-                                   pointSurf1[0] = lstX[pIndex];
-                                   pointSurf1[1] = lstY[pIndex];
-                                   pointSurf1[2] = lstZ[pIndex];
-                                   vtkMath::Subtract(pointsCentroid, pointSurf1, vectorCenter);
-                                   pointSurf2[0] = lstX[pIndex+lstIndexs[1]];
-                                   pointSurf2[1] = lstY[pIndex+lstIndexs[1]];
-                                   pointSurf2[2] = lstZ[pIndex+lstIndexs[1]];
-                                   pointSurf3[0] = lstX[pIndex+1];
-                                   pointSurf3[1] = lstY[pIndex+1];
-                                   pointSurf3[2] = lstZ[pIndex+1];
-                                   vtkMath::Subtract(pointSurf2, pointSurf1, vect1);
-                                   vtkMath::Subtract(pointSurf3, pointSurf1, vect2);
-                                   vtkMath::Cross(vect1, vect2, surfNormal);
-                                   dotNormalSurf += vtkMath::Dot(surfNormal, vectorCenter);
-                           } // for pIndex
-
-                                       if(dotNormalSurf > 0){
-                                               points->Delete();
-                                               points = vtkPoints::New();
-                                               for(int splineI = 0; splineI < lstIndexs.size(); splineI++){
-                                                       for (i=lstIndexs[splineI]-1; i >= 0;i--)
-                                                       {
-                                                               points->InsertNextPoint(lstX[splineI*lstIndexs[0]+i],lstY[splineI*lstIndexs[0]+i],lstZ[splineI*lstIndexs[0]+i]);
-                                                       } // for i
-                                               } // for splineI
-                                       } // if dotNormalSurf
-                               }// if differentPoints
-                       }
-                       //
-                       
-//                     vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
-                       if (cells!=NULL) cells->Delete();
-                       cells = vtkCellArray::New();
-                       int maxElements;
-                       int maxSegment1,maxSegment2;
-                       int iSeg1,iSeg2;
-                       int iGeneral    =       0;
-                       int     sizeLstIdexes=lstIndexs.size();
-                       for (i=0; i<sizeLstIdexes-1; i++ )
-                       {
-                               sizeSegment1 = lstIndexs[i];
-                               sizeSegment2 = lstIndexs[i+1];
-                               vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
-                               triangleStrip->GetPointIds()->SetNumberOfIds(sizeSegment1+sizeSegment2);
-                               maxElements=sizeSegment1;
-                               if (maxElements<sizeSegment2) maxElements=sizeSegment2;
-                               maxSegment1     = iGeneral+sizeSegment1;
-                               maxSegment2     = iGeneral+sizeSegment1+sizeSegment2;
-                               iSeg1           = iGeneral;
-                               iSeg2           = iGeneral+sizeSegment1;
-                               for (ii=0; ii<maxElements; ii++)
-                               {
-                                       triangleStrip->GetPointIds()->SetId(ii*2  ,iSeg1);
-                                       triangleStrip->GetPointIds()->SetId(ii*2+1,iSeg2);
-                                       iSeg1++;
-                                       iSeg2++;
-                       if (iSeg1>=maxSegment1) { iSeg1=maxSegment1-1; }
-                       if (iSeg2>=maxSegment2) { iSeg2=maxSegment2-1; }
-                               } // for ii 
-                               iGeneral=iGeneral+sizeSegment1;
-                               cells->InsertNextCell(triangleStrip);
-                       } //for  LstIndexs
-                       
-                       
-                       if(bbGetInputCloseSurface())
-                       {
-                               int lastId1 = lstIndexs[0]-1;
-                               int lastId2 = sizeLstX - 1;
-                               int firstId2 = sizeLstX - lstIndexs[sizeLstIdexes - 1];
-                               bool face1open = std::fabs(lstX[0] - lstX[lastId1]) > 0.0001 || std::fabs(lstY[0] - lstY[lastId1]) > 0.0001 || std::fabs(lstZ[0] - lstZ[lastId1]) > 0.0001;
-                               bool face2open = std::fabs(lstX[firstId2] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[firstId2] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[firstId2] - lstZ[lastId2]) > 0.0001;
-                               
-                               bool altFace1open = std::fabs(lstX[0] - lstX[firstId2]) > 0.0001 || std::fabs(lstY[0] - lstY[firstId2]) > 0.0001 || std::fabs(lstZ[0] - lstZ[firstId2]) > 0.0001;
-                               bool altFace2open = std::fabs(lstX[lastId1] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[lastId1] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[lastId1] - lstZ[lastId2]) > 0.0001;
-
-                               //false = Open Contour
-                               //true = Closed Contour
-                               if(!face1open && !face2open)
-                               {
-//                                     isClosedCont = true;
-                                       CloseContourSides(lstIndexs, true, true);
-                               }
-                               else if(!altFace1open && !altFace2open)
-                               {
-//                                     isClosedCont = true;
-                                       CloseContourSides(lstIndexs, false, true);
-                               }
-                               else{
-                                       CloseOpenContourSurface(lstIndexs);
-                               }
-                       }
-                    
-//                     vtkPolyData *polydata = vtkPolyData::New();
-                       if (polydata!=NULL) polydata->Delete();
-                       polydata = vtkPolyData::New();
-                       polydata->SetPoints(points);
-                       polydata->SetStrips(cells);
-//                     vtkCleanPolyData *clean=vtkCleanPolyData::New();
-                       if (clean!=NULL) clean->Delete();
-                       clean = vtkCleanPolyData::New();
-                       clean->SetInputData(polydata);
-                       clean->Update();
-//                     vtkTriangleFilter *triangle = vtkTriangleFilter::New();
-                       if (triangle!=NULL) triangle->Delete();
-                       triangle = vtkTriangleFilter::New();
-                       triangle->SetInputData( clean->GetOutput() );
-                       triangle->Update();
-            bbSetOutputOut( triangle->GetOutput() );
-            //            bbSetOutputOut( clean->GetOutput() );
-               }// if listXYZ size
-               //printf("PG CreateMeshFromPoints::Process: End\n");
+    
+    // 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 = " <<bbGetOutputOut() << std::endl;
+    
+    std::vector<double> lstX           = bbGetInputLstX();
+    std::vector<double> lstY           = bbGetInputLstY();
+    std::vector<double> lstZ           = bbGetInputLstZ();
+    std::vector<int> lstIndexs         = bbGetInputLstIndexs();
+    double pointsCentroid[3];
+    if ( (lstIndexs.size()<1) || (lstX.size()==0) || (lstX.size()!=lstY.size()) || (lstY.size()!=lstZ.size()) )
+    {
+        printf("Warning! CreateMeshFromPoints::Process: List of points X Y Z  and LstIndexes is not correct\n");
+        bbSetOutputOut(NULL);
+    } else  {
+        int ii,sizeSegment1,sizeSegment2;
+        int endSegment;
+        //                     vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+        if (points!=NULL) points->Delete();
+        points = vtkPoints::New();
+        int i,sizeLstX         =       lstX.size();
+        for (i=0;i<sizeLstX;i++)
+        {
+            points->InsertNextPoint(lstX[i],lstY[i],lstZ[i]);
+            pointsCentroid[0] += lstX[i];
+            pointsCentroid[1] += lstY[i];
+            pointsCentroid[2] += lstZ[i];
+        } // for i
+        pointsCentroid[0] /= sizeLstX;
+        pointsCentroid[1] /= sizeLstX;
+        pointsCentroid[2] /= sizeLstX;
+        
+        if ((bbGetInputCloseSurface()==true)  && (lstIndexs.size()>=2) )
+        {
+            //check if initial and end points are the same in all splines (splines are in line shape and not U shape)
+            //to not apply changes because clean polydata will take care of it.
+            int count = 0;
+            bool differentPoints = false;
+            for(i=0; i < lstIndexs.size() && !differentPoints;i++){
+                bool sameStart = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
+                bool sameEnd = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
+                if(!(sameStart && sameEnd)) differentPoints = true;
+                count += lstIndexs[i];
+            }
+            //Correct surface normals if needed
+            if(differentPoints)
+            {
+                double pointSurf1[3], pointSurf2[3], pointSurf3[3];
+                double vect1[3], vect2[3];
+                double surfNormal[3], vectorCenter[3];
+                double dotNormalSurf = 0;
+                for(int pIndex = 0; pIndex < lstIndexs[0]-1; pIndex++)
+                {
+                    pointSurf1[0] = lstX[pIndex];
+                    pointSurf1[1] = lstY[pIndex];
+                    pointSurf1[2] = lstZ[pIndex];
+                    vtkMath::Subtract(pointsCentroid, pointSurf1, vectorCenter);
+                    pointSurf2[0] = lstX[pIndex+lstIndexs[1]];
+                    pointSurf2[1] = lstY[pIndex+lstIndexs[1]];
+                    pointSurf2[2] = lstZ[pIndex+lstIndexs[1]];
+                    pointSurf3[0] = lstX[pIndex+1];
+                    pointSurf3[1] = lstY[pIndex+1];
+                    pointSurf3[2] = lstZ[pIndex+1];
+                    vtkMath::Subtract(pointSurf2, pointSurf1, vect1);
+                    vtkMath::Subtract(pointSurf3, pointSurf1, vect2);
+                    vtkMath::Cross(vect1, vect2, surfNormal);
+                    dotNormalSurf += vtkMath::Dot(surfNormal, vectorCenter);
+                } // for pIndex
+                
+                if(dotNormalSurf > 0){
+                    points->Delete();
+                    points = vtkPoints::New();
+                    for(int splineI = 0; splineI < lstIndexs.size(); splineI++){
+                        for (i=lstIndexs[splineI]-1; i >= 0;i--)
+                        {
+                            points->InsertNextPoint(lstX[splineI*lstIndexs[0]+i],lstY[splineI*lstIndexs[0]+i],lstZ[splineI*lstIndexs[0]+i]);
+                        } // for i
+                    } // for splineI
+                } // if dotNormalSurf
+            }// if differentPoints
+        }
+        //
+        
+        //                     vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
+        if (cells!=NULL) cells->Delete();
+        cells = vtkCellArray::New();
+        int maxElements;
+        int maxSegment1,maxSegment2;
+        int iSeg1,iSeg2;
+        int iGeneral   =       0;
+        int    sizeLstIdexes=lstIndexs.size();
+        for (i=0; i<sizeLstIdexes-1; i++ )
+        {
+            sizeSegment1 = lstIndexs[i];
+            sizeSegment2 = lstIndexs[i+1];
+            vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
+            triangleStrip->GetPointIds()->SetNumberOfIds(sizeSegment1+sizeSegment2);
+            maxElements=sizeSegment1;
+            if (maxElements<sizeSegment2) maxElements=sizeSegment2;
+            maxSegment1        = iGeneral+sizeSegment1;
+            maxSegment2        = iGeneral+sizeSegment1+sizeSegment2;
+            iSeg1              = iGeneral;
+            iSeg2              = iGeneral+sizeSegment1;
+            for (ii=0; ii<maxElements; ii++)
+            {
+                triangleStrip->GetPointIds()->SetId(ii*2  ,iSeg1);
+                triangleStrip->GetPointIds()->SetId(ii*2+1,iSeg2);
+                iSeg1++;
+                iSeg2++;
+                if (iSeg1>=maxSegment1) { iSeg1=maxSegment1-1; }
+                if (iSeg2>=maxSegment2) { iSeg2=maxSegment2-1; }
+            } // for ii
+            iGeneral=iGeneral+sizeSegment1;
+            cells->InsertNextCell(triangleStrip);
+        } //for  LstIndexs
+        
+        
+        if(bbGetInputCloseSurface())
+        {
+            int lastId1 = lstIndexs[0]-1;
+            int lastId2 = sizeLstX - 1;
+            int firstId2 = sizeLstX - lstIndexs[sizeLstIdexes - 1];
+            bool face1open = std::fabs(lstX[0] - lstX[lastId1]) > 0.0001 || std::fabs(lstY[0] - lstY[lastId1]) > 0.0001 || std::fabs(lstZ[0] - lstZ[lastId1]) > 0.0001;
+            bool face2open = std::fabs(lstX[firstId2] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[firstId2] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[firstId2] - lstZ[lastId2]) > 0.0001;
+            
+            bool altFace1open = std::fabs(lstX[0] - lstX[firstId2]) > 0.0001 || std::fabs(lstY[0] - lstY[firstId2]) > 0.0001 || std::fabs(lstZ[0] - lstZ[firstId2]) > 0.0001;
+            bool altFace2open = std::fabs(lstX[lastId1] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[lastId1] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[lastId1] - lstZ[lastId2]) > 0.0001;
+            
+            //false = Open Contour
+            //true = Closed Contour
+            if(!face1open && !face2open)
+            {
+                //                                     isClosedCont = true;
+                CloseContourSides(lstIndexs, true, true);
+            }
+            else if(!altFace1open && !altFace2open)
+            {
+                //                                     isClosedCont = true;
+                CloseContourSides(lstIndexs, false, true);
+            }
+            else{
+                CloseOpenContourSurface(lstIndexs);
+            }
+        }
+        
+        //                     vtkPolyData *polydata = vtkPolyData::New();
+        if (polydata!=NULL) polydata->Delete();
+        polydata = vtkPolyData::New();
+        polydata->SetPoints(points);
+        polydata->SetStrips(cells);
+        //                     vtkCleanPolyData *clean=vtkCleanPolyData::New();
+        if (clean!=NULL) clean->Delete();
+        clean = vtkCleanPolyData::New();
+        clean->SetInputData(polydata);
+        clean->Update();
+        //                     vtkTriangleFilter *triangle = vtkTriangleFilter::New();
+        if (triangle!=NULL) triangle->Delete();
+        triangle = vtkTriangleFilter::New();
+        triangle->SetInputData( clean->GetOutput() );
+        triangle->Update();
+        bbSetOutputOut( triangle->GetOutput() );
+        //            bbSetOutputOut( clean->GetOutput() );
+    }// if listXYZ size
+    //printf("PG CreateMeshFromPoints::Process: End\n");
 }
 /**
-* Closes the sides of the contour
-* iterates in one way or the other, depending on the order of the points and calculated vectors.
-* uPointOrder: Points are order in a U shape
-* lstIndexs: number of points on each spline
-*/
+ * Closes the sides of the contour
+ * iterates in one way or the other, depending on the order of the points and calculated vectors.
+ * uPointOrder: Points are order in a U shape
+ * lstIndexs: number of points on each spline
+ */
 void CreateMeshFromPoints::CloseContourSides(std::vector<int> lstIndexs, bool uPointOrder, bool isClosedCont){
-       int     sizeLstIdexes = lstIndexs.size();
-       int sizePoints = bbGetInputLstX().size();
-
-       int firstIndex, end, centroidId, numPointsFace, contraryId;
-       int increment = uPointOrder?1:sizeLstIdexes;
-       double centroid[3];
-       int numProcessFaces = sizeLstIdexes > 1?2:1;
-       for(int facesIdx = 0; facesIdx < numProcessFaces; facesIdx++){
-               std::fill(std::begin(centroid), std::end(centroid), 0);
-               if(facesIdx == 0)
-               {
-                       firstIndex = 0;
-                       numPointsFace = uPointOrder?lstIndexs[0]: sizeLstIdexes;
-                       end = uPointOrder?firstIndex + numPointsFace:sizePoints - lstIndexs[sizeLstIdexes - 1] + 1;
-                       contraryId = sizePoints-1;
-               }else{
-                       firstIndex = uPointOrder?sizePoints - lstIndexs[sizeLstIdexes-1]:lstIndexs[0]-1;
-                       numPointsFace = uPointOrder?lstIndexs[sizeLstIdexes-1]:sizeLstIdexes;
-                       end = uPointOrder?firstIndex + numPointsFace:sizePoints;
-                       contraryId = 0;
-               }
-               if(numPointsFace > 1)
-               {
-                       bool validCentroid = CalcValidCentroid(centroid, firstIndex, end, increment, numPointsFace);
-                       if(validCentroid)
-                       {
-                               bool normalOrder    = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
-                               centroidId          = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
-                               //vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
-                               //triangleStrip->GetPointIds()->SetNumberOfIds(numPointsFace*2 + (!isClosedCont?2:0));
-                               //int triangleIndex = 0;
-                               if( normalOrder )
+    int        sizeLstIdexes = lstIndexs.size();
+    int sizePoints = bbGetInputLstX().size();
+    
+    int firstIndex, end, centroidId, numPointsFace, contraryId;
+    int increment = uPointOrder?1:sizeLstIdexes;
+    double centroid[3];
+    int numProcessFaces = sizeLstIdexes > 1?2:1;
+    for(int facesIdx = 0; facesIdx < numProcessFaces; facesIdx++){
+        std::fill(std::begin(centroid), std::end(centroid), 0);
+        if(facesIdx == 0)
+        {
+            firstIndex = 0;
+            numPointsFace = uPointOrder?lstIndexs[0]: sizeLstIdexes;
+            end = uPointOrder?firstIndex + numPointsFace:sizePoints - lstIndexs[sizeLstIdexes - 1] + 1;
+            contraryId = sizePoints-1;
+        }else{
+            firstIndex = uPointOrder?sizePoints - lstIndexs[sizeLstIdexes-1]:lstIndexs[0]-1;
+            numPointsFace = uPointOrder?lstIndexs[sizeLstIdexes-1]:sizeLstIdexes;
+            end = uPointOrder?firstIndex + numPointsFace:sizePoints;
+            contraryId = 0;
+        }
+        if(numPointsFace > 1)
+        {
+            bool validCentroid = CalcValidCentroid(centroid, firstIndex, end, increment, numPointsFace);
+            if(validCentroid)
+            {
+                bool normalOrder    = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
+                centroidId          = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
+                //vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
+                //triangleStrip->GetPointIds()->SetNumberOfIds(numPointsFace*2 + (!isClosedCont?2:0));
+                //int triangleIndex = 0;
+                if( normalOrder )
                 {
-                       int initial = firstIndex;
-                       for(int index = initial; index < end; index+=increment){
-                                               if(index+increment >= end && !isClosedCont){
-                                                       vtkNew<vtkTriangle> triangle;
-                                                       triangle->GetPointIds()->SetId(0, index);
-                                                       triangle->GetPointIds()->SetId(1, initial);
-                                                       triangle->GetPointIds()->SetId(2, centroidId);
-                                                       cells->InsertNextCell(triangle);
-                                               }else if(index+increment < end){
-                                                       vtkNew<vtkTriangle> triangle;
-                                                       triangle->GetPointIds()->SetId(0, index);
-                                                       triangle->GetPointIds()->SetId(1, index+increment);
-                                                       triangle->GetPointIds()->SetId(2, centroidId);
-                                                       cells->InsertNextCell(triangle);
-                                               }
-                                               /*
-                                               triangleStrip->GetPointIds()->SetId(triangleIndex,index);
-                                               triangleStrip->GetPointIds()->SetId(triangleIndex+1,centroidId);//1
-                                               if(index+increment >= end && !isClosedCont){
-                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+2,initial);//2
-                                                       triangleStrip->GetPointIds()->SetId(triangleIndex+3,centroidId);//3
-                                               }
-                                               triangleIndex+=2;
-                                               */
-                                       }
-                                       //cells->InsertNextCell(triangleStrip);
-                               } else {
-                                       int initial = firstIndex-1;
-                                       int triangleStripStart = end-1;
-                                       for(int index = triangleStripStart; index > initial; index-=increment){ 
-                                               if(index-increment <= initial && !isClosedCont){
-                                                       vtkNew<vtkTriangle> triangle;
-                                                       triangle->GetPointIds()->SetId(0, index);
-                                                       triangle->GetPointIds()->SetId(1, triangleStripStart);
-                                                       triangle->GetPointIds()->SetId(2, centroidId);
-                                                       cells->InsertNextCell(triangle);
-                                               }else if(index-increment > initial){
-                                                       vtkNew<vtkTriangle> triangle;
-                                                       triangle->GetPointIds()->SetId(0, index);
-                                                       triangle->GetPointIds()->SetId(1, index-increment);
-                                                       triangle->GetPointIds()->SetId(2, centroidId);
-                                                       cells->InsertNextCell(triangle);
-                                               }
-                                       }
-                               }//if normalOrder
-                       }//if validCentroid
-               }//if numPointsFace
-       }//for facesIdx
-
+                    int initial = firstIndex;
+                    for(int index = initial; index < end; index+=increment){
+                        if(index+increment >= end && !isClosedCont){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, initial);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }else if(index+increment < end){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, index+increment);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }
+                        /*
+                         triangleStrip->GetPointIds()->SetId(triangleIndex,index);
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+1,centroidId);//1
+                         if(index+increment >= end && !isClosedCont){
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+2,initial);//2
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+3,centroidId);//3
+                         }
+                         triangleIndex+=2;
+                         */
+                    }
+                    //cells->InsertNextCell(triangleStrip);
+                } else {
+                    int initial = firstIndex-1;
+                    int triangleStripStart = end-1;
+                    for(int index = triangleStripStart; index > initial; index-=increment){
+                        if(index-increment <= initial && !isClosedCont){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, triangleStripStart);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }else if(index-increment > initial){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, index-increment);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }
+                    }
+                }//if normalOrder
+            }//if validCentroid
+        }//if numPointsFace
+    }//for facesIdx
+    
 }
 
 /**
-* Checks if the normal from firstPointId, secPointId and centroid points away 
-* from the vector centroid to contrPointId.
-* Used to check that the order used to create the new polygons is correct.
-*/
+ * Checks if the normal from firstPointId, secPointId and centroid points away
+ * from the vector centroid to contrPointId.
+ * Used to check that the order used to create the new polygons is correct.
+ */
 bool CreateMeshFromPoints::isPointingCorrectly( int firstPointId, int secPointId, double(&centroid)[3], int contrPointId) {
-
-       double firstPoint[3], secPoint[3], contrPoint[3];
-       points->GetPoint(firstPointId, firstPoint);
-       points->GetPoint(secPointId, secPoint);
-       
-       double firstVect[3], secVect[3], normal[3], contrVect[3];
-       
-       vtkMath::Subtract(firstPoint, centroid, firstVect);
-       vtkMath::Subtract(secPoint, centroid, secVect);
-       
-       points->GetPoint(contrPointId, contrPoint);
-       vtkMath::Subtract(contrPoint, centroid, contrVect);
-       
-       vtkMath::Cross(firstVect, secVect, normal);
-       double dotCalc;
-       dotCalc = vtkMath::Dot(normal, contrVect);
-       
-       return dotCalc<0;
+    
+    double firstPoint[3], secPoint[3], contrPoint[3];
+    points->GetPoint(firstPointId, firstPoint);
+    points->GetPoint(secPointId, secPoint);
+    
+    double firstVect[3], secVect[3], normal[3], contrVect[3];
+    
+    vtkMath::Subtract(firstPoint, centroid, firstVect);
+    vtkMath::Subtract(secPoint, centroid, secVect);
+    
+    points->GetPoint(contrPointId, contrPoint);
+    vtkMath::Subtract(contrPoint, centroid, contrVect);
+    
+    vtkMath::Cross(firstVect, secVect, normal);
+    double dotCalc;
+    dotCalc = vtkMath::Dot(normal, contrVect);
+    
+    return dotCalc<0;
 }
 
 /**
-* Checks if the order of the points represent a curved spline (U shape) or the points resemble a straight spline.
-* Now it checks the angle between each point and the vector that goes from the last point to the first.
-*
-* Previous version checked the curvature between 3 points in the spline, but this created problems when the straight lines
-* had curves in the middle, increasing the curvature although they are not in the U shape.
-*/
+ * Checks if the order of the points represent a curved spline (U shape) or the points resemble a straight spline.
+ * Now it checks the angle between each point and the vector that goes from the last point to the first.
+ *
+ * Previous version checked the curvature between 3 points in the spline, but this created problems when the straight lines
+ * had curves in the middle, increasing the curvature although they are not in the U shape.
+ */
 bool CreateMeshFromPoints::CheckLinePointOrder(){
-       int sizePoints = bbGetInputLstX().size();
-       std::vector<int> lstIndexs = bbGetInputLstIndexs();
-       double point1[3], point2[3], point3[3];
-       double center[3];
-       double firstAngleSum = 0;
-       double secondAngleSum = 0;
-
-       points->GetPoint(0, point1);
-       points->GetPoint((lstIndexs[0]-1), point3);
-       double firstVect[3];
-       double secVect[3];
-       vtkMath::Subtract(point3, point1, firstVect);
-       for(int i = 0; i < lstIndexs[0]; i++){
-               points->GetPoint(i, point2);
-               vtkMath::Subtract(point2, point1, secVect);
-               firstAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
-       }
-       points->GetPoint((sizePoints-lstIndexs[0]), point3);
-       vtkMath::Subtract(point3, point1, firstVect);
-       for(int i = 0; i < sizePoints; i+=lstIndexs.size()){
-               points->GetPoint(i, point2);
-               vtkMath::Subtract(point2, point1, secVect);
-               secondAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
-       }
-
-       return firstAngleSum < secondAngleSum;
+    int sizePoints = bbGetInputLstX().size();
+    std::vector<int> lstIndexs = bbGetInputLstIndexs();
+    double point1[3], point2[3], point3[3];
+    double center[3];
+    double firstAngleSum = 0;
+    double secondAngleSum = 0;
+    
+    points->GetPoint(0, point1);
+    points->GetPoint((lstIndexs[0]-1), point3);
+    double firstVect[3];
+    double secVect[3];
+    vtkMath::Subtract(point3, point1, firstVect);
+    for(int i = 0; i < lstIndexs[0]; i++){
+        points->GetPoint(i, point2);
+        vtkMath::Subtract(point2, point1, secVect);
+        firstAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
+    }
+    points->GetPoint((sizePoints-lstIndexs[0]), point3);
+    vtkMath::Subtract(point3, point1, firstVect);
+    for(int i = 0; i < sizePoints; i+=lstIndexs.size()){
+        points->GetPoint(i, point2);
+        vtkMath::Subtract(point2, point1, secVect);
+        secondAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
+    }
+    
+    return firstAngleSum < secondAngleSum;
 }
 
 /**
-* Closes an open contour
-* lstIndexs: number of points on each spline
-*/
+ * Closes an open contour
+ * lstIndexs: number of points on each spline
+ */
 void CreateMeshFromPoints::CloseOpenContourSurface(std::vector<int> lstIndexs){
-       bool linePointOrder = CheckLinePointOrder();
-       CloseContourSides(lstIndexs, !linePointOrder, false);
-       CloseContourBottom(!linePointOrder);
+    bool linePointOrder = CheckLinePointOrder();
+    CloseContourSides(lstIndexs, !linePointOrder, false);
+    CloseContourBottom(!linePointOrder);
 }
 
 /**
-* Calculates centroid and checks if points are collinear.
-* centroid: array to store calculation
-* start: start index of points to use
-* end: end index of points to use
-* increment: increment to be used in point iteration
-* numPoints: number of points used to calculate the centroid.
-* Returns a bool indicating the validity of the centroid calculated.
-* False = invalid centroid = all points are the same.
-*/
+ * Calculates centroid and checks if points are collinear.
+ * centroid: array to store calculation
+ * start: start index of points to use
+ * end: end index of points to use
+ * increment: increment to be used in point iteration
+ * numPoints: number of points used to calculate the centroid.
+ * Returns a bool indicating the validity of the centroid calculated.
+ * False = invalid centroid = all points are the same.
+ */
 bool CreateMeshFromPoints::CalcValidCentroid(double(&centroid)[3], int start, int end, int increment, int numPoints){
-       double currPoint[3] = {}, prevPoint[3] = {}, middlePoint[3] = {}, firstPoint[3] = {};
-       double vector1[3], vector2[3];
-       bool samePoint = true;
-       int splineMidPoint = numPoints/2;
-       bool collinear = true;
-
-       points->GetPoint(start, firstPoint);
-       points->GetPoint(splineMidPoint, middlePoint);
-       vtkMath::Subtract(middlePoint, firstPoint, vector1);
-
-       for(int i = start; i < end; i+=increment){
-               points->GetPoint(i, currPoint);
-               if(samePoint && i > start && (currPoint[0] != prevPoint[0] || currPoint[1] != prevPoint[1] || currPoint[2] != prevPoint[2])){
-                       samePoint = false;
-               }
-
-               vtkMath::Subtract(currPoint, firstPoint, vector2);
-               double angle = vtkMath::AngleBetweenVectors(vector1, vector2);
-               if(angle > 0.0001 && collinear){
-                       collinear = false;
-               }
-               
-               centroid[0] += currPoint[0];
-               centroid[1] += currPoint[1];
-               centroid[2] += currPoint[2];
-               std::copy(std::begin(currPoint), std::end(currPoint), prevPoint);
-       }
-       
-       centroid[0] /= numPoints;
-       centroid[1] /= numPoints;
-       centroid[2] /= numPoints;
-       
-       return !samePoint && !collinear;
+    double currPoint[3] = {}, prevPoint[3] = {}, middlePoint[3] = {}, firstPoint[3] = {};
+    double vector1[3], vector2[3];
+    bool samePoint = true;
+    int splineMidPoint = numPoints/2;
+    bool collinear = true;
+    
+    points->GetPoint(start, firstPoint);
+    points->GetPoint(splineMidPoint, middlePoint);
+    vtkMath::Subtract(middlePoint, firstPoint, vector1);
+    
+    for(int i = start; i < end; i+=increment){
+        points->GetPoint(i, currPoint);
+        if(samePoint && i > start && (currPoint[0] != prevPoint[0] || currPoint[1] != prevPoint[1] || currPoint[2] != prevPoint[2])){
+            samePoint = false;
+        }
+        
+        vtkMath::Subtract(currPoint, firstPoint, vector2);
+        double angle = vtkMath::AngleBetweenVectors(vector1, vector2);
+        if(angle > 0.0001 && collinear){
+            collinear = false;
+        }
+        
+        centroid[0] += currPoint[0];
+        centroid[1] += currPoint[1];
+        centroid[2] += currPoint[2];
+        std::copy(std::begin(currPoint), std::end(currPoint), prevPoint);
+    }
+    
+    centroid[0] /= numPoints;
+    centroid[1] /= numPoints;
+    centroid[2] /= numPoints;
+    
+    return !samePoint && !collinear;
 }
 
 /**
-* Closes the bottom of the given countour.
-* Should only be used when its an open contour.
-* uPointOrder: points are ordered in U shape
-*/
+ * Closes the bottom of the given countour.
+ * Should only be used when its an open contour.
+ * uPointOrder: points are ordered in U shape
+ */
 void CreateMeshFromPoints::CloseContourBottom(bool uPointOrder){
-       std::vector<int> lstIndexs = bbGetInputLstIndexs();
-       int sizeLstIdexes = lstIndexs.size();
-       int sizeLstX = bbGetInputLstX().size();
-       
-       vtkSmartPointer<vtkTriangleStrip> triangleStripBottom = vtkSmartPointer<vtkTriangleStrip>::New();
-       triangleStripBottom->GetPointIds()->SetNumberOfIds(sizeLstIdexes*2);
-       
-       double originPoint[3];
-       points->GetPoint(0, originPoint);
-       int middleMeshPoint = uPointOrder?lstIndexs[0]/2:lstIndexs[0]*sizeLstIdexes/2;
-       
-       bool normalOrder = isPointingCorrectly(uPointOrder?lstIndexs[0]-1:sizeLstX-lstIndexs[0], uPointOrder?lstIndexs[0]:1, originPoint, middleMeshPoint);
-       
-       int triangleIndex = 0, currentId = 0, nextId = 0;
-       for(int splineIndex = 0; splineIndex < sizeLstIdexes;splineIndex++){
-               nextId = uPointOrder?currentId + lstIndexs[splineIndex] - 1:sizeLstX - sizeLstIdexes + splineIndex;
-               if(normalOrder)
-               {
-                       triangleStripBottom->GetPointIds()->SetId(triangleIndex, currentId);
-                       triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, nextId);
-               }
-               else{
-                       triangleStripBottom->GetPointIds()->SetId(triangleIndex, nextId);
-                       triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, currentId);
-               }
-               currentId = uPointOrder?nextId + 1: splineIndex+1;
-               triangleIndex+=2;
-       }
-       cells->InsertNextCell(triangleStripBottom);
+    std::vector<int> lstIndexs = bbGetInputLstIndexs();
+    int sizeLstIdexes = lstIndexs.size();
+    int sizeLstX = bbGetInputLstX().size();
+    
+    vtkSmartPointer<vtkTriangleStrip> triangleStripBottom = vtkSmartPointer<vtkTriangleStrip>::New();
+    triangleStripBottom->GetPointIds()->SetNumberOfIds(sizeLstIdexes*2);
+    
+    double originPoint[3];
+    points->GetPoint(0, originPoint);
+    int middleMeshPoint = uPointOrder?lstIndexs[0]/2:lstIndexs[0]*sizeLstIdexes/2;
+    
+    bool normalOrder = isPointingCorrectly(uPointOrder?lstIndexs[0]-1:sizeLstX-lstIndexs[0], uPointOrder?lstIndexs[0]:1, originPoint, middleMeshPoint);
+    
+    int triangleIndex = 0, currentId = 0, nextId = 0;
+    for(int splineIndex = 0; splineIndex < sizeLstIdexes;splineIndex++){
+        nextId = uPointOrder?currentId + lstIndexs[splineIndex] - 1:sizeLstX - sizeLstIdexes + splineIndex;
+        if(normalOrder)
+        {
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex, currentId);
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, nextId);
+        }
+        else{
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex, nextId);
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, currentId);
+        }
+        currentId = uPointOrder?nextId + 1: splineIndex+1;
+        triangleIndex+=2;
+    }
+    cells->InsertNextCell(triangleStripBottom);
 }
 
-//===== 
+//=====
 // 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 CreateMeshFromPoints::bbUserSetDefaultValues()
 {
-
-//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
-//    Here we initialize the input 'In' to 0
-//   bbSetInputIn(0);
-       bbSetInputCloseSurface(false);
-       points          = NULL;
-       cells           = NULL;
-       polydata        = NULL;
-       clean           = NULL;
-       triangle        = NULL;
+    
+    //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+    //    Here we initialize the input 'In' to 0
+    //   bbSetInputIn(0);
+    bbSetInputCloseSurface(false);
+    points             = NULL;
+    cells              = NULL;
+    polydata   = NULL;
+    clean              = NULL;
+    triangle   = 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 CreateMeshFromPoints::bbUserInitializeProcessing()
 {
-
-//  THE INITIALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+    //  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 CreateMeshFromPoints::bbUserFinalizeProcessing()
 {
-
-//  THE FINALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should desallocate the internal/output pointers 
-//    if any
-  
-}
+    
+    //  THE FINALIZATION METHOD BODY :
+    //    Here does nothing
+    //    but this is where you should desallocate the internal/output pointers
+    //    if any
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index f92f3428c5a8affa6d31268d41d79025bb7e9c98..5a34600412665de1e7b3ef19a45c128030268289 100644 (file)
@@ -14,7 +14,6 @@
 #include "vtkCleanPolyData.h"
 #include "vtkTriangleFilter.h"
 
-
 namespace bbcreaVtk
 {
 
index 16b8bfd71dcf802f482b6137192518a0b77ab2e9..58fd52f7d57ff7880d5b853d1e5e85154c5aac53 100644 (file)
@@ -32,7 +32,7 @@ void HausdorffDistancePointSetFilter::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
 
-       if ((bbGetInputInA()!=NULL) &&  (bbGetInputInB()!=NULL)  ) 
+       if ( (bbGetInputActive()==true) && (bbGetInputInA()!=NULL) &&  (bbGetInputInB()!=NULL)  )
        {
                vtkHausdorffDistancePointSetFilter *hausdorff = vtkHausdorffDistancePointSetFilter::New();
                hausdorff->SetInputData(0, bbGetInputInA() );
@@ -50,9 +50,13 @@ void HausdorffDistancePointSetFilter::Process()
                bbSetOutputHausdorffDistance( hd );
                bbSetOutputOutA( (vtkPolyData*) (hausdorff->GetOutput(0)) );
                bbSetOutputOutB( (vtkPolyData*) (hausdorff->GetOutput(1)) );
-       } // if 
+    } else {
+        bbSetOutputOutA( bbGetInputInA() );
+        bbSetOutputOutB( bbGetInputInB() );
+    }// if Type InA InB
 }
-//===== 
+
+//=====
 // 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 HausdorffDistancePointSetFilter::bbUserSetDefaultValues()
@@ -60,36 +64,33 @@ void HausdorffDistancePointSetFilter::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
-   bbSetInputInA(NULL);
-   bbSetInputInB(NULL);
-  
+    bbSetInputActive(true);
+    bbSetInputInA(NULL);
+    bbSetInputInB(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 HausdorffDistancePointSetFilter::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 HausdorffDistancePointSetFilter::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 434c36a3a1e746918a137bfa379099ddc2f2b91c..2eea86f1d7b107b9a2ed4f7af1d1dd01ec9018bb 100644 (file)
@@ -21,6 +21,7 @@ class bbcreaVtk_EXPORT HausdorffDistancePointSetFilter
 //===== 
 // 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(InA,vtkPolyData*);
   BBTK_DECLARE_INPUT(InB,vtkPolyData*);
 
@@ -43,6 +44,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(HausdorffDistancePointSetFilter,bbtk::AtomicBlackB
   BBTK_DESCRIPTION("(C++,Python) Output Mesh with HausdorffDistance and RelativeDistance vector information ");
   BBTK_CATEGORY("empty");
 
+  BBTK_INPUT(HausdorffDistancePointSetFilter,Active,"(default true)   True/False",bool,"");
   BBTK_INPUT(HausdorffDistancePointSetFilter,InA,"Mesh A",vtkPolyData*,"");
   BBTK_INPUT(HausdorffDistancePointSetFilter,InB,"Mesh B",vtkPolyData*,"");
 
index e0d163874bb265e60c84b167eed5536c55abba5f..d728ac100fd8d4eb43cad64eca39ca7abfbefe2e 100644 (file)
@@ -44,6 +44,7 @@
     Here we include the standard header iostream.h -->
   <include><PRE>iostream</PRE></include>
   <include><PRE>vtkImageData.h</PRE></include>
+  <include><PRE>vtkDataSet.h</PRE></include>
   <!--=====================================================================-->
 
   <!--========================================================================
       and description 'First input' -->
 
 
-  <typedef><PRE>typedef std::vector<std::string> OutputTypeVectorString;</PRE></typedef>
-  <typedef><PRE>typedef std::vector<vtkImageData*> OutputTypeVectorVtkImageData;</PRE></typedef>
+  <typedef><PRE>typedef std::vector<std::string>    OutputTypeVectorString;</PRE></typedef>
+  <typedef><PRE>typedef std::vector<vtkImageData*>  OutputTypeVectorVtkImageData;</PRE></typedef>
+  <typedef><PRE>typedef std::vector<vtkDataSet*>    OutputTypeVectorVtkDataSet;</PRE></typedef>
 
 
   <input name="FileNames" type="OutputTypeVectorString" description="First input"/>
   
   <!-- Declares an output with name 'Out', type 'double' 
       and description 'First output' -->
-  <output name="Out" type="vtkImageData*" description="Image Output"/>
-  <output name="OutVector" type="OutputTypeVectorVtkImageData" description="lst of vtkImageData*"/>
+  <output name="Out"                type="vtkDataSet*"                  description="first element of the vector"/>
+  <output name="OutVectorDataSet"   type="OutputTypeVectorVtkDataSet"   description="lst of vtkDataSet*     example: vtkImageData* vtkPolyData*"/>
   <!--=====================================================================-->
 
   <process>
index bcdc5102743a4a92d3df34532fbe2be8547b6130..442bd377e4e8cb70f159c86dd4c5fda7eb360f4a 100644 (file)
@@ -54,7 +54,8 @@ void ImageAppendComponents::bbUserSetDefaultValues()
        bbSetInputIn2(NULL);
        bbSetInputIn3(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 ImageAppendComponents::bbUserInitializeProcessing()
@@ -64,7 +65,8 @@ void ImageAppendComponents::bbUserInitializeProcessing()
 //    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 ImageAppendComponents::bbUserFinalizeProcessing()
index 9f0ccec59e54dff1417bef30a2aa76cd219ad27f..b9b7c98c7e88f9fce2bb0fbf0b8e9b0716bac893 100644 (file)
@@ -34,21 +34,20 @@ void ImageDataStructuredPoints::bbUserSetDefaultValues()
        bbSetInputData5(NULL);
        bbSetInputData6(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 ImageDataStructuredPoints::bbUserInitializeProcessing()
 {
-  
 }
 //===== 
 // 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 ImageDataStructuredPoints::bbUserFinalizeProcessing()
 {
-
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 4998bf90b5a673b7d1484c7b78142754aaf23720..8608c61aa7a6c0db741e858d6fe9a48af1d934a2 100644 (file)
@@ -28,7 +28,7 @@ void ImageGaussianSmooth2::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
     
-    if (bbGetInputIn()!=NULL)
+    if ((bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
     {
         if (gaussiansmooth!=NULL)
         {
@@ -44,49 +44,45 @@ void ImageGaussianSmooth2::Process()
     } else {
         bbSetOutputOut(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 ImageGaussianSmooth2::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
     gaussiansmooth=NULL;
+    bbSetInputActive(true);
     bbSetInputIn(NULL);
     bbSetInputStdDevX(2);
     bbSetInputStdDevY(2);
     bbSetInputStdDevZ(2);
-
 }
-//===== 
+
+//=====
 // 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 ImageGaussianSmooth2::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 ImageGaussianSmooth2::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 39503dfc4c9c8d665cd57b4ef66715137f73d510..c3f9a5f04705868ffeddbc2f569c86aaa26482b3 100644 (file)
@@ -22,6 +22,7 @@ class bbcreaVtk_EXPORT ImageGaussianSmooth2
 //===== 
 // 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(In,vtkImageData*);
     BBTK_DECLARE_INPUT(StdDevX,double);
     BBTK_DECLARE_INPUT(StdDevY,double);
@@ -42,6 +43,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageGaussianSmooth2,bbtk::AtomicBlackBox);
     BBTK_DESCRIPTION("No Description.");
     BBTK_CATEGORY("empty");
 
+    BBTK_INPUT(ImageGaussianSmooth2,Active,"(default true) true/false",bool,"");
     BBTK_INPUT(ImageGaussianSmooth2,In,"First input",vtkImageData*,"");
     BBTK_INPUT(ImageGaussianSmooth2,StdDevX,"(default 2) Standard deviation in direction X",double,"");
     BBTK_INPUT(ImageGaussianSmooth2,StdDevY,"(default 2) Standard deviation in direction Y",double,"");
index 23b4330339a562f11da6206434d468022e0c97a4..8d90757eef69f0bf0526f017292cb2725c5700ba 100644 (file)
 //===== 
 #include "bbcreaVtkImageMaskDice.h"
 #include "bbcreaVtkPackage.h"
+
+#include "creaVtk_MACROS.h"
+
 namespace bbcreaVtk
 {
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageMaskDice)
 BBTK_BLACK_BOX_IMPLEMENTATION(ImageMaskDice,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)
-//===== 
+
+
+#define ACUMULATE(VMA,VMM,TP,FP,FN)           \
+            if ( (VMA>0) || (VMM>0) )                 \
+            {                                         \
+                    if ((VMA>0)&&(VMM>0))             \
+                    {                                 \
+                        TP++;                         \
+                    } else if ((VMA>0)&&(VMM==0)) {   \
+                        FP++;                         \
+                    } else if ((VMA==0)&&(VMM>0)) {   \
+                        FN++;                         \
+                    }                                 \
+            }
+
+#define INSERTINVECTOR(TP,FP,FN)                                                           \
+        LstTitles.push_back( "tp");     LstValues.push_back( std::to_string(TP) );         \
+        LstTitles.push_back( "fp");     LstValues.push_back( std::to_string(FP) );         \
+        LstTitles.push_back( "fn");     LstValues.push_back( std::to_string(FN) );         \
+        LstTitles.push_back( "vol1");   LstValues.push_back( std::to_string(TP+FP) );      \
+        LstTitles.push_back( "vol2");   LstValues.push_back( std::to_string(TP+FN) );      \
+        if ((TP==0) && (FP==0) && (FN==0)) {                                               \
+            LstTitles.push_back( "_dice"); LstValues.push_back( "-1" );                    \
+        }else {                                                                            \
+            double tmp;                                                                    \
+            tmp = 2 * (double)TP / (2 * (double)TP + (double)FP +  (double)FN );           \
+            LstTitles.push_back( "dice"); LstValues.push_back( std::to_string(tmp) );      \
+        }
+
 void ImageMaskDice::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 
+//    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')
 
+    printf("EED ImageMaskDice::Process Start .. \n");
+    long int tpAll=0        ,fpAll=0        ,fnAll=0        ;
+
+    if ( (bbGetInputIn1()!=NULL) && (bbGetInputIn2()!=NULL) )
+    {
+        int     ext[6];
+        int dimX1,dimY1,dimZ1;
+        bbGetInputIn1()->GetExtent(ext);
+        dimX1 = ext[1]-ext[0]+1;
+        dimY1 = ext[3]-ext[2]+1;
+        dimZ1 = ext[5]-ext[4]+1;
+        int dimX2,dimY2,dimZ2;
+        bbGetInputIn2()->GetExtent(ext);
+        dimX2 = ext[1]-ext[0]+1;
+        dimY2 = ext[3]-ext[2]+1;
+        dimZ2 = ext[5]-ext[4]+1;
+        if ( (dimX1==dimX2) &&
+             (dimY1==dimY2) &&
+             (dimZ1==dimZ2) )
+        {
+            DEF_POINTER_IMAGE_VTK_CREA(vMA,ssMA,pMA,stMA,bbGetInputIn1())
+            DEF_POINTER_IMAGE_VTK_CREA(vMM,ssMM,pMM,stMM,bbGetInputIn2())
+            long int i,size=dimX1*dimY1*dimZ1;
+            for (i=0;i<size;i++)
+            {
+                GETVALUE2_VTK_CREA(vMA,pMA,stMA,i)
+                GETVALUE2_VTK_CREA(vMM,pMM,stMM,i)
+                ACUMULATE(vMA, vMM, tpAll, fpAll, fnAll)
+            } // for
+//            INSERTINVECTOR(tpAll,fpAll,fnAll)
+//            bbSetOutputLstTitles(LstTitles);
+//            bbSetOutputLstValues(LstValues);
+        } else {
+            printf ("EED Warning...  creaSDRAVisu VolumeMassDice::Process  Size of images are not the same. \n");
+        } // if dimXYZ I MA MM
+    } else {
+        printf ("EED Warning...  VolumeMassDice::Process  Missing input files...\n");
+    }// if
+    printf("EED ImageMaskDice::Process .. End \n");
+
+    std::vector<std::string> LstTitles;
+    std::vector<std::string> LstValues;
+    INSERTINVECTOR(tpAll,fpAll,fnAll)
+    bbSetOutputLstTitles(LstTitles);
+    bbSetOutputLstValues(LstValues);
+
     
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-    printf("EED ImageMaskDice::Process  Error, this method is not implemented \n");
-
-    bbSetOutputOut( -1 );
 }
-//===== 
+
+//=====
 // 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 ImageMaskDice::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
     bbSetInputIn1(NULL);
     bbSetInputIn2(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 ImageMaskDice::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 ImageMaskDice::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 5caeea7a47e4a76f9d8718b396602fab9dfa70bb..316e4bd60626918739fb95af94ef5e0378db1170 100644 (file)
@@ -23,7 +23,8 @@ class bbcreaVtk_EXPORT ImageMaskDice
 //===== 
   BBTK_DECLARE_INPUT(In1,vtkImageData*);
   BBTK_DECLARE_INPUT(In2,vtkImageData*);
-  BBTK_DECLARE_OUTPUT(Out,double);
+  BBTK_DECLARE_OUTPUT(LstTitles, std::vector<std::string> );
+  BBTK_DECLARE_OUTPUT(LstValues, std::vector<std::string> );
   BBTK_PROCESS(Process);
   void Process();
 //===== 
@@ -34,11 +35,12 @@ class bbcreaVtk_EXPORT ImageMaskDice
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageMaskDice,bbtk::AtomicBlackBox);
   BBTK_NAME("ImageMaskDice");
   BBTK_AUTHOR("InfoDev");
-  BBTK_DESCRIPTION("(C++?????,Python)");
+  BBTK_DESCRIPTION("(C++,Python)");
   BBTK_CATEGORY("empty");
   BBTK_INPUT(ImageMaskDice,In1,"Image 1",vtkImageData*,"");
   BBTK_INPUT(ImageMaskDice,In2,"Image 2",vtkImageData*,"");
-  BBTK_OUTPUT(ImageMaskDice,Out,"Dice",double,"");
+  BBTK_OUTPUT(ImageMaskDice,LstTitles,"List of titles", std::vector<std::string>  ,"");
+  BBTK_OUTPUT(ImageMaskDice,LstValues,"List of values", std::vector<std::string>  ,"");
 BBTK_END_DESCRIBE_BLACK_BOX(ImageMaskDice);
 //===== 
 // 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)
index a6c35f643c8f2a8c1614283d934f5173b8d5319f..47fd553f7c85eee45ee977ab1d5c2eecc4ef54e8 100644 (file)
@@ -28,15 +28,14 @@ void ImageThreshold::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-       if (filter!=NULL)
-       {       
-               filter->Delete();
-               filter=NULL;
-       } // if
-       filter = vtkImageThreshold::New();
-
-       if (bbGetInputIn()!=NULL)
+       if ((bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
        {
+        if (filter!=NULL)
+        {
+            filter->Delete();
+            filter=NULL;
+        } // if
+        filter = vtkImageThreshold::New();
                filter->SetInValue( bbGetInputInValue() );
                filter->SetOutValue( bbGetInputOutValue() );
                filter->SetInputData( bbGetInputIn() );
@@ -56,6 +55,7 @@ void ImageThreshold::bbUserSetDefaultValues()
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
        filter=NULL;
+    bbSetInputActive(true);
        bbSetInputIn(NULL);
        bbSetInputLower(0);
        bbSetInputUpper(10000);
index 7a5f2f2ff034e74635064c4aa19f5686e7b028bb..2dda2f548b6635221cc116a439679ade3716efe3 100644 (file)
@@ -22,6 +22,7 @@ class bbcreaVtk_EXPORT ImageThreshold
 //===== 
 // 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(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Lower,double);
   BBTK_DECLARE_INPUT(Upper,double);
@@ -31,7 +32,7 @@ class bbcreaVtk_EXPORT ImageThreshold
   BBTK_PROCESS(Process);
   void Process();
 
-       vtkImageThreshold *filter;
+  vtkImageThreshold *filter;
 
 //===== 
 // 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)
@@ -41,8 +42,9 @@ class bbcreaVtk_EXPORT ImageThreshold
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageThreshold,bbtk::AtomicBlackBox);
   BBTK_NAME("ImageThreshold");
   BBTK_AUTHOR("InfoDev");
-  BBTK_DESCRIPTION("No Description.");
+  BBTK_DESCRIPTION("(C++,JavaScript) No Description.");
   BBTK_CATEGORY("empty");
+BBTK_INPUT(ImageThreshold,Active,"(default true)  true/false",bool,"");
   BBTK_INPUT(ImageThreshold,In,"Input image",vtkImageData*,"");
   BBTK_INPUT(ImageThreshold,Lower,"(default 0) Lower threshold",double,"");
   BBTK_INPUT(ImageThreshold,Upper,"(default 10000) Upper threshold",double,"");
index b538dce06c48db78314dcb83893369b0b6ab57e0..87114e7f87ed45b68ac4616a01fd2e03b994be66 100644 (file)
@@ -34,10 +34,28 @@ void JSONDataSetWriter::Process()
   
     
     int             i;
-    int             sizeLstImages         = bbGetInputLstImages().size();
+    int             sizeLstImages       = bbGetInputLstImages().size();
+    int             sizeLstPolyData     = bbGetInputLstPolyData().size();
     int             sizeLstFileNames    = bbGetInputLstFileNames().size();
     vtkImageData    *image;
+    vtkPolyData     *polydata;
     std::string     filename;
+
+    // vtkImageData
+    if ( (sizeLstFileNames==1) && (bbGetInputImage()!=NULL) )
+    {
+        image       = bbGetInputImage();
+        filename    = bbGetInputLstFileNames()[0];
+        if (image!=NULL)
+        {
+            vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New();
+            writer->GetArchiver()->SetArchiveName( filename.c_str() );
+            writer->SetInputData( image );
+            writer->Update();
+        } // if image
+    } // if Image
+
+    // lst vtkImageData
     if ( (sizeLstImages>0) && (sizeLstImages==sizeLstFileNames) )
     {
         for ( i=0 ; i<sizeLstImages ; i++ )
@@ -53,45 +71,75 @@ void JSONDataSetWriter::Process()
             } // if image
         }// for
     } // if size
+
+    // vtkPolyData
+    if ( (sizeLstFileNames==1) && (bbGetInputPolyData()!=NULL) )
+    {
+        polydata    = bbGetInputPolyData();
+        filename    = bbGetInputLstFileNames()[0];
+        printf("EED JSONDataSetWriter::Process filename=%s\n", filename.c_str() );
+        vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New();
+        if (polydata!=NULL)
+        {
+            writer->GetArchiver()->SetArchiveName( filename.c_str() );
+            writer->SetInputData( bbGetInputPolyData() );
+            writer->Update();
+        } // if polydata
+    } // if PolyData
+
     
+    // lst vtkPolyData
+    if ( (sizeLstPolyData>0) && (sizeLstPolyData==sizeLstFileNames) )
+    {
+        for ( i=0 ; i<sizeLstPolyData ; i++ )
+        {
+            polydata    = bbGetInputLstPolyData()[i];
+            filename    = bbGetInputLstFileNames()[i];
+            if (polydata!=NULL)
+            {
+                vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New();
+                writer->GetArchiver()->SetArchiveName( filename.c_str() );
+                writer->SetInputData( polydata );
+                writer->Update();
+            } // if polydata
+        }// for
+    } // if size
+
 }
-//===== 
+
+//=====
 // 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 JSONDataSetWriter::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
-//   bbSetInputIn(NULL);
-  
+    bbSetInputImage(NULL);
+    bbSetInputPolyData(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 JSONDataSetWriter::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 JSONDataSetWriter::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 0a5231acccffbc25d74568829f3cdb7ec0d385a2..cd2e9eb60b1955f3e9f00522ef3e1c88d1e2de69 100644 (file)
@@ -9,6 +9,7 @@
 #include "iostream"
 
 #include <vtkImageData.h>
+#include <vtkPolyData.h>
 
 namespace bbcreaVtk
 {
@@ -22,11 +23,14 @@ class bbcreaVtk_EXPORT JSONDataSetWriter
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 //  BBTK_DECLARE_INPUT(In,vtkImageData*);
-  BBTK_DECLARE_INPUT(LstImages,std::vector <vtkImageData*>);
-  BBTK_DECLARE_INPUT(LstFileNames,std::vector <std::string>);
+    BBTK_DECLARE_INPUT(Image,vtkImageData*);
+    BBTK_DECLARE_INPUT(PolyData,vtkPolyData*);
+    BBTK_DECLARE_INPUT(LstImages,std::vector <vtkImageData*>);
+    BBTK_DECLARE_INPUT(LstPolyData,std::vector <vtkPolyData*>);
+    BBTK_DECLARE_INPUT(LstFileNames,std::vector <std::string>);
 //  BBTK_DECLARE_OUTPUT(Out,double);
-  BBTK_PROCESS(Process);
-  void Process();
+    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)
 //===== 
@@ -37,7 +41,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(JSONDataSetWriter,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-  BBTK_INPUT(JSONDataSetWriter,LstImages,"Input Image",std::vector <vtkImageData*>,"");
+  BBTK_INPUT(JSONDataSetWriter,Image,"Input vtkImageData ",vtkImageData*,"");
+  BBTK_INPUT(JSONDataSetWriter,PolyData,"Input vtkPolyData ",vtkPolyData*,"");
+  BBTK_INPUT(JSONDataSetWriter,LstImages,"Input vtkImageData vector",std::vector <vtkImageData*>,"");
+  BBTK_INPUT(JSONDataSetWriter,LstPolyData,"Input vtkPolydata vector",std::vector <vtkPolyData*>,"");
   BBTK_INPUT(JSONDataSetWriter,LstFileNames,"File Name",std::vector <std::string>,"");
 //  BBTK_OUTPUT(JSONDataSetWriter,Out,"First output",double,"");
 BBTK_END_DESCRIBE_BLACK_BOX(JSONDataSetWriter);
index 7ad5b0eddc171fbc74d6b6f9dd13901d6d511ed0..f89648d1adeade76940cbbe1207fac152d401fca 100644 (file)
@@ -13,7 +13,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(MarchingCubes2,bbtk::AtomicBlackBox);
 //===== 
 void MarchingCubes2::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -27,7 +26,6 @@ void MarchingCubes2::Process()
 //      (the one provided in the attribute 'type' of the tag 'input')
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-  
     if ( (bbGetInputActive()==true) && (bbGetInputIn()!=NULL) )
     {
         if (marchingcubes!=NULL)
@@ -58,16 +56,13 @@ void MarchingCubes2::Process()
     } else {
         bbSetOutputOut(NULL);
     } // Active
-
-    
-    
 }
-//===== 
+
+//=====
 // 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 MarchingCubes2::bbUserSetDefaultValues()
 {
-
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
     marchingcubes=NULL;
@@ -78,32 +73,29 @@ void MarchingCubes2::bbUserSetDefaultValues()
     bbSetInputComputeScalarsOn(true);
     bbSetOutputOut(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 MarchingCubes2::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 MarchingCubes2::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 21fcca2401d1b7abcbe666fbbd4de8f29642f7d8..e1f049a7f9b0148005ea5ef2a1358de2ff9fb39e 100644 (file)
@@ -40,12 +40,12 @@ class bbcreaVtk_EXPORT MarchingCubes2
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(MarchingCubes2,bbtk::AtomicBlackBox);
     BBTK_NAME("MarchingCubes2");
     BBTK_AUTHOR("InfoDev");
-    BBTK_DESCRIPTION("No Description. (JavaScript)");
+    BBTK_DESCRIPTION("(C++,JavaScript) No Description.");
     BBTK_CATEGORY("empty");
 
     BBTK_INPUT(MarchingCubes2,Active,"(default true) Active",bool,"");
     BBTK_INPUT(MarchingCubes2,In,"Input image",vtkImageData*,"");
-    BBTK_INPUT(MarchingCubes2,Value,"Value of the iso-surface",double,"");
+    BBTK_INPUT(MarchingCubes2,Value,"(default 400) Value of the iso-surface",double,"");
     BBTK_INPUT(MarchingCubes2,ComputeNormalsOn,"Set the computation of normals",bool,"");
     BBTK_INPUT(MarchingCubes2,ComputeScalarsOn,"Set the computation of scalars",bool,"");
 
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIimageWriter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIimageWriter.cxx
new file mode 100644 (file)
index 0000000..b271e53
--- /dev/null
@@ -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 "bbcreaVtkNIFTIimageWriter.h"
+#include "bbcreaVtkPackage.h"
+
+#include "vtkNIFTIImageWriter.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,NIFTIimageWriter)
+BBTK_BLACK_BOX_IMPLEMENTATION(NIFTIimageWriter,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 NIFTIimageWriter::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 = " <<bbGetOutputOut() << std::endl;
+    
+    if (bbGetInputIn()!=NULL)
+    {
+          vtkNIFTIImageWriter * writer = vtkNIFTIImageWriter::New();
+          writer->SetInputData( bbGetInputIn() );
+          writer->SetFileName( bbGetInputFileName().c_str() );
+//          writer->SetNIFTIHeader(reader1->GetNIFTIHeader());
+//          writer->SetSFormMatrix(reader1->GetSFormMatrix());
+          writer->SetNIFTIVersion(2);
+          writer->Update();
+    } // if In
+    
+}
+
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void NIFTIimageWriter::bbUserSetDefaultValues()
+{
+    //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+    //    Here we initialize the input 'In' to 0
+    bbSetInputIn(NULL);
+}
+
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void NIFTIimageWriter::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 NIFTIimageWriter::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/bbcreaVtkNIFTIimageWriter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIimageWriter.h
new file mode 100644 (file)
index 0000000..dfd5fbd
--- /dev/null
@@ -0,0 +1,50 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaVtkNIFTIimageWriter_h_INCLUDED__
+#define __bbcreaVtkNIFTIimageWriter_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT NIFTIimageWriter
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(NIFTIimageWriter,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In, vtkImageData*);
+  BBTK_DECLARE_INPUT(FileName, std::string);
+//  BBTK_DECLARE_OUTPUT(Out,double);
+  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(NIFTIimageWriter,bbtk::AtomicBlackBox);
+  BBTK_NAME("NIFTIimageWriter");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(NIFTIimageWriter,In,"Input image",vtkImageData*,"");
+  BBTK_INPUT(NIFTIimageWriter,FileName,"File name",std::string,"");
+//  BBTK_OUTPUT(NIFTIimageWriter,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(NIFTIimageWriter);
+//===== 
+// 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 // __bbcreaVtkNIFTIimageWriter_h_INCLUDED__
+
index 91f5a49d2d890a7937fac69906accbf316c72f21..3c29a25ac96c3053e1c98cf0c387f8593738fe43 100644 (file)
@@ -16,32 +16,44 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PlaneSource,bbtk::AtomicBlackBox);
 //===== 
 void PlaneSource::Process()
 {
-       double c[3];
+    double sizeX;
+    double sizeY;
+    double sizeZ;
+    double c[3];
        double p0[3];
     double p1[3];
        double p2[3];
        vtkPlaneSource *plane;
-       plane   =       vtkPlaneSource::New();
-       c[0]    =       bbGetInputCenter()[0];
-       c[1]    =       bbGetInputCenter()[1];
-       c[2]    =       bbGetInputCenter()[2];
-       p0[0]   =       0;      
-       p0[1]   =       0;
-       p0[2]   =       0;
+       plane           =       vtkPlaneSource::New();
+       c[0]            =       bbGetInputCenter()[0];
+       c[1]            =       bbGetInputCenter()[1];
+       c[2]            =       bbGetInputCenter()[2];
+       p0[0]           =       0;
+       p0[1]           =       0;
+       p0[2]           =       0;
 
+       bool byNormal   = true;
 
-       bool byNormal=true;     
-       double size=350;
-
+    if (bbGetInputVolumeSize().size()==3)
+    {
+        sizeX = bbGetInputVolumeSize()[0]-10;
+        sizeY = bbGetInputVolumeSize()[1]-10;
+        sizeZ = bbGetInputVolumeSize()[2]-10;
+    } else {
+        sizeX = 40;
+        sizeY = 40;
+        sizeZ = 40;
+    }
+    
        // xy
        if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==1)  ) 
        {
                byNormal=       false;
-               p1[0]   =       size;   
+               p1[0]   =       sizeX;
                p1[1]   =       0;
                p1[2]   =       0;    
                p2[0]   =       0;
-               p2[1]   =       size;
+               p2[1]   =       sizeY;
                p2[2]   =       0;
        }
        
@@ -49,12 +61,12 @@ void PlaneSource::Process()
        if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==1) && (bbGetInputNormal()[2]==0)  ) 
        {
                byNormal=       false;
-               p1[0]   =       size;   
+               p1[0]   =       sizeZ;
                p1[1]   =       0;
                p1[2]   =       0;    
                p2[0]   =       0;
                p2[1]   =       0;
-               p2[2]   =       size;
+               p2[2]   =       sizeX;
        }
 
        // yz
@@ -62,13 +74,27 @@ void PlaneSource::Process()
        {
                byNormal=       false;
                p1[0]   =       0;      
-               p1[1]   =       size;
-               p1[2]   =       0;    
+               p1[1]   =       sizeY;
+               p1[2]   =       0;
                p2[0]   =       0;
                p2[1]   =       0;
-               p2[2]   =       size;
+               p2[2]   =       sizeZ;
        }
 
+/*
+    p0[0]     =    c[0];
+    p0[1]     =    c[1];
+    p0[2]     =    c[2];
+
+    p1[0]     =    c[0]+0;
+    p1[1]     =    c[1]+size;
+    p1[2]     =    c[2]+0;
+    
+    p2[0]     =    c[0]+0;
+    p2[1]     =    c[1]+0;
+    p2[2]     =    c[2]+size;
+*/
+    
                plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() );
                if (byNormal==false)
                {
@@ -79,48 +105,50 @@ void PlaneSource::Process()
                        plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
                        printf("EED PlaneSource. Missing mechanism to define the size of the plane\n");
                }
-                       plane->SetCenter( c );
-
+        plane->SetCenter( c );
                plane->Update( );
     bbSetOutputPlane( (vtkDataSet*)plane );
     bbSetOutputPolyData( plane->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 PlaneSource::bbUserSetDefaultValues()
 {
-   std::vector<double> c;
-   std::vector<double> n;
+    std::vector<double> c;
        c.push_back(0);
        c.push_back(0);
        c.push_back(0);
-       n.push_back(1);
-       n.push_back(0);
-       n.push_back(0);
-   bbSetInputCenter(c);
-   bbSetInputNormal(n);
-   bbSetInputXResolution(100);
-   bbSetInputYResolution(100);
+    bbSetInputCenter( c );
+    std::vector<double> n;
+    n.push_back(1);
+    n.push_back(0);
+    n.push_back(0);
+    bbSetInputNormal( n );
+    std::vector<int> volSize;
+    volSize.push_back(40);
+    volSize.push_back(40);
+    volSize.push_back(40);
+    bbSetInputVolumeSize( volSize );
+    bbSetInputXResolution(100);
+    bbSetInputYResolution(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 PlaneSource::bbUserInitializeProcessing()
 {
-
-  
 }
-//===== 
+
+//=====
 // 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 PlaneSource::bbUserFinalizeProcessing()
 {
-
-  
-}
 }
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 2646c9bacff8426f79c08f35ad5cc1ff82b8c0c3..0f54e0cf740e17d50e927642b5cf5cfe3599f8aa 100644 (file)
@@ -25,6 +25,7 @@ class bbcreaVtk_EXPORT PlaneSource
   BBTK_DECLARE_INPUT(Normal,std::vector<double>);
   BBTK_DECLARE_INPUT(XResolution,int);
   BBTK_DECLARE_INPUT(YResolution,int);
+  BBTK_DECLARE_INPUT(VolumeSize,std::vector<int>);
   BBTK_DECLARE_OUTPUT(Plane,vtkDataSet*);
   BBTK_DECLARE_OUTPUT(PolyData,vtkPolyData*);
   BBTK_PROCESS(Process);
@@ -39,10 +40,11 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneSource,bbtk::AtomicBlackBox);
        BBTK_AUTHOR("carlos torres");
        BBTK_DESCRIPTION("No Description.");
        BBTK_CATEGORY("empty");
-       BBTK_INPUT(PlaneSource,Center,"Center (default[0,0,0]) ",std::vector<double>,"");
-       BBTK_INPUT(PlaneSource,Normal,"Normal (default[1,0,0]) ",std::vector<double>,"");
-       BBTK_INPUT(PlaneSource,XResolution,"XResolution (default 100)",int,"");
-       BBTK_INPUT(PlaneSource,YResolution,"YResolution (default 100)",int,"");
+       BBTK_INPUT(PlaneSource,Center,"( default [0,0,0] ) Center  ",std::vector<double>,"");
+       BBTK_INPUT(PlaneSource,Normal,"( default [1,0,0] ) Normal  ",std::vector<double>,"");
+       BBTK_INPUT(PlaneSource,XResolution,"(default 100) XResolution ",int,"");
+    BBTK_INPUT(PlaneSource,YResolution,"(default 100) YResolution ",int,"");
+       BBTK_INPUT(PlaneSource,VolumeSize,"(default [350 350 350])  VolumeSize [sizeX sizeY sizeZ]  ",std::vector<int>,"");
        BBTK_OUTPUT(PlaneSource,Plane,"Plane",vtkDataSet*,"");
        BBTK_OUTPUT(PlaneSource,PolyData,"vtkPolyData",vtkPolyData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(PlaneSource);
index bed2479046a0c0657f3aba14bf7fab0b63e2942d..58f529249361ea6f0c500358a2204683ca24798e 100644 (file)
@@ -80,7 +80,8 @@ printf("EED Warnning!! PolyDataToImageData::Process    Clean this code .........
                bbSetOutputOut( NULL);
        }// if In NULL
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void PolyDataToImageData::bbUserSetDefaultValues()
@@ -91,7 +92,8 @@ void PolyDataToImageData::bbUserSetDefaultValues()
        bbSetInputInImage(NULL);
        bbSetInputBackgroundValue(255);
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void PolyDataToImageData::bbUserInitializeProcessing()
@@ -105,19 +107,18 @@ void PolyDataToImageData::bbUserInitializeProcessing()
        extract                 = NULL;
        stencil                 = NULL;
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void PolyDataToImageData::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index b5fd4b3bd0926ff74ebb3bde1d423ab072b84fb6..b5dc35ab678f2e9eed49c80e1878f54e9d0c00fe 100644 (file)
@@ -30,7 +30,6 @@ class bbcreaVtk_EXPORT PolyDataToImageData
 //===== 
   BBTK_DECLARE_INPUT(InImage,vtkImageData*);
   BBTK_DECLARE_INPUT(BackgroundValue,double);
-
   BBTK_DECLARE_INPUT(InPolyData,vtkPolyData*);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
@@ -49,7 +48,7 @@ class bbcreaVtk_EXPORT PolyDataToImageData
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolyDataToImageData,bbtk::AtomicBlackBox);
   BBTK_NAME("PolyDataToImageData");
   BBTK_AUTHOR("InfoDev");
-  BBTK_DESCRIPTION("No Description.");
+  BBTK_DESCRIPTION("(C++, JavaScript) No Description.");
   BBTK_CATEGORY("empty");
 
   BBTK_INPUT(PolyDataToImageData,InImage,"Image to put Result",vtkImageData*,"");
index 4aceca30aee008ced73ee882ba39ed697c223b28..549ce494cdb4d938bffecc4c80577736e56538a3 100644 (file)
@@ -313,7 +313,9 @@ void ScalarsToColors::Process()
                 double w    = bbGetInputWindowColorLevel()[0] / 2;
                 double c    = bbGetInputWindowColorLevel()[1];
                 colorLookupTable->SetRange( c-w , c+w );
+                printf("EED ScalarsToColors::Process A %f - %f\n",w, c);
             }else {
+                printf("EED ScalarsToColors::Process B\n");
                 colorLookupTable->SetRange(0,255);
             }
             
index d64a3c7dc3fb8953b886cb95a29e5f0fe7cbfe3f..2c3a8eca21f30b086301dbf05eb26990289e9389 100644 (file)
 #include "bbcreaVtkPackage.h"
 
 #include "creaVtk_MACROS.h"
+#include <vtkImageChangeInformation.h>
+#include <vtkImageReslice.h>
 
 namespace bbcreaVtk
 {
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,TurnImage)
 BBTK_BLACK_BOX_IMPLEMENTATION(TurnImage,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 TurnImage::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 = " <<bbGetOutputOut() << std::endl;
+    
+    
+    if (bbGetInputIn()!=NULL)
+    {
+        /*
+         int dim[3];
+         int ext[6];
+         bbGetInputIn()->GetExtent(ext);
+         dim[0]        = ext[1]-ext[0]+1;
+         dim[1]        = ext[3]-ext[2]+1;
+         dim[2]        = ext[5]-ext[4]+1;
+         double spc[3];
+         bbGetInputIn()->GetSpacing(spc);
+         
+         vtkImageData *newImage = vtkImageData::New();
+         newImage->Initialize();
+         if (bbGetInputDir()==1)
+         {
+         newImage->SetSpacing( spc[1],spc[2],spc[0] );
+         newImage->SetDimensions(  dim[1],dim[2], dim[0] );
+         } else if (bbGetInputDir()==2)
+         {
+         newImage->SetSpacing( spc[0],spc[2],spc[1] );
+         newImage->SetDimensions(  dim[0],dim[2], dim[1] );
+         } else {
+         newImage->SetSpacing( spc[0],spc[1],spc[2] );
+         newImage->SetDimensions(  dim[0],dim[1], dim[2] );
+         }// if Dir
+         
+         //EED 2017-01-01 Migration VTK7
+         #if (VTK_MAJOR_VERSION <= 5)
+         newImage->SetScalarType( bbGetInputIn()->GetScalarType() );
+         newImage->SetNumberOfScalarComponents(1);
+         newImage->AllocateScalars();
+         #endif
+         #if (VTK_MAJOR_VERSION >= 6)
+         newImage->AllocateScalars( bbGetInputIn()->GetScalarType(),1 );
+         #endif
+         
+         DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn())
+         DEF_POINTER_IMAGE_VTK_CREA(vNI,ssNI,pNI,stNI,newImage)
+         
+         long int index=0;
+         int i,j,k;
+         double value;
+         for (k=0;k<dim[2];k++)
+         {
+             for (j=0;j<dim[1];j++)
+             {
+         
+                 for (i=0;i<dim[0];i++)
+                 {
+                     GETVALUE2_VTK_CREA(vIn,pIn,stIn,index)
+                     //old                                     value = bbGetInputIn()->GetScalarComponentAsDouble (i,j,k,0);
+                     if (bbGetInputDir()==1)
+                     {
+                         SETVALUE2_VTK_CREA(vIn,pNI,stNI, j + (dim[2]-k-1)*dim[1] + i*dim[1]*dim[2] )
+                         //old                                         newImage->SetScalarComponentFromDouble(j,dim[2]-k-1,i,0,value);
+                     } else if (bbGetInputDir()==2)
+                     {
+                         SETVALUE2_VTK_CREA(vIn,pNI,stNI, i + (dim[2]-k-1)*dim[0] + j*dim[0]*dim[2] )
+                         //old                                         newImage->SetScalarComponentFromDouble(i,dim[2]-k-1,j,0,value);
+                     } else {
+                         SETVALUE2_VTK_CREA(vIn,pNI,stNI,index)
+                         //old                                         newImage->SetScalarComponentFromDouble(i,j,k,0,value);
+                     }// if Dir
+                                         index++;
+                 } // for i
+         
+             } // for j
+         } // for k
+         bbSetOutputOut(newImage);
+        */
+        if ( (bbGetInputDir()>=-1) && (bbGetInputDir()<=5) )
+        {
+            vtkImageReslice             *reslice = vtkImageReslice::New();
+            vtkImageChangeInformation   *mchange = vtkImageChangeInformation::New();
+            // Reslice does all of the work.
+            if (  bbGetInputDir()==-1 )   // manual matrix
+            {
 
-// 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 = " <<bbGetOutputOut() << std::endl;
-
-  
-       if (bbGetInputIn()!=NULL)
-       {
-               int dim[3];
-               int ext[6];
-               bbGetInputIn()->GetExtent(ext);
-               dim[0]  = ext[1]-ext[0]+1;
-               dim[1]  = ext[3]-ext[2]+1;
-               dim[2]  = ext[5]-ext[4]+1;
-               double spc[3];
-               bbGetInputIn()->GetSpacing(spc);
-
-               vtkImageData *newImage = vtkImageData::New();
-               newImage->Initialize();
-               if (bbGetInputDir()==1)
-               {
-                       newImage->SetSpacing( spc[1],spc[2],spc[0] );
-                       newImage->SetDimensions(  dim[1],dim[2], dim[0] );
-               } else if (bbGetInputDir()==2)
-               {
-                       newImage->SetSpacing( spc[0],spc[2],spc[1] );
-                       newImage->SetDimensions(  dim[0],dim[2], dim[1] );
-               } else {
-                       newImage->SetSpacing( spc[0],spc[1],spc[2] );
-                       newImage->SetDimensions(  dim[0],dim[1], dim[2] );
-               }// if Dir
-
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5) 
-               newImage->SetScalarType( bbGetInputIn()->GetScalarType() );
-               newImage->SetNumberOfScalarComponents(1);
-               newImage->AllocateScalars();
-#endif
-#if (VTK_MAJOR_VERSION >= 6) 
-               newImage->AllocateScalars( bbGetInputIn()->GetScalarType(),1 );
-#endif
-
-               DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn())                                    
-               DEF_POINTER_IMAGE_VTK_CREA(vNI,ssNI,pNI,stNI,newImage)                                          
-
-               long int index=0;
-               int i,j,k;
-               double value;
-               for (k=0;k<dim[2];k++)
-               {
-                       for (j=0;j<dim[1];j++)
-                       {
-                               for (i=0;i<dim[0];i++)
-                               {
-                                       GETVALUE2_VTK_CREA(vIn,pIn,stIn,index) 
-//                                     value = bbGetInputIn()->GetScalarComponentAsDouble (i,j,k,0);
-                                       if (bbGetInputDir()==1)
-                                       {
-                                               SETVALUE2_VTK_CREA(vIn,pNI,stNI, j + (dim[2]-k-1)*dim[1] + i*dim[1]*dim[2] )            
-//                                             newImage->SetScalarComponentFromDouble(j,dim[2]-k-1,i,0,value);
-                                       } else if (bbGetInputDir()==2)
-                                       {
-                                               SETVALUE2_VTK_CREA(vIn,pNI,stNI, i + (dim[2]-k-1)*dim[0] + j*dim[0]*dim[2] )            
-//                                             newImage->SetScalarComponentFromDouble(i,dim[2]-k-1,j,0,value);
-                                       } else {
-                                               SETVALUE2_VTK_CREA(vIn,pNI,stNI,index)          
-//                                             newImage->SetScalarComponentFromDouble(i,j,k,0,value);
-                                       }// if Dir
-                                       index++;
-                               } // for i
-                       } // for j
-               } // for k
-               bbSetOutputOut(newImage);
-       } else {
-               bbSetOutputOut(NULL);
-       }// if In!=NULL
+                if (bbGetInputAxesDirectionCosines().size()==9)
+                {
+                    std::vector<double> v =bbGetInputAxesDirectionCosines();
+                     double axes[3][3] = { { v[0], v[1], v[2] }, { v[3], v[4], v[5] }, { v[6], v[7], v[8] } };
+                    reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+                }
+            } // dir -1
+            if (  bbGetInputDir()==0 )   // nothing
+            {
+                static double axes[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 0
+            if (  bbGetInputDir()==1 )
+            {
+                static double axes[3][3] = { { 0, 1, 0 }, { 0, 0, -1 }, { 1, 0, 0 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 1
+            if (  bbGetInputDir()==2 )
+            {
+                static double axes[3][3] = { { 1, 0, 0 }, { 0, 0, -1 }, { 0, 1, 0 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 2
+            if (  bbGetInputDir()==3 )
+            {
+                static double axes[3][3] = { { 0, 1, 0 }, { 1, 0, 0 }, { 0, 0, 1 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 3
+            if (  bbGetInputDir()==4 ) // RY90
+            {
+                static double axes[3][3] = { { 0, 0, 1 }, { 0, 1, 0 }, { -1, 0, 0 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 4
+            if (  bbGetInputDir()==5 ) // RY-90
+            {
+                static double axes[3][3] = { { 0, 0, -1 }, { 0, 1, 0 }, { 1, 0, 0 } };
+                reslice->SetResliceAxesDirectionCosines(axes[0], axes[1], axes[2]);
+            } // dir 5
+            //         reslice->SetOutputOrigin(0,0,0);
+            bbGetInputIn()->Modified();
+            reslice->SetInputData( bbGetInputIn() );
+            reslice->SetResliceAxesOrigin( 0,0,0 );
+            reslice->SetInterpolationModeToNearestNeighbor();
+            reslice->Modified();
+            reslice->Update();
+            mchange->SetInputData( reslice->GetOutput() );
+            mchange->SetOutputOrigin( 0,0,0 );
+            mchange->Update();
+            bbSetOutputOut( mchange->GetOutput() );
+        } else {
+            bbSetOutputOut( bbGetInputIn() );
+        }// if Dir -1..5
+    } else {
+        bbSetOutputOut(NULL);
+    }// if In!=NULL
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//===== 
+//=====
 void TurnImage::bbUserSetDefaultValues()
 {
-
-//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
-//    Here we initialize the input 'In' to 0
-   bbSetInputIn(NULL);
-   bbSetInputDir(0);
-  
+    //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+    //    Here we initialize the input 'In' to 0
+    bbSetInputIn(NULL);
+    bbSetInputDir(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 TurnImage::bbUserInitializeProcessing()
 {
-
-//  THE INITIALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+    //  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 TurnImage::bbUserFinalizeProcessing()
 {
-
-//  THE FINALIZATION METHOD BODY :
-//    Here does nothing 
-//    but this is where you should desallocate the internal/output pointers 
-//    if any
-  
+    //  THE FINALIZATION METHOD BODY :
+    //    Here does nothing
+    //    but this is where you should desallocate the internal/output pointers
+    //    if any
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 1f6d0f47bb5b2a8bca9ee493ebfe150f792fabf1..98eb49c8f97ec66a426e84b9c2265f329796c294 100644 (file)
@@ -24,10 +24,11 @@ class bbcreaVtk_EXPORT TurnImage
 //===== 
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Dir,int);
+  BBTK_DECLARE_INPUT(AxesDirectionCosines,std::vector<double>);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
-//===== 
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 };
@@ -39,7 +40,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(TurnImage,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("empty");
 
   BBTK_INPUT(TurnImage,In,"Input Image",vtkImageData*,"");
-  BBTK_INPUT(TurnImage,Dir,"(default 0) 0:XY(original)  1:YZ  2:XZ",int,"");
+  BBTK_INPUT(TurnImage,Dir,"(default 0) -1:Manual matrix  0:XY(original)  1:YZ  2:XZ 3:R180Z 4:RY90 5:RY-90",int,"");
+  BBTK_INPUT(TurnImage,AxesDirectionCosines,"AxesDirectionCosines  9 elements of a matrix3x3", std::vector<double> ,"");
 
   BBTK_OUTPUT(TurnImage,Out,"Output image",vtkImageData*,"");
 
index d15268bf4be6b4fc603660c1260c2b4d8a643f9a..d04e569e799345677af1c6069510132fdd8e9868 100644 (file)
@@ -3,17 +3,17 @@
 //===== 
 #include "bbcreaVtkVectorsVisu.h"
 #include "bbcreaVtkPackage.h"
+
 namespace bbcreaVtk
 {
-
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsVisu)
 BBTK_BLACK_BOX_IMPLEMENTATION(VectorsVisu,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 VectorsVisu::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -25,7 +25,6 @@ void VectorsVisu::Process()
 //      (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')
-
      vectorsvisu.SetActive( bbGetInputActive() );
      vectorsvisu.SetDataObject( bbGetInputIn() );
      vectorsvisu.SetScaleFactor( bbGetInputScaleFactor() );
@@ -35,9 +34,10 @@ void VectorsVisu::Process()
      vectorsvisu.SetOrientation( bbGetInputOrientation() );
      vectorsvisu.SetExternalLut( bbGetInputExternalLut() );
      vectorsvisu.Process();
-     bbSetOutputOut( vectorsvisu.GetProp3D() );  
+     bbSetOutputOut( vectorsvisu.GetProp3D() );
 }
-//===== 
+
+//=====
 // 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 VectorsVisu::bbUserSetDefaultValues()
@@ -45,7 +45,6 @@ void VectorsVisu::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
-
    bbSetInputActive(false);
    bbSetInputIn(NULL);
    bbSetInputRenderer(NULL);
@@ -55,32 +54,29 @@ void VectorsVisu::bbUserSetDefaultValues()
    bbSetInputOrientation(-1);  
    bbSetInputExternalLut(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 VectorsVisu::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    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 VectorsVisu::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
 }
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
 
 
index 93560c511892dba7b9196eab29e1db0bc56500ed..4e4647b2966c51c499d9d172d3ddcdb4506ea98f 100644 (file)
@@ -76,6 +76,9 @@ IF ( BUILD_${LIBRARY_NAME} )
   # e.g.
   # ../mySampleLib
    
+   
+/Users/davila/Borrame/borrame/nn/teemInstall/include   
+   
   )
 
   #----------------------------------------------------------------------------
diff --git a/lib/creaVtk/MeshFromPoints.cpp b/lib/creaVtk/MeshFromPoints.cpp
new file mode 100644 (file)
index 0000000..1eaf784
--- /dev/null
@@ -0,0 +1,456 @@
+#include "MeshFromPoints.h"
+
+#include "vtkTriangleStrip.h"
+#include "vtkTriangle.h"
+#include <vtkMath.h>
+
+MeshFromPoints::MeshFromPoints()
+{
+       SetDefaultValues();
+}
+
+//Set Inputs
+void  MeshFromPoints::SetInputLstX(std::vector<double> lst)            { LstX                  = lst;   }
+void  MeshFromPoints::SetInputLstY(std::vector<double> lst)            { LstY                  = lst;   }
+void  MeshFromPoints::SetInputLstZ(std::vector<double> lst)            { LstZ                  = lst;   }
+void  MeshFromPoints::SetInputLstIndexs(std::vector<int> lst)  { LstIndexs             = lst;   }
+void  MeshFromPoints::SetInputCloseSurface(bool value)                 { CloseSurface  = value; }
+//Get Inputs
+std::vector<double> MeshFromPoints::GetInputLstX()          { return LstX;          }
+std::vector<double> MeshFromPoints::GetInputLstY()          { return LstY;          }
+std::vector<double> MeshFromPoints::GetInputLstZ()          { return LstZ;          }
+std::vector<int>    MeshFromPoints::GetInputLstIndexs()     { return LstIndexs;     }
+bool                MeshFromPoints::GetInputCloseSurface()  { return CloseSurface;  }
+//Set Outputs
+void  MeshFromPoints::SetOutputOut(vtkPolyData* polydata)      { Out   = polydata; }
+//Get Outputs
+vtkPolyData* MeshFromPoints::GetOutputOut()    { return Out; }
+
+void MeshFromPoints::Process()
+{
+
+    std::vector<double> lstX           = GetInputLstX();
+    std::vector<double> lstY           = GetInputLstY();
+    std::vector<double> lstZ           = GetInputLstZ();
+    std::vector<int> lstIndexs         = GetInputLstIndexs();
+    double pointsCentroid[3];
+    if ( (lstIndexs.size()<1) || (lstX.size()==0) || (lstX.size()!=lstY.size()) || (lstY.size()!=lstZ.size()) )
+    {
+        printf("Warning! CreateMeshFromPoints::Process: List of points X Y Z  and LstIndexes is not correct\n");
+        SetOutputOut(NULL);
+    } else  {
+        int ii,sizeSegment1,sizeSegment2;
+        int endSegment;
+        //                     vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+        if (points!=NULL) points->Delete();
+        points = vtkPoints::New();
+        int i,sizeLstX         =       lstX.size();
+        for (i=0;i<sizeLstX;i++)
+        {
+            points->InsertNextPoint(lstX[i],lstY[i],lstZ[i]);
+            pointsCentroid[0] += lstX[i];
+            pointsCentroid[1] += lstY[i];
+            pointsCentroid[2] += lstZ[i];
+        } // for i
+        pointsCentroid[0] /= sizeLstX;
+        pointsCentroid[1] /= sizeLstX;
+        pointsCentroid[2] /= sizeLstX;
+        
+        if ((GetInputCloseSurface()==true)  && (lstIndexs.size()>=2) )
+        {
+            //check if initial and end points are the same in all splines (splines are in line shape and not U shape)
+            //to not apply changes because clean polydata will take care of it.
+            int count = 0;
+            bool differentPoints = false;
+            for(i=0; i < lstIndexs.size() && !differentPoints;i++){
+                bool sameStart = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
+                bool sameEnd = lstX[count] != lstX[count+lstIndexs[i]-1] && lstY[count] != lstY[count+lstIndexs[i]-1] && lstZ[count] != lstZ[count+lstIndexs[i]-1];
+                if(!(sameStart && sameEnd)) differentPoints = true;
+                count += lstIndexs[i];
+            }
+            //Correct surface normals if needed
+            if(differentPoints)
+            {
+                double pointSurf1[3], pointSurf2[3], pointSurf3[3];
+                double vect1[3], vect2[3];
+                double surfNormal[3], vectorCenter[3];
+                double dotNormalSurf = 0;
+                for(int pIndex = 0; pIndex < lstIndexs[0]-1; pIndex++)
+                {
+                    pointSurf1[0] = lstX[pIndex];
+                    pointSurf1[1] = lstY[pIndex];
+                    pointSurf1[2] = lstZ[pIndex];
+                    vtkMath::Subtract(pointsCentroid, pointSurf1, vectorCenter);
+                    pointSurf2[0] = lstX[pIndex+lstIndexs[1]];
+                    pointSurf2[1] = lstY[pIndex+lstIndexs[1]];
+                    pointSurf2[2] = lstZ[pIndex+lstIndexs[1]];
+                    pointSurf3[0] = lstX[pIndex+1];
+                    pointSurf3[1] = lstY[pIndex+1];
+                    pointSurf3[2] = lstZ[pIndex+1];
+                    vtkMath::Subtract(pointSurf2, pointSurf1, vect1);
+                    vtkMath::Subtract(pointSurf3, pointSurf1, vect2);
+                    vtkMath::Cross(vect1, vect2, surfNormal);
+                    dotNormalSurf += vtkMath::Dot(surfNormal, vectorCenter);
+                } // for pIndex
+                
+                if(dotNormalSurf > 0){
+                    points->Delete();
+                    points = vtkPoints::New();
+                    for(int splineI = 0; splineI < lstIndexs.size(); splineI++){
+                        for (i=lstIndexs[splineI]-1; i >= 0;i--)
+                        {
+                            points->InsertNextPoint(lstX[splineI*lstIndexs[0]+i],lstY[splineI*lstIndexs[0]+i],lstZ[splineI*lstIndexs[0]+i]);
+                        } // for i
+                    } // for splineI
+                } // if dotNormalSurf
+            }// if differentPoints
+        }
+        //
+        
+        //                     vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
+        if (cells!=NULL) cells->Delete();
+        cells = vtkCellArray::New();
+        int maxElements;
+        int maxSegment1,maxSegment2;
+        int iSeg1,iSeg2;
+        int iGeneral   =       0;
+        int    sizeLstIdexes=lstIndexs.size();
+        for (i=0; i<sizeLstIdexes-1; i++ )
+        {
+            sizeSegment1 = lstIndexs[i];
+            sizeSegment2 = lstIndexs[i+1];
+            vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
+            triangleStrip->GetPointIds()->SetNumberOfIds(sizeSegment1+sizeSegment2);
+            maxElements=sizeSegment1;
+            if (maxElements<sizeSegment2) maxElements=sizeSegment2;
+            maxSegment1        = iGeneral+sizeSegment1;
+            maxSegment2        = iGeneral+sizeSegment1+sizeSegment2;
+            iSeg1              = iGeneral;
+            iSeg2              = iGeneral+sizeSegment1;
+            for (ii=0; ii<maxElements; ii++)
+            {
+                triangleStrip->GetPointIds()->SetId(ii*2  ,iSeg1);
+                triangleStrip->GetPointIds()->SetId(ii*2+1,iSeg2);
+                iSeg1++;
+                iSeg2++;
+                if (iSeg1>=maxSegment1) { iSeg1=maxSegment1-1; }
+                if (iSeg2>=maxSegment2) { iSeg2=maxSegment2-1; }
+            } // for ii
+            iGeneral=iGeneral+sizeSegment1;
+            cells->InsertNextCell(triangleStrip);
+        } //for  LstIndexs
+        
+        
+        if(GetInputCloseSurface())
+        {
+            int lastId1 = lstIndexs[0]-1;
+            int lastId2 = sizeLstX - 1;
+            int firstId2 = sizeLstX - lstIndexs[sizeLstIdexes - 1];
+            bool face1open = std::fabs(lstX[0] - lstX[lastId1]) > 0.0001 || std::fabs(lstY[0] - lstY[lastId1]) > 0.0001 || std::fabs(lstZ[0] - lstZ[lastId1]) > 0.0001;
+            bool face2open = std::fabs(lstX[firstId2] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[firstId2] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[firstId2] - lstZ[lastId2]) > 0.0001;
+            
+            bool altFace1open = std::fabs(lstX[0] - lstX[firstId2]) > 0.0001 || std::fabs(lstY[0] - lstY[firstId2]) > 0.0001 || std::fabs(lstZ[0] - lstZ[firstId2]) > 0.0001;
+            bool altFace2open = std::fabs(lstX[lastId1] - lstX[lastId2]) > 0.0001 || std::fabs(lstY[lastId1] - lstY[lastId2]) > 0.0001 || std::fabs(lstZ[lastId1] - lstZ[lastId2]) > 0.0001;
+            
+            //false = Open Contour
+            //true = Closed Contour
+            if(!face1open && !face2open)
+            {
+                //                                     isClosedCont = true;
+                CloseContourSides(lstIndexs, true, true);
+            }
+            else if(!altFace1open && !altFace2open)
+            {
+                //                                     isClosedCont = true;
+                CloseContourSides(lstIndexs, false, true);
+            }
+            else{
+                CloseOpenContourSurface(lstIndexs);
+            }
+        }
+        
+        //                     vtkPolyData *polydata = vtkPolyData::New();
+        if (polydata!=NULL) polydata->Delete();
+        polydata = vtkPolyData::New();
+        polydata->SetPoints(points);
+        polydata->SetStrips(cells);
+        //                     vtkCleanPolyData *clean=vtkCleanPolyData::New();
+        if (clean!=NULL) clean->Delete();
+        clean = vtkCleanPolyData::New();
+        clean->SetInputData(polydata);
+        clean->Update();
+        //                     vtkTriangleFilter *triangle = vtkTriangleFilter::New();
+        if (triangle!=NULL) triangle->Delete();
+        triangle = vtkTriangleFilter::New();
+        triangle->SetInputData( clean->GetOutput() );
+        triangle->Update();
+        SetOutputOut( triangle->GetOutput() );
+        //            SetOutputOut( clean->GetOutput() );
+    }// if listXYZ size
+    //printf("PG CreateMeshFromPoints::Process: End\n");
+}
+
+/**
+ * Closes the sides of the contour
+ * iterates in one way or the other, depending on the order of the points and calculated vectors.
+ * uPointOrder: Points are order in a U shape
+ * lstIndexs: number of points on each spline
+ */
+void MeshFromPoints::CloseContourSides(std::vector<int> lstIndexs, bool uPointOrder, bool isClosedCont){
+    int        sizeLstIdexes  = lstIndexs.size();
+    int sizePoints     = GetInputLstX().size();
+    
+    int firstIndex, end, centroidId, numPointsFace, contraryId;
+    int increment = uPointOrder?1:sizeLstIdexes;
+    double centroid[3];
+    int numProcessFaces = sizeLstIdexes > 1?2:1;
+    for(int facesIdx = 0; facesIdx < numProcessFaces; facesIdx++){
+        std::fill(std::begin(centroid), std::end(centroid), 0);
+        if(facesIdx == 0)
+        {
+            firstIndex = 0;
+            numPointsFace = uPointOrder?lstIndexs[0]: sizeLstIdexes;
+            end = uPointOrder?firstIndex + numPointsFace:sizePoints - lstIndexs[sizeLstIdexes - 1] + 1;
+            contraryId = sizePoints-1;
+        }else{
+            firstIndex = uPointOrder?sizePoints - lstIndexs[sizeLstIdexes-1]:lstIndexs[0]-1;
+            numPointsFace = uPointOrder?lstIndexs[sizeLstIdexes-1]:sizeLstIdexes;
+            end = uPointOrder?firstIndex + numPointsFace:sizePoints;
+            contraryId = 0;
+        }
+        if(numPointsFace > 1)
+        {
+            bool validCentroid = CalcValidCentroid(centroid, firstIndex, end, increment, numPointsFace);
+            if(validCentroid)
+            {
+                bool normalOrder    = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
+                centroidId          = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
+                //vtkSmartPointer<vtkTriangleStrip> triangleStrip = vtkSmartPointer<vtkTriangleStrip>::New();
+                //triangleStrip->GetPointIds()->SetNumberOfIds(numPointsFace*2 + (!isClosedCont?2:0));
+                //int triangleIndex = 0;
+                if( normalOrder )
+                {
+                    int initial = firstIndex;
+                    for(int index = initial; index < end; index+=increment){
+                        if(index+increment >= end && !isClosedCont){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, initial);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }else if(index+increment < end){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, index+increment);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }
+                        /*
+                         triangleStrip->GetPointIds()->SetId(triangleIndex,index);
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+1,centroidId);//1
+                         if(index+increment >= end && !isClosedCont){
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+2,initial);//2
+                         triangleStrip->GetPointIds()->SetId(triangleIndex+3,centroidId);//3
+                         }
+                         triangleIndex+=2;
+                         */
+                    }
+                    //cells->InsertNextCell(triangleStrip);
+                } else {
+                    int initial = firstIndex-1;
+                    int triangleStripStart = end-1;
+                    for(int index = triangleStripStart; index > initial; index-=increment){
+                        if(index-increment <= initial && !isClosedCont){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, triangleStripStart);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }else if(index-increment > initial){
+                            vtkNew<vtkTriangle> triangle;
+                            triangle->GetPointIds()->SetId(0, index);
+                            triangle->GetPointIds()->SetId(1, index-increment);
+                            triangle->GetPointIds()->SetId(2, centroidId);
+                            cells->InsertNextCell(triangle);
+                        }
+                    }
+                }//if normalOrder
+            }//if validCentroid
+        }//if numPointsFace
+    }//for facesIdx
+    
+}
+
+/**
+ * Checks if the normal from firstPointId, secPointId and centroid points away
+ * from the vector centroid to contrPointId.
+ * Used to check that the order used to create the new polygons is correct.
+ */
+bool MeshFromPoints::isPointingCorrectly( int firstPointId, int secPointId, double(&centroid)[3], int contrPointId) {
+    
+    double firstPoint[3], secPoint[3], contrPoint[3];
+    points->GetPoint(firstPointId, firstPoint);
+    points->GetPoint(secPointId, secPoint);
+    
+    double firstVect[3], secVect[3], normal[3], contrVect[3];
+    
+    vtkMath::Subtract(firstPoint, centroid, firstVect);
+    vtkMath::Subtract(secPoint, centroid, secVect);
+    
+    points->GetPoint(contrPointId, contrPoint);
+    vtkMath::Subtract(contrPoint, centroid, contrVect);
+    
+    vtkMath::Cross(firstVect, secVect, normal);
+    double dotCalc;
+    dotCalc = vtkMath::Dot(normal, contrVect);
+    
+    return dotCalc<0;
+}
+
+/**
+ * Checks if the order of the points represent a curved spline (U shape) or the points resemble a straight spline.
+ * Now it checks the angle between each point and the vector that goes from the last point to the first.
+ *
+ * Previous version checked the curvature between 3 points in the spline, but this created problems when the straight lines
+ * had curves in the middle, increasing the curvature although they are not in the U shape.
+ */
+bool MeshFromPoints::CheckLinePointOrder(){
+    int sizePoints = GetInputLstX().size();
+    std::vector<int> lstIndexs = GetInputLstIndexs();
+    double point1[3], point2[3], point3[3];
+    double center[3];
+    double firstAngleSum = 0;
+    double secondAngleSum = 0;
+    
+    points->GetPoint(0, point1);
+    points->GetPoint((lstIndexs[0]-1), point3);
+    double firstVect[3];
+    double secVect[3];
+    vtkMath::Subtract(point3, point1, firstVect);
+    for(int i = 0; i < lstIndexs[0]; i++){
+        points->GetPoint(i, point2);
+        vtkMath::Subtract(point2, point1, secVect);
+        firstAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
+    }
+    points->GetPoint((sizePoints-lstIndexs[0]), point3);
+    vtkMath::Subtract(point3, point1, firstVect);
+    for(int i = 0; i < sizePoints; i+=lstIndexs.size()){
+        points->GetPoint(i, point2);
+        vtkMath::Subtract(point2, point1, secVect);
+        secondAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);
+    }
+    
+    return firstAngleSum < secondAngleSum;
+}
+
+/**
+ * Closes an open contour
+ * lstIndexs: number of points on each spline
+ */
+void MeshFromPoints::CloseOpenContourSurface(std::vector<int> lstIndexs){
+    bool linePointOrder = CheckLinePointOrder();
+    CloseContourSides(lstIndexs, !linePointOrder, false);
+    CloseContourBottom(!linePointOrder);
+}
+
+/**
+ * Calculates centroid and checks if points are collinear.
+ * centroid: array to store calculation
+ * start: start index of points to use
+ * end: end index of points to use
+ * increment: increment to be used in point iteration
+ * numPoints: number of points used to calculate the centroid.
+ * Returns a bool indicating the validity of the centroid calculated.
+ * False = invalid centroid = all points are the same.
+ */
+bool MeshFromPoints::CalcValidCentroid(double(&centroid)[3], int start, int end, int increment, int numPoints){
+    double currPoint[3] = {}, prevPoint[3] = {}, middlePoint[3] = {}, firstPoint[3] = {};
+    double vector1[3], vector2[3];
+    bool samePoint = true;
+    int splineMidPoint = numPoints/2;
+    bool collinear = true;
+    
+    points->GetPoint(start, firstPoint);
+    points->GetPoint(splineMidPoint, middlePoint);
+    vtkMath::Subtract(middlePoint, firstPoint, vector1);
+    
+    for(int i = start; i < end; i+=increment){
+        points->GetPoint(i, currPoint);
+        if(samePoint && i > start && (currPoint[0] != prevPoint[0] || currPoint[1] != prevPoint[1] || currPoint[2] != prevPoint[2])){
+            samePoint = false;
+        }
+        
+        vtkMath::Subtract(currPoint, firstPoint, vector2);
+        double angle = vtkMath::AngleBetweenVectors(vector1, vector2);
+        if(angle > 0.0001 && collinear){
+            collinear = false;
+        }
+        
+        centroid[0] += currPoint[0];
+        centroid[1] += currPoint[1];
+        centroid[2] += currPoint[2];
+        std::copy(std::begin(currPoint), std::end(currPoint), prevPoint);
+    }
+    
+    centroid[0] /= numPoints;
+    centroid[1] /= numPoints;
+    centroid[2] /= numPoints;
+    
+    return !samePoint && !collinear;
+}
+
+/**
+ * Closes the bottom of the given countour.
+ * Should only be used when its an open contour.
+ * uPointOrder: points are ordered in U shape
+ */
+void MeshFromPoints::CloseContourBottom(bool uPointOrder){
+    std::vector<int> lstIndexs = GetInputLstIndexs();
+    int sizeLstIdexes = lstIndexs.size();
+    int sizeLstX = GetInputLstX().size();
+    
+    vtkSmartPointer<vtkTriangleStrip> triangleStripBottom = vtkSmartPointer<vtkTriangleStrip>::New();
+    triangleStripBottom->GetPointIds()->SetNumberOfIds(sizeLstIdexes*2);
+    
+    double originPoint[3];
+    points->GetPoint(0, originPoint);
+    int middleMeshPoint = uPointOrder?lstIndexs[0]/2:lstIndexs[0]*sizeLstIdexes/2;
+    
+    bool normalOrder = isPointingCorrectly(uPointOrder?lstIndexs[0]-1:sizeLstX-lstIndexs[0], uPointOrder?lstIndexs[0]:1, originPoint, middleMeshPoint);
+    
+    int triangleIndex = 0, currentId = 0, nextId = 0;
+    for(int splineIndex = 0; splineIndex < sizeLstIdexes;splineIndex++){
+        nextId = uPointOrder?currentId + lstIndexs[splineIndex] - 1:sizeLstX - sizeLstIdexes + splineIndex;
+        if(normalOrder)
+        {
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex, currentId);
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, nextId);
+        }
+        else{
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex, nextId);
+            triangleStripBottom->GetPointIds()->SetId(triangleIndex+1, currentId);
+        }
+        currentId = uPointOrder?nextId + 1: splineIndex+1;
+        triangleIndex+=2;
+    }
+    cells->InsertNextCell(triangleStripBottom);
+}
+
+//=====
+// 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 MeshFromPoints::SetDefaultValues()
+{
+    
+    //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+    //    Here we initialize the input 'In' to 0
+    //   SetInputIn(0);
+    SetInputCloseSurface(false);
+    points             = NULL;
+    cells              = NULL;
+    polydata   = NULL;
+    clean              = NULL;
+    triangle   = NULL;
+}
+
+
diff --git a/lib/creaVtk/MeshFromPoints.h b/lib/creaVtk/MeshFromPoints.h
new file mode 100644 (file)
index 0000000..0377195
--- /dev/null
@@ -0,0 +1,67 @@
+
+#ifndef MeshFromPoints_h
+#define MeshFromPoints_h
+
+//#include "creaVTK_EXPORT.h"
+#include <vector>
+#include <vtkPolyData.h>
+#include "vtkPoints.h"
+#include "vtkCellArray.h"
+#include "vtkCleanPolyData.h"
+#include "vtkTriangleFilter.h"
+
+
+class /*creaVTK_EXPORT*/ MeshFromPoints
+{
+public:
+    MeshFromPoints();
+
+       //Inputs
+       std::vector<double> LstX;
+       std::vector<double> LstY;
+       std::vector<double> LstZ;
+       std::vector<int>        LstIndexs;
+       bool                            CloseSurface;
+       //Outputs
+       vtkPolyData*            Out;
+
+       // Get Inputs
+    std::vector<double> GetInputLstX();
+    std::vector<double> GetInputLstY();
+    std::vector<double> GetInputLstZ();
+    std::vector<int>   GetInputLstIndexs();
+    bool                               GetInputCloseSurface();
+       // Set Inputs
+    void SetInputLstX( std::vector<double> lst);
+    void SetInputLstY( std::vector<double> lst);
+    void SetInputLstZ( std::vector<double> lst);
+    void SetInputLstIndexs( std::vector<int> lst);
+    void SetInputCloseSurface( bool value);
+    // Set Outputs
+       void SetOutputOut(vtkPolyData* polydata);
+    // Get Outputs
+       vtkPolyData* GetOutputOut();
+
+       // Atributes
+       vtkPoints                       *points;
+       vtkCellArray            *cells;
+       vtkPolyData             *polydata;
+       vtkCleanPolyData        *clean;
+       vtkTriangleFilter       *triangle;
+
+    void                Process();
+    void                SetDefaultValues();
+
+       // Methods
+       bool CalcValidCentroid(double(&centroid)[3], int start, int end, int increment, int numPoints);
+       bool CheckLinePointOrder();
+       bool isPointingCorrectly( int firstPointId, int secPointId, double(&centroid)[3], int contrPointId);
+       void CloseContourBottom(bool uPointOrder);
+       void CloseContourSides(std::vector<int> lstIndexs, bool uPointOrder, bool isClosedCont);
+       void CloseOpenContourSurface(std::vector<int> lstIndexs);
+    
+};
+
+
+#endif // _h_INCLUDED__
+
diff --git a/lib/creaVtk/MeshToImageData.cpp b/lib/creaVtk/MeshToImageData.cpp
new file mode 100644 (file)
index 0000000..f144a98
--- /dev/null
@@ -0,0 +1,85 @@
+#include "MeshToImageData.h"
+#include <vtkTriangleFilter.h>
+
+
+MeshToImageData::MeshToImageData()
+{
+       SetInputInPolyData(NULL);
+       SetInputInImage(NULL);
+       SetInputBackgroundValue(255);
+       
+       clean1                  = NULL;
+       dataToStencil   = NULL;
+       extract                 = NULL;
+       stencil                 = NULL;
+
+}
+
+//Set Inputs
+void  MeshToImageData::SetInputInImage(vtkImageData *image)                { InImage               = image;        }
+void  MeshToImageData::SetInputBackgroundValue(double value)       { BackgroundValue       = value;        }
+void  MeshToImageData::SetInputInPolyData(vtkPolyData *polydata)       { InPolyData                    = polydata;     }
+//Get Inputs
+vtkImageData *MeshToImageData::GetInputInImage()                    { return InImage;                       }
+double MeshToImageData::GetInputBackgroundValue()                   { return BackgroundValue;               }
+vtkPolyData *MeshToImageData::GetInputInPolyData()                  { return InPolyData;                    }
+
+//Set Outputs
+void  MeshToImageData::SetOutputOut(vtkImageData* image)               { Out   = image;                        }
+//Get Outputs
+vtkImageData* MeshToImageData::GetOutputOut()                      { return Out;                           }
+
+void MeshToImageData::Process()
+{
+       if ((GetInputInPolyData()!=NULL) && (GetInputInImage()!=NULL) )
+       {
+printf("EED Warnning!! MeshToImageData::Process    Clean this code .................\n ");
+               int ext[6];
+        double spc[3];
+        double org[3];
+               GetInputInImage()->GetExtent( ext );
+        GetInputInImage()->GetSpacing( spc );
+        GetInputInImage()->GetOrigin( org );
+
+//             vtkCleanPolyData *clean1 = vtkCleanPolyData::New();             
+               if (clean1!=NULL) clean1->Delete();
+               clean1 = vtkCleanPolyData::New();
+               clean1->SetInputData( GetInputInPolyData() );
+               clean1->Update();
+               vtkTriangleFilter *triangle1 = vtkTriangleFilter::New();
+               triangle1->SetInputData( clean1->GetOutput() );
+               triangle1->Update();
+//             vtkPolyDataToImageStencil *dataToStencil = vtkPolyDataToImageStencil::New();
+               if (dataToStencil!=NULL) dataToStencil->Delete();
+               dataToStencil = vtkPolyDataToImageStencil::New();
+               dataToStencil->SetInputData( triangle1->GetOutput() );
+        dataToStencil->SetOutputOrigin( org );
+        dataToStencil->SetOutputSpacing( spc );
+               dataToStencil->SetOutputWholeExtent( ext );
+               dataToStencil->Update();
+//             vtkExtractVOI *extract = vtkExtractVOI::New();
+               if (extract!=NULL) extract->Delete();
+               extract = vtkExtractVOI::New();
+               extract->SetVOI( ext );
+               extract->SetSampleRate(1, 1, 1);
+               extract->SetInputData( GetInputInImage() );
+               extract->ReleaseDataFlagOff();
+               extract->Update();      
+//             vtkImageStencil *stencil = vtkImageStencil::New();
+               if (stencil!=NULL) stencil->Delete();
+               stencil = vtkImageStencil::New();
+               stencil->SetInputData( extract->GetOutput() );
+               stencil->Update();
+               stencil->SetStencilData(  dataToStencil->GetOutput() );
+               stencil->ReverseStencilOn();
+               stencil->SetBackgroundValue( GetInputBackgroundValue() );
+               stencil->Update();
+               SetOutputOut( stencil->GetOutput() );
+       } else {
+               printf("EED Warnning!  PolyDataToImageData::Process  > Missing Image or PolyData inputs\n");
+               SetOutputOut( NULL);
+       }// if In NULL
+
+}
+
+
diff --git a/lib/creaVtk/MeshToImageData.h b/lib/creaVtk/MeshToImageData.h
new file mode 100644 (file)
index 0000000..b8336af
--- /dev/null
@@ -0,0 +1,52 @@
+
+#ifndef MeshToImageData_h
+#define MeshToImageData_h
+
+//#include "creaVTK_EXPORT.h"
+
+#include <vtkPolyData.h>
+#include <vtkImageData.h>
+#include <vtkCleanPolyData.h>
+#include <vtkPolyDataToImageStencil.h>
+#include <vtkExtractVOI.h>
+#include <vtkImageStencil.h>
+
+class /*creaVTK_EXPORT*/ MeshToImageData
+{
+public:
+    MeshToImageData();
+       //Inputs
+       vtkImageData    *InImage;
+       double                  BackgroundValue;
+       vtkPolyData             *InPolyData;
+       //Outputs
+       vtkImageData*   Out;
+
+       // Get Inputs
+    vtkImageData *GetInputInImage();
+    double GetInputBackgroundValue();
+    vtkPolyData *GetInputInPolyData();
+
+       // Set Inputs
+    void SetInputInImage( vtkImageData *image);
+    void SetInputBackgroundValue( double value );
+    void SetInputInPolyData( vtkPolyData *polydata);
+    
+    // Set Outputs
+       void SetOutputOut(vtkImageData *image);
+    // Get Outputs
+       vtkImageData* GetOutputOut();
+
+       // Atributes
+       vtkCleanPolyData                        *clean1;
+       vtkPolyDataToImageStencil       *dataToStencil;
+       vtkExtractVOI                           *extract;
+       vtkImageStencil                         *stencil;
+
+    void                Process();
+    
+};
+
+
+#endif // _h_INCLUDED__
+
index 51392f7300698a6dac591902cc216c62060a409c..543ab17f63240cc52dfc14dca7cd9973c67497f4 100644 (file)
@@ -115,10 +115,8 @@ void vtkVectorsVisu::Process()
                } // _orientation                       
        } // _vtkglyph NULL
 
-
      if(_active==true)
      {
-
                if (GetDataObject()!=NULL) 
                {
        #if VTK_MAJOR_VERSION <= 5
@@ -143,7 +141,6 @@ void vtkVectorsVisu::Process()
                                }
                     _vtkglyph->SetScaleModeToScaleByVector();
 
-
                        if (_externalLut==NULL)
                        {
                        _vtkglyph->SetColorModeToColorByVector();   
@@ -261,7 +258,7 @@ void vtkVectorsVisu::Process()
                    _actor->SetMapper( _pdm );
                    _actor->GetProperty()->SetOpacity( GetOpacity() );
                } else {
-                       printf("EED Warnning! vtkVectorsVisu::Process   GetDataObject()  is EMPTY\n");
+                       printf("EED Warnning! vtkVectorsVisu::Process   GetDataObject()  is EMPTY \n" );
                }// if GetDataObject()!=NULL
 
        _pdm->ScalarVisibilityOn();