--- /dev/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)
+//=====
+#include "bbcreaVtkCutImageSectorSegmentation.h"
+#include "bbcreaVtkPackage.h"
+
+#include "cutImageSegmentation.h"
+
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,CutImageSectorSegmentation)
+BBTK_BLACK_BOX_IMPLEMENTATION(CutImageSectorSegmentation,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 CutImageSectorSegmentation::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')
+ cutImageSegmentation cis;
+
+ cis.SetAnglesImage(bbGetInputImage());
+ cis.SetMesh1(bbGetInputMesh1());
+
+
+ cis.Process();
+
+ bbSetOutputResultImage(cis.GetResultImage());
+
+
+
+}
+//=====
+// 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 CutImageSectorSegmentation::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputImage(NULL);
+ bbSetInputMesh1(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 CutImageSectorSegmentation::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 CutImageSectorSegmentation::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaVtkCutImageSectorSegmentation_h_INCLUDED__
+#define __bbcreaVtkCutImageSectorSegmentation_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+
+#include "vtkImageData.h"
+#include "vtkPolyData.h"
+
+#include "iostream"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT CutImageSectorSegmentation
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(CutImageSectorSegmentation,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(Mesh1,vtkPolyData*);
+ BBTK_DECLARE_OUTPUT(ResultImage,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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(CutImageSectorSegmentation,bbtk::AtomicBlackBox);
+BBTK_NAME("CutImageSectorSegmentation");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(CutImageSectorSegmentation,Image,"Angles Image ",vtkImageData*,"");
+BBTK_INPUT(CutImageSectorSegmentation,Mesh1,"Sector Image",vtkPolyData*,"");
+BBTK_OUTPUT(CutImageSectorSegmentation,ResultImage,"Result Image",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(CutImageSectorSegmentation);
+//=====
+// 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 // __bbcreaVtkCutImageSectorSegmentation_h_INCLUDED__
+
--- /dev/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)
+//=====
+#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
+
+
--- /dev/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)
+//=====
+#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__
+
--- /dev/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)
+//=====
+#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
+
+
--- /dev/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)
+//=====
+#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__
+
--- /dev/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)
+//=====
+#include "bbcreaVtkReadMHDPlane.h"
+#include "bbcreaVtkPackage.h"
+
+#include "stdio.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ReadMHDPlane)
+BBTK_BLACK_BOX_IMPLEMENTATION(ReadMHDPlane,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 ReadMHDPlane::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;
+
+
+
+
+ long int newHeaderSize;
+ std::string newFileName=bbGetInputFileName()+"-OneSlice";
+
+ int sx,sy;
+ char mystring[250];
+ char strTmp[20];
+ FILE *ffOut = fopen(newFileName.c_str(),"w+");
+ FILE *ffIn = fopen(bbGetInputFileName().c_str(),"r+");
+
+ while(!feof(ffIn))
+ {
+ strcpy(mystring,"\n");
+ fgets(mystring,250,ffIn);
+ if (strncmp("NDims",mystring,5)==0) {strcpy(mystring,"NDims = 2\n");}
+ if (strncmp("DimSize",mystring,6)==0)
+ {
+ sscanf(mystring,"%s %s %d %d",strTmp, strTmp, &sx, &sy);
+ sprintf(mystring,"DimSize = %d %d\n",sx,sy);
+ newHeaderSize = sx*sy*bbGetInputSlice();
+ }
+ if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { newHeaderSize=newHeaderSize*2; }
+ if (strncmp("ElementType = MET_SHORT",mystring,23)==0) { newHeaderSize=newHeaderSize*2; }
+ if (strncmp("ElementType = MET_FLOAT",mystring,23)==0) { newHeaderSize=newHeaderSize*2; }
+ if (strncmp("Offset",mystring,6)==0) {strcpy(mystring,"Offset = 0 0 0\n");}
+ if (strncmp("HeaderSize",mystring,10)==0) {strcpy(mystring,"");}
+ if (strncmp("ElementDataFile",mystring,15)==0)
+ {
+ fprintf(ffOut,"HeaderSize = %ld\n\n", newHeaderSize );
+ }
+ fprintf(ffOut,mystring);
+ }
+
+/*
+ fprintf(ff,"ObjectType = Image\n");
+ fprintf(ff,"NDims = 2\n");
+ fprintf(ff,"BinaryData = True\n");
+ fprintf(ff,"BinaryDataByteOrderMSB = False\n");
+ fprintf(ff,"CompressedData = False\n");
+ fprintf(ff,"TransformMatrix = 1 0 0 0 1 0 0 0 1\n");
+ fprintf(ff,"CenterOfRotation = 0 0 0\n");
+ fprintf(ff,"ElementSpacing = 0.7 0.7 0.7\n");
+ fprintf(ff,"DimSize = 512 512\n");
+ fprintf(ff,"AnatomicalOrientation = ???\n");
+ fprintf(ff,"ElementType = MET_SHORT\n");
+ fprintf(ff,"ElementNumberOfChannels = 1\n");
+ fprintf(ff,"Offset = 0 0 0\n");
+ fprintf(ff,"HeaderSize = %ld\n", newHeaderSize );
+ fprintf(ff,"ElementDataFile = inspi1_ana.raw\n");
+*/
+
+ fclose(ffIn);
+ fclose(ffOut);
+
+
+ vtkMetaImageReader * reader = vtkMetaImageReader::New();
+ reader->SetFileName( newFileName.c_str() );
+ reader->Update();
+
+ bbSetOutputOut( reader->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 ReadMHDPlane::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputFileName("");
+ bbSetInputSlice(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 ReadMHDPlane::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 ReadMHDPlane::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaVtkReadMHDPlane_h_INCLUDED__
+#define __bbcreaVtkReadMHDPlane_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+#include "vtkMetaImageReader.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT ReadMHDPlane
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ReadMHDPlane,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(FileName,std::string);
+ BBTK_DECLARE_INPUT(Slice,int);
+ 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadMHDPlane,bbtk::AtomicBlackBox);
+ BBTK_NAME("ReadMHDPlane");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ReadMHDPlane,FileName,"Image file name",std::string,"");
+ BBTK_INPUT(ReadMHDPlane,Slice,"Slice number",int,"");
+ BBTK_OUTPUT(ReadMHDPlane,Out,"Image 2D",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ReadMHDPlane);
+//=====
+// 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 // __bbcreaVtkReadMHDPlane_h_INCLUDED__
+
--- /dev/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)
+//=====
+#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
+
+
--- /dev/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)
+//=====
+#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__
+
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# 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 "cutImageSegmentation.h"
+
+cutImageSegmentation::cutImageSegmentation()
+{
+}
+
+cutImageSegmentation::~cutImageSegmentation()
+{
+}
+
+void cutImageSegmentation::SetAnglesImage( vtkImageData* image )
+{
+ this->m_Image = image;
+}
+
+void cutImageSegmentation::SetMesh1(vtkPolyData* mesh)
+{
+ this->m_Mesh1 = mesh;
+}
+
+vtkImageData*
+cutImageSegmentation::GetResultImage()
+{
+ return m_ResultImage;
+}
+
+
+void cutImageSegmentation::Process()
+{
+ std::cout << "MLER cutImageSegmentation :: Process Start()" << std::endl;
+
+ if(m_Mesh1 != NULL)
+ {
+
+ vtkLinearExtrusionFilter *extrude = vtkLinearExtrusionFilter::New();
+ vtkPolyDataToImageStencil *dataToStencil = vtkPolyDataToImageStencil::New();
+ vtkImageStencil *imageStencil = vtkImageStencil::New();
+ //vtkExtractVOI *extract = vtkExtractVOI::New();
+ vtkAppendPolyData *append = vtkAppendPolyData::New();
+ //vtkTriangleFilter *triangleFilter = vtkTriangleFilter::New();
+ vtkStripper *stripper = vtkStripper::New();
+ vtkTransformPolyDataFilter *transformFilter= vtkTransformPolyDataFilter::New();
+
+ double bounds[6];
+
+ //vtkPolyDataToImageStencil* stencil = vtkPolyDataToImageStencil::New();
+ /* Test # 1 Cod Python
+ extract->SetVOI( 0, 128, 0, 104, 0, 9);
+ extract->SetSampleRate(1, 1, 1);
+ extract->SetInput(m_Image);
+ extract->ReleaseDataFlagOff();
+
+
+ extrude->SetInput(m_Mesh1);
+ extrude->SetScaleFactor(1);
+ extrude->SetExtrusionTypeToNormalExtrusion();
+ extrude->SetVector(0,0,1);
+ //extrude->Update();
+
+ extrude->Print(std::cout);
+
+ std::cout << "MLER cutImageSegmentation ---> polygonal data --> image stencil:" << std::endl;
+
+ //dataToStencil->SetTolerance(0);
+ dataToStencil->SetInput(extrude->GetOutput());
+ //dataToStencil->SetOutputSpacing(m_Image->GetSpacing());
+ //dataToStencil->SetOutputWholeExtent(m_Image->GetExtent());
+ //dataToStencil->Update();
+
+ dataToStencil->Print(std::cout);
+
+ imageStencil->SetInput(extract->GetOutput());
+ imageStencil->SetStencil(dataToStencil->GetOutput());
+
+ imageStencil->ReverseStencilOff();
+ imageStencil->SetBackgroundValue(128);
+ imageStencil->Update();
+
+ imageStencil->Print(std::cout);
+
+ m_ResultImage = imageStencil->GetOutput();
+ */
+
+ /*Test #2
+ stripper->SetInput(m_Mesh1);
+ transformFilter->SetInput(stripper->GetOutput());
+
+ dataToStencil->SetOutputOrigin(m_Image->GetOrigin());
+ dataToStencil->SetOutputSpacing(m_Image->GetSpacing());
+ dataToStencil->SetOutputWholeExtent(m_Image->GetExtent());
+
+ dataToStencil->SetInput(transformFilter->GetOutput());
+
+ imageStencil->SetInput(m_Image);
+ imageStencil->SetStencil(dataToStencil->GetOutput());
+ imageStencil->Update();
+
+ m_ResultImage = imageStencil->GetOutput();
+ */
+
+ //Test 3
+ /*
+ m_Mesh1->GetBounds(bounds);
+
+ dataToStencil->SetInput(m_Mesh1);
+ dataToStencil->SetOutputOrigin(m_Image->GetOrigin());
+ dataToStencil->SetOutputSpacing(m_Image->GetSpacing());
+ dataToStencil->SetOutputWholeExtent(m_Image->GetExtent());
+ dataToStencil->Update();
+
+ imageStencil->SetInput(m_Image);
+ imageStencil->SetStencil(dataToStencil->GetOutput());
+ imageStencil->ReverseStencilOff();
+ //imageStencil->SetBackgroundValue(100);
+ imageStencil->Update();
+ */
+
+ //Test 4
+ m_Mesh1->GetBounds(bounds);
+
+ std::cout << "bounds 0:" << bounds[0]<< std::endl;
+ std::cout << "bounds 1:" << bounds[1]<< std::endl;
+ std::cout << "bounds 2:" << bounds[2]<< std::endl;
+ std::cout << "bounds 3:" << bounds[3]<< std::endl;
+ std::cout << "bounds 4:" << bounds[4]<< std::endl;
+ std::cout << "bounds 5:" << bounds[5]<< std::endl;
+
+
+
+ double origin[3];
+ //double *spacing = NULL;
+ //spacing = m_Image->GetSpacing();
+
+ double spacing[3];
+ spacing[0] = 2.62565;
+ spacing[1] = 2.62565;
+ spacing[2] = 6.25;
+
+
+ std::cout << "spacing 0:" << spacing[0]<< std::endl;
+ std::cout << "spacing 1:" << spacing[1]<< std::endl;
+ std::cout << "spacing 2:" << spacing[2]<< std::endl;
+
+ //origin[0] = bounds[0] + spacing[0] / 2;
+ //origin[1] = bounds[2] + spacing[1] / 2;
+ //origin[2] = bounds[4] + spacing[2] / 2;
+
+
+ //MLER -- EED ??????????????????? 64,52,5
+ origin[0] = 64;
+ origin[1] = 52;
+ origin[2] = 5;
+
+ std::cout << "origin;0:" << origin[0]<< std::endl;
+ std::cout << "origin 1:" << origin[1]<< std::endl;
+ std::cout << "origin 2:" << origin[2]<< std::endl;
+
+
+ m_Image->SetOrigin(origin);
+
+
+ extrude->SetInput(m_Mesh1);
+ extrude->SetScaleFactor(1);
+ extrude->SetExtrusionTypeToNormalExtrusion();
+ extrude->SetVector(0,0,1);
+ extrude->Update();
+
+ dataToStencil->SetTolerance(0);
+ dataToStencil->SetInput(extrude->GetOutput());
+ dataToStencil->SetOutputOrigin(origin);
+ dataToStencil->SetOutputSpacing(spacing);
+ dataToStencil->SetOutputWholeExtent(m_Image->GetExtent());
+ dataToStencil->Update();
+
+ imageStencil->SetInput(m_Image);
+ imageStencil->SetStencil(dataToStencil->GetOutput());
+ imageStencil->ReverseStencilOff();
+ imageStencil->SetBackgroundValue(-200);
+ imageStencil->Update();
+
+ m_ResultImage = imageStencil->GetOutput();
+
+
+ }//i m_Mesh1 != Null
+ else{
+
+ std::cout << "MLER cutImageSegmentation :: NO HAY MESH" << std::endl;
+
+ }//else if m_Mesh1
+
+ std::cout << "MLER cutImageSegmentation :: Process End" << std::endl;
+
+}
+
+//---------------------------------------------
+//Method template
+//---------------------------------------------
+/*
+void cutImageSegmentation::FunctionName(int& parameterA)
+{
+ parameterA = 2 * parameterA;
+ return;
+}
+*/
+
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# 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 _CUTIMAGESEGMENTATION_H_
+#define _CUTIMAGESEGMENTATION_H_
+
+#include "vtkImageData.h"
+#include "vtkPolyData.h"
+#include "vtkLinearExtrusionFilter.h"
+#include "vtkPolyDataToImageStencil.h"
+#include "vtkImageStencil.h"
+//#include "vtkExtractVOI.h"
+#include "vtkAppendPolyData.h"
+//#include "vtkTriangleFilter"
+#include "vtkStripper.h"
+#include "vtkTransformPolyDataFilter.h"
+#include <vector>
+//#include <math.h>
+
+//#include "HeartAngles.h"
+//---------------------------------------------
+// Class Name: cutImageSegmentation
+// [classdescription]
+//---------------------------------------------
+
+class cutImageSegmentation
+{
+
+//---------------------------------------------
+//Methods and attributes exposed to other classes
+//---------------------------------------------
+public :
+ cutImageSegmentation();
+ ~cutImageSegmentation();
+
+ void SetAnglesImage ( vtkImageData* image );
+ void SetMesh1 ( vtkPolyData* mesh );
+
+ vtkImageData* GetResultImage();
+
+ void Process();
+
+
+//--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:
+
+ vtkImageData* m_Image;
+ vtkPolyData* m_Mesh1;
+
+ vtkImageData* m_ResultImage;
+
+ //HeartAngles ha;
+};
+
+//-end of _cutImageSegmentation_H_------------------------------------------------------
+#endif