]> Creatis software - creaVtk.git/commitdiff
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/creaVtk
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 8 Oct 2015 13:57:54 +0000 (15:57 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 8 Oct 2015 13:57:54 +0000 (15:57 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkGenerateArrowSource.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkGenerateArrowSource.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx [new file with mode: 0644]
bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h [new file with mode: 0644]

diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGenerateArrowSource.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGenerateArrowSource.cxx
new file mode 100644 (file)
index 0000000..2d592e2
--- /dev/null
@@ -0,0 +1,80 @@
+//===== 
+// 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 "bbcreaVtkGenerateArrowSource.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GenerateArrowSource)
+BBTK_BLACK_BOX_IMPLEMENTATION(GenerateArrowSource,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 GenerateArrowSource::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')
+   
+       vtkArrowSource     *arrowSource = vtkArrowSource::New();
+
+       arrowSource->SetTipResolution(3);
+       //arrowSource->SetTipRadius(1.0);
+       //arrowSource->SetTipLength(1.0);
+       arrowSource->SetShaftRadius(0.04);
+       arrowSource->Update();
+
+       bbSetOutputArrowSource(arrowSource->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 GenerateArrowSource::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+  // bbSetInputIn(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 GenerateArrowSource::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 GenerateArrowSource::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/bbcreaVtkGenerateArrowSource.h b/bbtk_creaVtk_PKG/src/bbcreaVtkGenerateArrowSource.h
new file mode 100644 (file)
index 0000000..9ecd02a
--- /dev/null
@@ -0,0 +1,49 @@
+//===== 
+// 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 __bbcreaVtkGenerateArrowSource_h_INCLUDED__
+#define __bbcreaVtkGenerateArrowSource_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkArrowSource.h"
+#include "vtkPolyData.h"
+#include "vtkActor.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT GenerateArrowSource
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(GenerateArrowSource,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(Point,std::vector<double>);
+  BBTK_DECLARE_OUTPUT(ArrowSource,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(GenerateArrowSource,bbtk::AtomicBlackBox);
+BBTK_NAME("GenerateArrowSource");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(GenerateArrowSource,Point,"Coordinate of Point",std::vector<double>,"");
+BBTK_OUTPUT(GenerateArrowSource,ArrowSource,"Arrow Representation",vtkPolyData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(GenerateArrowSource);
+//===== 
+// 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 // __bbcreaVtkGenerateArrowSource_h_INCLUDED__
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx
new file mode 100644 (file)
index 0000000..959c59c
--- /dev/null
@@ -0,0 +1,78 @@
+//===== 
+// 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 "bbcreaVtkGrayLevel.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GrayLevel)
+BBTK_BLACK_BOX_IMPLEMENTATION(GrayLevel,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 GrayLevel::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')
+    vtkImageData  *m_image  =  vtkImageData::New();
+    m_image = bbGetInputImage();
+
+    int grayLevel = 0;
+    std::vector<double> coord = bbGetInputCoordinate();
+
+       grayLevel = m_image->GetScalarComponentAsDouble(coord[0],coord[1],coord[2],0);
+
+       bbSetOutputGrayLevel(grayLevel);
+    
+}
+//===== 
+// 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 GrayLevel::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputImage(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 GrayLevel::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 GrayLevel::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/bbcreaVtkGrayLevel.h b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h
new file mode 100644 (file)
index 0000000..20e06f8
--- /dev/null
@@ -0,0 +1,49 @@
+//===== 
+// 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 __bbcreaVtkGrayLevel_h_INCLUDED__
+#define __bbcreaVtkGrayLevel_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT GrayLevel
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(GrayLevel,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(Image,vtkImageData*);
+  BBTK_DECLARE_INPUT(Coordinate,std::vector<double>);
+  BBTK_DECLARE_OUTPUT(GrayLevel,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(GrayLevel,bbtk::AtomicBlackBox);
+BBTK_NAME("GrayLevel");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(GrayLevel,Image,"Image",vtkImageData*,"");
+BBTK_INPUT(GrayLevel,Coordinate,"Coordinate Of Point ",std::vector<double>,"");
+BBTK_OUTPUT(GrayLevel,GrayLevel,"GrayLevel",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(GrayLevel);
+//===== 
+// 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 // __bbcreaVtkGrayLevel_h_INCLUDED__
+
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx
new file mode 100644 (file)
index 0000000..38f2ffb
--- /dev/null
@@ -0,0 +1,133 @@
+//===== 
+// 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 "bbcreaVtkVectorsExtraction.h"
+#include "bbcreaVtkPackage.h"
+#include "vtkDoubleArray.h"
+
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsExtraction)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorsExtraction,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 VectorsExtraction::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')
+    std::cout<< "MLER VectorsExtraction Process Start" << std::endl;
+
+    if(bbGetInputVectorsFieldImage() != NULL )
+       {
+               vtkImageData         *m_VectorImage = bbGetInputVectorsFieldImage();
+               vtkIdType             m_idType;
+      vtkDoubleArray       *velocity      = vtkDoubleArray::New();
+
+      std::vector<double> coord           = bbGetInputCoordinates();
+      std::vector<double> vec;
+
+      vec.push_back(0);
+      vec.push_back(0);
+      vec.push_back(0);
+
+      double ang1 = 0;//Angle 1
+      double ang2 = 0;//ANgle 2
+      double comp = 0;//Component x + y
+
+      //Find coordinate into the image      
+      m_idType = m_VectorImage->FindPoint(coord[0],coord[1],coord[2]);
+      std::cout << m_idType;
+
+      //Recuperate vector of vectorFieldImage
+               velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity"));
+      //velocity->Print(std::cout);
+
+      std::cout<< "# components velocity: " << velocity->GetNumberOfComponents()<<std::endl;
+      std::cout<< "# tuples velocity: " << velocity->GetNumberOfTuples()<<std::endl;
+
+      vec[0] = velocity->GetComponent(m_idType,0);
+      vec[1] = velocity->GetComponent(m_idType,1);
+      vec[2] = velocity->GetComponent(m_idType,2);
+
+      std::cout << "velocity :" << vec[0] << "," <<vec[1] << ","<< vec[2] << std::endl;
+
+
+      //Miss calcule of angles -----
+      comp = sqrt((vec[0]*vec[0])+(vec[1]*vec[1]));
+      
+      ang1 = atan2(vec[2],comp) * 180 / PI;
+
+
+      ang2 = atan2(vec[1],vec[0]) * 180 / PI;
+
+      
+               //m_VectorImage->Print(std::cout);
+
+      std::cout << "ang1: " << ang1 << std::endl;
+      std::cout << "ang2: " << ang2 << std::endl;
+
+       bbSetOutputAngle1(ang1);
+       bbSetOutputAngle2(ang2);
+      bbSetOutputVector(vec);
+      bbSetOutputX(coord[0]);
+      bbSetOutputY(coord[1]);
+      bbSetOutputZ(coord[2]);
+
+       }// if image != NULL
+    
+    std::cout<< "MLER VectorsExtraction Process END" << std::endl;
+  
+}
+//===== 
+// 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 VectorsExtraction::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputVectorsFieldImage(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 VectorsExtraction::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 VectorsExtraction::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/bbcreaVtkVectorsExtraction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h
new file mode 100644 (file)
index 0000000..d7770f8
--- /dev/null
@@ -0,0 +1,63 @@
+//===== 
+// 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 __bbcreaVtkVectorsExtraction_h_INCLUDED__
+#define __bbcreaVtkVectorsExtraction_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+#include "vtkPointData.h"
+#include <math.h>
+
+#define PI 3.14159265
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT VectorsExtraction
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(VectorsExtraction,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(Coordinates,std::vector<double>);
+  BBTK_DECLARE_INPUT(VectorsFieldImage,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(Vector,std::vector<double>);
+  BBTK_DECLARE_OUTPUT(X,double);
+  BBTK_DECLARE_OUTPUT(Y,double);
+  BBTK_DECLARE_OUTPUT(Z,double);
+  BBTK_DECLARE_OUTPUT(Angle1,double);
+  BBTK_DECLARE_OUTPUT(Angle2,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(VectorsExtraction,bbtk::AtomicBlackBox);
+BBTK_NAME("VectorsExtraction");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(VectorsExtraction,Coordinates,"Coordinates (x,y,z)",std::vector<double>,"");
+BBTK_INPUT(VectorsExtraction,VectorsFieldImage,"Image of Vectors Field",vtkImageData*,"");
+BBTK_OUTPUT(VectorsExtraction,Vector,"",std::vector<double>,"");
+BBTK_OUTPUT(VectorsExtraction,X,"x",double,"");
+BBTK_OUTPUT(VectorsExtraction,Y,"y",double,"");
+BBTK_OUTPUT(VectorsExtraction,Z,"z",double,"");
+BBTK_OUTPUT(VectorsExtraction,Angle1,"Angle 1 (Helix Angle)",double,"");
+BBTK_OUTPUT(VectorsExtraction,Angle2,"Angle 2 (Transversal Angle)",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(VectorsExtraction);
+//===== 
+// 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 // __bbcreaVtkVectorsExtraction_h_INCLUDED__
+