]> Creatis software - creaVtk.git/commitdiff
#2453 creaVtk Feature New Normal - Stream Lines segmentation by Scalars
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Mon, 15 Sep 2014 08:39:33 +0000 (10:39 +0200)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Mon, 15 Sep 2014 08:39:33 +0000 (10:39 +0200)
bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbg [new file with mode: 0644]
bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbs [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineColorInfo.h
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineNumeration.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineNumeration.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineSegmentationByScalar.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineSegmentationByScalar.h [new file with mode: 0644]
lib/creaVtk/creaVtkStreamLineScalarSeg.cpp [new file with mode: 0644]
lib/creaVtk/creaVtkStreamLineScalarSeg.h [new file with mode: 0644]
lib/creaVtk/vtkStreamLineCreateColorInfo.cpp

diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbg
new file mode 100644 (file)
index 0000000..6c43b6a
--- /dev/null
@@ -0,0 +1,245 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:21
+BOX
+vtk:PolyDataReader:Box01
+ISEXEC:FALSE
+-88.546051:6.171672:-900.000000
+-42.971051:-3.828328:-900.000000
+PORT
+In:"/home/davila/Borrame/FIB/example01/V1_IM_fibers.vtk"
+FIN_BOX
+BOX
+creaMaracasVisu:ViewerNV:Box02
+ISEXEC:FALSE
+17.274671:53.788961:-900.000000
+77.914671:43.788961:-900.000000
+FIN_BOX
+BOX
+vtk:LoadHola:Box03
+ISEXEC:FALSE
+-92.289200:111.539584:-900.000000
+-46.714200:101.539584:-900.000000
+FIN_BOX
+BOX
+wx:LayoutTab:Box08
+ISEXEC:FALSE
+137.278039:-199.459007:-900.000000
+194.838039:-209.459007:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box09
+ISEXEC:TRUE
+100.030854:-227.815281:-900.000000
+145.605854:-237.815281:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+wx:FileSelector:Box14
+ISEXEC:FALSE
+-8.045537:111.400732:-900.000000
+37.529463:101.400732:-900.000000
+FIN_BOX
+BOX
+creaImageIO:ImagesChooserDialogBox:Box15
+ISEXEC:FALSE
+44.418152:133.616105:-900.000000
+115.593152:123.616105:-900.000000
+FIN_BOX
+BOX
+vtk:UnMosaic:Box16
+ISEXEC:FALSE
+59.016557:113.304403:-900.000000
+104.591557:103.304403:-900.000000
+PORT
+NbImagesInMosaic:"10"
+PORT
+NbImagesPerRow:"4"
+FIN_BOX
+BOX
+creaMaracasVisu:ImageChangeInformation:Box17
+ISEXEC:FALSE
+73.555765:95.217887:-900.000000
+144.730765:85.217887:-900.000000
+PORT
+NewSpacing:"2.65626 2.65625 6.25"
+FIN_BOX
+BOX
+toolsbbtk:SaveMHD-Button:Box18
+ISEXEC:FALSE
+203.504265:-47.784362:-900.000000
+249.079265:-57.784362:-900.000000
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box20
+ISEXEC:FALSE
+30.936680:79.756254:-900.000000
+102.111680:69.756254:-900.000000
+FIN_BOX
+BOX
+vtk:MetaImageReader:Box21
+ISEXEC:FALSE
+-7.094553:96.485348:-900.000000
+38.480447:86.485348:-900.000000
+PORT
+In:"/home/davila/Borrame/FIB/example01/V1_IM_b_0_dir_1.mhd"
+FIN_BOX
+BOX
+creaVtk:StreamLine_Visu_Widget:Box26
+ISEXEC:FALSE
+22.700614:-93.328771:-900.000000
+93.875614:-103.328771:-900.000000
+PORT
+Title:"Segmented Stream Line"
+FIN_BOX
+BOX
+creaVtk:StreamLine_Visu_Widget:Box27
+ISEXEC:FALSE
+-108.718370:-94.326200:-900.000000
+-37.543370:-104.326200:-900.000000
+PORT
+Title:"Complete Stream Line"
+FIN_BOX
+BOX
+wx:LayoutLine:Box29
+ISEXEC:FALSE
+-9.970267:-146.347569:-900.000000
+47.589733:-156.347569:-900.000000
+PORT
+Orientation:"V"
+FIN_BOX
+BOX
+creaVtk:StreamLineColorInfo:Box32
+ISEXEC:FALSE
+-99.959608:-16.963324:-900.000000
+-28.784608:-26.963324:-900.000000
+FIN_BOX
+BOX
+creaVtk:StreamLineNumeration:Box33
+ISEXEC:FALSE
+-19.206371:-40.822235:-900.000000
+51.968629:-50.822235:-900.000000
+FIN_BOX
+BOX
+creaVtk:StreamLineSegmentationByScalar:Box34
+ISEXEC:FALSE
+-25.171099:-59.634068:-900.000000
+46.003901:-69.634068:-900.000000
+PORT
+ScalarArrayName:"creaNumeration"
+FIN_BOX
+BOX
+wx:LayoutLine:Box35
+ISEXEC:FALSE
+-51.324136:-180.763924:-900.000000
+6.235864:-190.763924:-900.000000
+FIN_BOX
+BOX
+creaMaracasVisu:SliderMinMax:Box37
+ISEXEC:FALSE
+-8.653391:-11.457421:-900.000000
+45.826609:-21.457421:-900.000000
+PORT
+InMax:"1000"
+PORT
+InMin:"0"
+PORT
+ShowActual:"false"
+PORT
+WinTitle:"Threshold"
+FIN_BOX
+BOX
+vtk:UpdateRender:Box38
+ISEXEC:FALSE
+-58.618472:-74.417405:-900.000000
+-13.043472:-84.417405:-900.000000
+PORT
+Active:"true"
+FIN_BOX
+CONNECTIONS:25
+CONNECTION
+Box02:Widget:Box09:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box16:In
+NumberOfControlPoints:0
+CONNECTION
+Box16:Out:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box18:In
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box08:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box27:renderer
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box26:renderer
+NumberOfControlPoints:0
+CONNECTION
+Box08:Widget:Box09:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box32:In
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box27:polydata
+NumberOfControlPoints:0
+CONNECTION
+Box29:Widget:Box08:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box33:StreamLinesIn
+NumberOfControlPoints:0
+CONNECTION
+Box33:StreamLinesOut:Box34:StreamLinesIn
+NumberOfControlPoints:0
+CONNECTION
+Box37:OutEnd:Box34:ThresholdUpper
+NumberOfControlPoints:0
+CONNECTION
+Box37:OutStart:Box34:ThresholdLower
+NumberOfControlPoints:0
+CONNECTION
+Box37:Widget:Box29:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box37:BoxChange:Box34:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box27:Widget:Box29:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box26:Widget:Box29:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box34:StreamLinesOut:Box26:polydata
+NumberOfControlPoints:0
+CONNECTION
+Box33:NameOfScalarArray:Box34:ScalarArrayName
+NumberOfControlPoints:0
+CONNECTION
+Box37:BoxChange:Box38:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box02:Renderer1:Box38:Renderer
+NumberOfControlPoints:0
+APP_END
diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbs
new file mode 100644 (file)
index 0000000..5f52976
--- /dev/null
@@ -0,0 +1,134 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleStreamLineScalarSegmentation.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include vtk
+include creaMaracasVisu
+include wx
+include creaImageIO
+include toolsbbtk
+include creaVtk
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new PolyDataReader Box01
+  set Box01.In "/home/davila/Borrame/FIB/example01/V1_IM_fibers.vtk"
+
+new ViewerNV Box02
+
+new LoadHola Box03
+
+new LayoutTab Box08
+
+new LayoutSplit Box09
+  set Box09.Orientation "H"
+
+new FileSelector Box14
+
+new ImagesChooserDialogBox Box15
+
+new UnMosaic Box16
+  set Box16.NbImagesInMosaic "10"
+  set Box16.NbImagesPerRow "4"
+
+new ImageChangeInformation Box17
+  set Box17.NewSpacing "2.65626 2.65625 6.25"
+
+new SaveMHD-Button Box18
+
+new vtkImageDataPointerRelay Box20
+
+new MetaImageReader Box21
+  set Box21.In "/home/davila/Borrame/FIB/example01/V1_IM_b_0_dir_1.mhd"
+
+new StreamLine_Visu_Widget Box26
+  set Box26.Title "Segmented Stream Line"
+
+new StreamLine_Visu_Widget Box27
+  set Box27.Title "Complete Stream Line"
+
+new LayoutLine Box29
+  set Box29.Orientation "V"
+
+new StreamLineColorInfo Box32
+
+new StreamLineNumeration Box33
+
+new StreamLineSegmentationByScalar Box34
+  set Box34.ScalarArrayName "creaNumeration"
+
+new LayoutLine Box35
+
+new SliderMinMax Box37
+  set Box37.InMax "1000"
+  set Box37.InMin "0"
+  set Box37.ShowActual "false"
+  set Box37.WinTitle "Threshold"
+
+new UpdateRender Box38
+  set Box38.Active "true"
+
+
+connect Box02.Widget Box09.Widget2
+
+connect Box15.Out Box16.In
+
+connect Box16.Out Box17.In
+
+connect Box20.Out Box02.In
+
+connect Box20.Out Box18.In
+
+connect Box21.Out Box20.In
+
+connect Box18.Widget Box08.Widget2
+
+connect Box02.Renderer1 Box27.renderer
+
+connect Box02.Renderer1 Box26.renderer
+
+connect Box08.Widget Box09.Widget1
+
+connect Box01.Out Box32.In
+
+connect Box32.Out Box27.polydata
+
+connect Box29.Widget Box08.Widget1
+
+connect Box32.Out Box33.StreamLinesIn
+
+connect Box33.StreamLinesOut Box34.StreamLinesIn
+
+connect Box37.OutEnd Box34.ThresholdUpper
+
+connect Box37.OutStart Box34.ThresholdLower
+
+connect Box37.Widget Box29.Widget3
+
+connect Box37.BoxChange Box34.BoxExecute
+
+connect Box27.Widget Box29.Widget1
+
+connect Box26.Widget Box29.Widget2
+
+connect Box34.StreamLinesOut Box26.polydata
+
+connect Box33.NameOfScalarArray Box34.ScalarArrayName
+
+connect Box37.BoxChange Box38.BoxExecute
+
+connect Box02.Renderer1 Box38.Renderer
+
+
+
+# Complex input ports
+message    
+exec Box09
index 1a8992682caaf431d2b11a3849cd2de75b896330..ccfaf849e410b476c0fefc4c92caf8a0718aa031 100644 (file)
@@ -33,13 +33,12 @@ void StreamLineColorInfo::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-
        vtkStreamLineCreateColorInfo colorinfo;
        colorinfo.SetStreamLinesIn( bbGetInputIn() );
        colorinfo.Process();
        bbSetOutputOut( colorinfo.GetStreamLinesOut() );
-
 }
+
 //===== 
 // 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)
 //===== 
@@ -51,6 +50,7 @@ void StreamLineColorInfo::bbUserSetDefaultValues()
    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)
 //===== 
@@ -60,22 +60,20 @@ void StreamLineColorInfo::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 StreamLineColorInfo::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
-//    if any
-  
+//    if any 
 }
+
 }
 // EO namespace bbcreaVtk
 
index 287c5f7bf0c5da159289a230b88957cb809b01a7..350d58fdaae246ea97d73b5ef438495f1a997a9a 100644 (file)
@@ -32,10 +32,10 @@ class bbcreaVtk_EXPORT StreamLineColorInfo
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(StreamLineColorInfo,bbtk::AtomicBlackBox);
        BBTK_NAME("StreamLineColorInfo");
        BBTK_AUTHOR("Info-Dev");
-       BBTK_DESCRIPTION("No Description.");
-       BBTK_CATEGORY("empty");
+       BBTK_DESCRIPTION("Add new arrays to the PolyData");
+       BBTK_CATEGORY("Filter_vtkPolyData");
        BBTK_INPUT(StreamLineColorInfo,In,"Stream Line vtkPolydata",vtkPolyData*,"");
-       BBTK_OUTPUT(StreamLineColorInfo,Out,"Stream Line vtkPolydata",vtkPolyData*,"");
+       BBTK_OUTPUT(StreamLineColorInfo,Out,"Stream Line vtkPolydata with new arrays: creaMask,creaMagnitud,creaVelocity,creaColorDirection",vtkPolyData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(StreamLineColorInfo);
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineNumeration.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineNumeration.cxx
new file mode 100644 (file)
index 0000000..f15352e
--- /dev/null
@@ -0,0 +1,113 @@
+//===== 
+// 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 "bbcreaVtkStreamLineNumeration.h"
+#include "bbcreaVtkPackage.h"
+
+#include <vtkCellArray.h>
+#include <vtkPointData.h>
+#include <vtkDoubleArray.h>
+#include <vtkPolyData.h>
+#include "vtkIdList.h"
+
+
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StreamLineNumeration)
+BBTK_BLACK_BOX_IMPLEMENTATION(StreamLineNumeration,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 StreamLineNumeration::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::string namascalararray="creaNumeration";
+
+       if (bbGetInputStreamLinesIn()!=NULL)
+       {
+               vtkIdList *_vtkidlist = vtkIdList::New();
+               vtkCellArray    *vtkcellarray           = bbGetInputStreamLinesIn()->GetLines();
+               long int                nLinesCell                      = vtkcellarray->GetNumberOfCells(); 
+               long int                ii,iLine;
+               long int                numberofids;
+
+
+               vtkDoubleArray  *numeration                     = vtkDoubleArray::New();
+               numeration->SetName( namascalararray.c_str() );                 
+               numeration->SetNumberOfComponents(1); 
+               numeration->SetNumberOfTuples(nLinesCell);
+
+               // FOR EACH LINE
+               ii=0;
+               for ( iLine=0 ; iLine<nLinesCell ; iLine++ )
+               {
+                       vtkcellarray->GetCell(ii, _vtkidlist );
+                       numberofids = _vtkidlist->GetNumberOfIds();
+                       numeration->SetTuple1(iLine, numberofids);
+                       ii=ii+numberofids+1;
+               } // for iLine
+
+               bbGetInputStreamLinesIn()->GetPointData()->AddArray( numeration );
+       } // if bbGetInputStreamLinesIn()
+
+       bbSetOutputStreamLinesOut( bbGetInputStreamLinesIn() );
+       bbSetOutputNameOfScalarArray( namascalararray );
+  
+}
+//===== 
+// 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 StreamLineNumeration::bbUserSetDefaultValues()
+{
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+       bbSetInputStreamLinesIn( 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 StreamLineNumeration::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 StreamLineNumeration::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/bbcreaVtkStreamLineNumeration.h b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineNumeration.h
new file mode 100644 (file)
index 0000000..959f6dc
--- /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 __bbcreaVtkStreamLineNumeration_h_INCLUDED__
+#define __bbcreaVtkStreamLineNumeration_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkPolyData.h"
+#include <string>
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT StreamLineNumeration
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(StreamLineNumeration,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(StreamLinesIn,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(StreamLinesOut,vtkPolyData*);
+  BBTK_DECLARE_OUTPUT(NameOfScalarArray,std::string);
+  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(StreamLineNumeration,bbtk::AtomicBlackBox);
+       BBTK_NAME("StreamLineNumeration");
+       BBTK_AUTHOR("Info-Dev");
+       BBTK_DESCRIPTION("Create Array Scalar 'creaNumeriration'");
+       BBTK_CATEGORY("Filter_vtkPolyData");
+       BBTK_INPUT(StreamLineNumeration,StreamLinesIn,"vtkPolyData",vtkPolyData*,"");
+       BBTK_OUTPUT(StreamLineNumeration,StreamLinesOut,"vtkPolyData with new Scalar Array 'creaBNumeration'",vtkPolyData*,"");
+       BBTK_OUTPUT(StreamLineNumeration,NameOfScalarArray,"Name of the new Scalar Array in the vtkPolyData",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(StreamLineNumeration);
+//===== 
+// 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 // __bbcreaVtkStreamLineNumeration_h_INCLUDED__
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineSegmentationByScalar.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineSegmentationByScalar.cxx
new file mode 100644 (file)
index 0000000..e6a31f9
--- /dev/null
@@ -0,0 +1,83 @@
+//===== 
+// 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 "bbcreaVtkStreamLineSegmentationByScalar.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StreamLineSegmentationByScalar)
+BBTK_BLACK_BOX_IMPLEMENTATION(StreamLineSegmentationByScalar,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 StreamLineSegmentationByScalar::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;
+
+          streamlinescalarssegmentation.SetScalarStreamLinesIn( bbGetInputStreamLinesIn() );
+          streamlinescalarssegmentation.SetScalarArrayName( bbGetInputScalarArrayName() );
+          streamlinescalarssegmentation.SetThresholdLower( bbGetInputThresholdLower() );
+          streamlinescalarssegmentation.SetThresholdUpper( bbGetInputThresholdUpper() );
+               streamlinescalarssegmentation.Process();
+          bbSetOutputStreamLinesOut( streamlinescalarssegmentation.GetStreamLinesOut() );
+
+}
+//===== 
+// 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 StreamLineSegmentationByScalar::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputStreamLinesIn(NULL);
+   bbSetInputScalarArrayName("");
+   bbSetInputThresholdLower(0);
+   bbSetInputThresholdUpper(0);
+   bbSetOutputStreamLinesOut(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 StreamLineSegmentationByScalar::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 StreamLineSegmentationByScalar::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/bbcreaVtkStreamLineSegmentationByScalar.h b/bbtk_creaVtk_PKG/src/bbcreaVtkStreamLineSegmentationByScalar.h
new file mode 100644 (file)
index 0000000..8725cee
--- /dev/null
@@ -0,0 +1,58 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaVtkStreamLineSegmentationByScalar_h_INCLUDED__
+#define __bbcreaVtkStreamLineSegmentationByScalar_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <string>
+#include <vtkPolyData.h>
+
+#include "creaVtkStreamLineScalarSeg.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT StreamLineSegmentationByScalar
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(StreamLineSegmentationByScalar,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(StreamLinesIn,vtkPolyData*);
+  BBTK_DECLARE_INPUT(ScalarArrayName,std::string);
+  BBTK_DECLARE_INPUT(ThresholdLower,double);
+  BBTK_DECLARE_INPUT(ThresholdUpper,double);
+  BBTK_DECLARE_OUTPUT(StreamLinesOut,vtkPolyData*);
+  BBTK_PROCESS(Process);
+  void Process();
+
+       creaVtkStreamLineScalarSeg streamlinescalarssegmentation;
+//===== 
+// 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(StreamLineSegmentationByScalar,bbtk::AtomicBlackBox);
+       BBTK_NAME("StreamLineSegmentationByScalar");
+       BBTK_AUTHOR("Info-Dev");
+       BBTK_DESCRIPTION("No Description.");
+       BBTK_CATEGORY("Filter_vtkPolyData");
+       BBTK_INPUT(StreamLineSegmentationByScalar,StreamLinesIn,"Stream Lines",vtkPolyData*,"");
+       BBTK_INPUT(StreamLineSegmentationByScalar,ScalarArrayName,"Name of the Array vector in vtkPolyData input",std::string,"");
+       BBTK_INPUT(StreamLineSegmentationByScalar,ThresholdLower,"Low threshold",double,"");
+       BBTK_INPUT(StreamLineSegmentationByScalar,ThresholdUpper,"Upper threshold",double,"");
+       BBTK_OUTPUT(StreamLineSegmentationByScalar,StreamLinesOut,"First output",vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(StreamLineSegmentationByScalar);
+//===== 
+// 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 // __bbcreaVtkStreamLineSegmentationByScalar_h_INCLUDED__
+
diff --git a/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp b/lib/creaVtk/creaVtkStreamLineScalarSeg.cpp
new file mode 100644 (file)
index 0000000..95fd4c5
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#include "creaVtkStreamLineScalarSeg.h"
+#include "vtkPointData.h"
+#include "vtkDataArray.h"
+#include "vtkDoubleArray.h"
+
+
+// ------------------------------------------------------------------------
+creaVtkStreamLineScalarSeg::creaVtkStreamLineScalarSeg()
+{
+       _vtkidlist                      = vtkIdList::New();
+   _newvtkpolydata     = vtkPolyData::New();   
+   _newvtkcellarray    = vtkCellArray::New();  
+}
+
+// ------------------------------------------------------------------------
+creaVtkStreamLineScalarSeg::~creaVtkStreamLineScalarSeg()
+{
+}
+
+// ------------------------------------------------------------------------
+void creaVtkStreamLineScalarSeg::SetScalarStreamLinesIn( vtkPolyData* polydata)
+{
+       _StreamLinesIn = polydata;
+}
+
+// ------------------------------------------------------------------------
+void creaVtkStreamLineScalarSeg::SetScalarArrayName( std::string name)
+{
+       _ScalarArrayName = name;
+}
+
+// ------------------------------------------------------------------------
+void creaVtkStreamLineScalarSeg::SetThresholdLower( double value)
+{
+       _ThresholdLower = value;        
+}
+
+// ------------------------------------------------------------------------
+void creaVtkStreamLineScalarSeg::SetThresholdUpper( double value )
+{
+       _ThresholdUpper = value;        
+}
+
+// ------------------------------------------------------------------------
+void creaVtkStreamLineScalarSeg::Process()
+{
+       if (_ScalarArrayName=="")
+       {
+               printf(".\n ");
+               printf(".\n ");
+               printf("BBTK Warnning! ScalarArrayName is empty in creaVtkStreamLineScalarSeg \n");
+               printf(".\n ");
+               printf(".\n ");
+       }
+
+       if ((_StreamLinesIn!=NULL) && (_ScalarArrayName!="") )
+       {
+               int iLine;
+
+               _newvtkcellarray->Initialize();
+
+       vtkCellArray    *vtkcellarray           = _StreamLinesIn->GetLines();
+       int                             nLinesCell                      = vtkcellarray->GetNumberOfCells(); 
+//     int                             vtkcellarraysize        = vtkcellarray->GetSize();
+       int                             numberofids; 
+       int                             ii;
+               vtkDataArray    *scalarArray = _StreamLinesIn->GetPointData()->GetArray( _ScalarArrayName.c_str() );
+
+
+               vtkDoubleArray  *newScalarArray                         = vtkDoubleArray::New();
+               newScalarArray->SetName( _ScalarArrayName.c_str() );            
+               newScalarArray->SetNumberOfComponents(1); 
+
+       // FOR EACH LINE
+               double scalarValue;
+               long int iLineNew=0;
+       ii=0;
+       for ( iLine=0 ; iLine<nLinesCell ; iLine++ )
+       {
+                       vtkcellarray->GetCell(ii, _vtkidlist );
+                       numberofids = _vtkidlist->GetNumberOfIds();
+                       scalarValue = scalarArray->GetTuple1(iLine);
+                       if ( ( scalarValue>=_ThresholdLower ) && ( scalarValue<=_ThresholdUpper ) )
+                       {
+                               _newvtkcellarray->InsertNextCell( _vtkidlist );
+                               newScalarArray->InsertTuple1( iLineNew, scalarValue );
+                               iLineNew++;
+                       }
+
+                       ii=ii+numberofids+1;
+       } // for iLine
+
+               _newvtkpolydata->SetPoints( _StreamLinesIn->GetPoints() );
+               _newvtkpolydata->SetLines( _newvtkcellarray );
+               int iArrays,arraysSize = _StreamLinesIn->GetPointData()->GetNumberOfArrays();
+               for ( iArrays=0 ; iArrays<arraysSize ; iArrays++ )
+               {       
+                       _newvtkpolydata->GetPointData()->AddArray( _StreamLinesIn->GetPointData()->GetArray(iArrays) );
+               }               
+               _newvtkpolydata->GetPointData()->RemoveArray( _ScalarArrayName.c_str() );
+               _newvtkpolydata->GetPointData()->AddArray( newScalarArray );
+               _newvtkpolydata->Update();
+
+       _StreamLinesOut = _newvtkpolydata;
+
+       } // _StreamLinesIn
+
+}
+
+// ------------------------------------------------------------------------
+vtkPolyData* creaVtkStreamLineScalarSeg::GetStreamLinesOut()
+{
+       return _StreamLinesOut;
+}
+
+
diff --git a/lib/creaVtk/creaVtkStreamLineScalarSeg.h b/lib/creaVtk/creaVtkStreamLineScalarSeg.h
new file mode 100644 (file)
index 0000000..73bbf14
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#ifndef _CREAVTKSTREAMLINESCALARSEG_H_
+#define _CREAVTKSTREAMLINESCALARSEG_H_
+
+#include <string>
+
+#include <vtkPolyData.h>
+#include "vtkIdList.h"
+#include "vtkCellArray.h"
+
+
+//---------------------------------------------
+// Class Name: creaVtkStreamLineScalarSeg
+// [classdescription]
+//---------------------------------------------
+
+class creaVtkStreamLineScalarSeg
+{
+
+//---------------------------------------------
+//Methods and attributes exposed to other classes
+//---------------------------------------------
+public :
+  creaVtkStreamLineScalarSeg();
+  ~creaVtkStreamLineScalarSeg();
+
+       void SetScalarStreamLinesIn( vtkPolyData* );
+       void SetScalarArrayName( std::string );
+       void SetThresholdLower( double );
+       void SetThresholdUpper( double );
+       void Process();
+       vtkPolyData* GetStreamLinesOut();
+
+
+//--Method template----------------------------
+//  void FunctionName(int& parameterA);
+
+
+//---------------------------------------------
+//Methods and attributes exposed only to classes
+//that are derived from this class
+//---------------------------------------------
+protected:
+
+//---------------------------------------------
+//Methods and attributes only visible by this class
+//---------------------------------------------
+private:
+
+       vtkPolyData     *_StreamLinesIn;
+       vtkPolyData     *_StreamLinesOut;
+
+       vtkIdList               *_vtkidlist;
+   vtkPolyData         *_newvtkpolydata;       
+   vtkCellArray        *_newvtkcellarray;      
+
+       std::string     _ScalarArrayName;
+       double                  _ThresholdLower;
+       double                  _ThresholdUpper;
+};
+
+//-end of _CREAVTKSTREAMLINESCALARSEG_H_------------------------------------------------------
+#endif
index c088d5e211029ba63edd7f9736d664627700ae81..f26bf2e0969562a4a322bfecf21c5ad22e03cfbb 100644 (file)
@@ -126,15 +126,15 @@ void vtkStreamLineCreateColorInfo::Run()
                magnitud->SetTuple1 (id, mag);
                velocity->SetTuple3 (id, vx,vy,vz);
                colorDirection->SetTuple3 (id, colorDirX,colorDirY,colorDirZ);
-}
+               } // for jj
 
                ii=ii+numberofids+1;
-       } // for iLine
+   } // for iLine
 
-               _StreamLinesIn->GetPointData()->AddArray( mask );
-               _StreamLinesIn->GetPointData()->AddArray( magnitud );
-               _StreamLinesIn->GetPointData()->AddArray( velocity );
-               _StreamLinesIn->GetPointData()->AddArray( colorDirection );
+       _StreamLinesIn->GetPointData()->AddArray( mask );
+       _StreamLinesIn->GetPointData()->AddArray( magnitud );
+       _StreamLinesIn->GetPointData()->AddArray( velocity );
+       _StreamLinesIn->GetPointData()->AddArray( colorDirection );
 
 }