From 03cc68dd6b831aa98e1e0fad20a977ffa074be39 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 1 Feb 2016 14:59:19 +0100 Subject: [PATCH] #2808, #2807, #2806, #2805, #2804 BBTK Feature New Normal Add new functionality MathOperation ReadComlumns StringWrite Transfor UpdateRender TransposeVectors SplitFilePath RepalceString MathOperationVector --- kernel/src/bbtkWtBlackBox.h | 1 + packages/std/src/bbstdMathOperation.cxx | 23 +- packages/std/src/bbstdMathOperation.h | 4 +- packages/std/src/bbstdMathOperationVector.cxx | 457 ++++++++++++++++++ packages/std/src/bbstdMathOperationVector.h | 78 +++ packages/std/src/bbstdReadColumnsInt.cxx | 2 +- packages/std/src/bbstdReplaceString.cxx | 83 ++++ packages/std/src/bbstdReplaceString.h | 51 ++ packages/std/src/bbstdSplitFilePathVector.cxx | 104 ++++ packages/std/src/bbstdSplitFilePathVector.h | 56 +++ packages/std/src/bbstdStringWriter.cxx | 20 +- packages/std/src/bbstdTransposeVectors.cxx | 21 + packages/std/src/bbstdTransposeVectors.h | 196 ++++++++ packages/vtk/src/bbvtkTransform.cxx | 13 +- packages/vtk/src/bbvtkTransform.h | 7 +- packages/vtk/src/bbvtkUpdateRender.cxx | 3 + 16 files changed, 1088 insertions(+), 31 deletions(-) create mode 100644 packages/std/src/bbstdMathOperationVector.cxx create mode 100644 packages/std/src/bbstdMathOperationVector.h create mode 100644 packages/std/src/bbstdReplaceString.cxx create mode 100644 packages/std/src/bbstdReplaceString.h create mode 100644 packages/std/src/bbstdSplitFilePathVector.cxx create mode 100644 packages/std/src/bbstdSplitFilePathVector.h create mode 100644 packages/std/src/bbstdTransposeVectors.cxx create mode 100644 packages/std/src/bbstdTransposeVectors.h diff --git a/kernel/src/bbtkWtBlackBox.h b/kernel/src/bbtkWtBlackBox.h index 1df5570..4725a0d 100644 --- a/kernel/src/bbtkWtBlackBox.h +++ b/kernel/src/bbtkWtBlackBox.h @@ -54,6 +54,7 @@ #ifdef USE_WT + #ifndef __bbtkWtBlackBox_h__ #define __bbtkWtBlackBox_h__ diff --git a/packages/std/src/bbstdMathOperation.cxx b/packages/std/src/bbstdMathOperation.cxx index be243d7..a4b7272 100644 --- a/packages/std/src/bbstdMathOperation.cxx +++ b/packages/std/src/bbstdMathOperation.cxx @@ -46,7 +46,7 @@ void MathOperation::Process() if (bbGetInputType()==3) { - if (bbGetInputIn2()!=0) bbSetOutputOut( bbGetInputIn1() / bbGetInputIn2() ); + if (bbGetInputIn2()!=0) bbSetOutputOut( bbGetInputIn1() / bbGetInputIn2() ); else bbSetOutputOut( 99999999 ); } @@ -54,7 +54,7 @@ void MathOperation::Process() if (bbGetInputType()==5) { - if (bbGetInputIn2()>0) bbSetOutputOut( log( bbGetInputIn1() ) ); + if (bbGetInputIn1()>0) bbSetOutputOut( log( bbGetInputIn1() ) ); else bbSetOutputOut( -99999999 ); } @@ -66,14 +66,17 @@ void MathOperation::Process() acum++; if (acum>bbGetInputIn2()) acum=bbGetInputIn1(); } - if (bbGetInputType()==8) bbSetOutputOut( rand() % (int) (bbGetInputIn2()-bbGetInputIn1()) + bbGetInputIn1() ); - if (bbGetInputType()==9) bbSetOutputOut( sin( bbGetInputIn1() ) ); + if (bbGetInputType()==8 ) bbSetOutputOut( rand() % (int) (bbGetInputIn2()-bbGetInputIn1()) + bbGetInputIn1() ); + if (bbGetInputType()==9 ) bbSetOutputOut( sin( bbGetInputIn1() ) ); if (bbGetInputType()==10) bbSetOutputOut( cos( bbGetInputIn1() ) ); if (bbGetInputType()==11) bbSetOutputOut( tan( bbGetInputIn1() ) ); if (bbGetInputType()==12) bbSetOutputOut( asin( bbGetInputIn1() ) ); if (bbGetInputType()==13) bbSetOutputOut( acos( bbGetInputIn1() ) ); if (bbGetInputType()==14) bbSetOutputOut( atan( bbGetInputIn1() ) ); if (bbGetInputType()==15) bbSetOutputOut( atan2( bbGetInputIn1(),bbGetInputIn2() ) ); + if (bbGetInputType()==16) bbSetOutputOut( fmin( bbGetInputIn1(),bbGetInputIn2() ) ); + if (bbGetInputType()==17) bbSetOutputOut( fmax( bbGetInputIn1(),bbGetInputIn2() ) ); + if (bbGetInputType()==18) bbSetOutputOut( fabs( bbGetInputIn1() ) ); } //===== // 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) @@ -90,6 +93,7 @@ void MathOperation::bbUserSetDefaultValues() firsttime=true; acum=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) //===== @@ -100,22 +104,19 @@ void MathOperation::bbUserInitializeProcessing() // 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 MathOperation::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 bbstd + +}// EO namespace bbstd diff --git a/packages/std/src/bbstdMathOperation.h b/packages/std/src/bbstdMathOperation.h index 7ab7eb0..351da4e 100644 --- a/packages/std/src/bbstdMathOperation.h +++ b/packages/std/src/bbstdMathOperation.h @@ -36,11 +36,11 @@ class bbstd_EXPORT MathOperation BBTK_BEGIN_DESCRIBE_BLACK_BOX(MathOperation,bbtk::AtomicBlackBox); BBTK_NAME("MathOperation"); BBTK_AUTHOR("InfoDev"); - BBTK_DESCRIPTION("No Description."); + BBTK_DESCRIPTION("Out = In1 In2"); BBTK_CATEGORY("empty"); BBTK_INPUT(MathOperation,In1,"First input",double,""); BBTK_INPUT(MathOperation,In2,"Second input",double,""); - BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1+In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1, 10 cos In1, 11 tan In1, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1,In2 ",int,""); + BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1 ",int,""); BBTK_OUTPUT(MathOperation,Out,"Output",double,""); BBTK_END_DESCRIBE_BLACK_BOX(MathOperation); diff --git a/packages/std/src/bbstdMathOperationVector.cxx b/packages/std/src/bbstdMathOperationVector.cxx new file mode 100644 index 0000000..2fc5d4e --- /dev/null +++ b/packages/std/src/bbstdMathOperationVector.cxx @@ -0,0 +1,457 @@ +//===== +// 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 "bbstdMathOperationVector.h" +#include "bbstdPackage.h" + +#include +#include +#include + +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MathOperationVector) +BBTK_BLACK_BOX_IMPLEMENTATION(MathOperationVector,bbtk::AtomicBlackBox); + +double MathOperationVector::g(std::vector*v,unsigned int i,double defValue ) +{ + double result=defValue; + if (i < (*v).size()) + { + result= (*v)[i]; + } + return result; +} + +void MathOperationVector::SumVector(std::vector *v,std::vector *vr) +{ + unsigned int i; + double tmpResult=0; + unsigned int sizeVec=v->size(); + if ( sizeVec>0) + { + for (i=0;ipush_back( tmpResult ); + } // if sizeVec +} + + +void MathOperationVector::MinVector(std::vector *v,std::vector *vr) +{ + unsigned int i; + double tmpResult; + unsigned int sizeVec=v->size(); + if ( sizeVec>0) + { + tmpResult=(*v)[0]; + for (i=1;ipush_back( tmpResult ); + } // if sizeVec +} + + +void MathOperationVector::MaxVector(std::vector *v,std::vector *vr) +{ + unsigned int i; + double tmpResult; + unsigned int sizeVec=v->size(); + if ( sizeVec>0) + { + tmpResult=(*v)[0]; + for (i=1;ipush_back( tmpResult ); + } // if sizeVec +} + +//===== +// 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 MathOperationVector::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') + + bool error; + unsigned int i; + unsigned int sizeVec = bbGetInputIn0().size(); + double tmpResult; + std::vector resultVec; + std::vector _v0=bbGetInputIn0(); + std::vector _v1=bbGetInputIn1(); + std::vector _v2=bbGetInputIn2(); + std::vector _v3=bbGetInputIn3(); + std::vector _v4=bbGetInputIn4(); + std::vector _v5=bbGetInputIn5(); + std::vector _v6=bbGetInputIn6(); + std::vector _v7=bbGetInputIn7(); + std::vector _v8=bbGetInputIn8(); + std::vector _v9=bbGetInputIn9(); + + std::vector *v0 = &_v0; + std::vector *v1 = &_v1; + std::vector *v2 = &_v2; + std::vector *v3 = &_v3; + std::vector *v4 = &_v4; + std::vector *v5 = &_v5; + std::vector *v6 = &_v6; + std::vector *v7 = &_v7; + std::vector *v8 = &_v8; + std::vector *v9 = &_v9; + + double minTmp; + double maxTmp; + + if (firsttime==true) + { + firsttime=false; + /* initialize random seed: */ + srand (time(NULL)); + if (bbGetInputType()==7) + { + for (i=0;i=0) tmpResult = sqrt( bbGetInputIn0()[i] ) ; + else tmpResult = 0 ; + resultVec.push_back( tmpResult ); + } // for i + bbSetOutputOut( resultVec ); + } // if Type 4 + + + if (bbGetInputType()==5) + { + for (i=0;i0) tmpResult = log( bbGetInputIn0()[i] ) ; + else tmpResult = -99999 ; + resultVec.push_back( tmpResult ); + } // for i + bbSetOutputOut( resultVec ); + } // if Type 5 + + + + if (bbGetInputType()==6) + { + for (i=0;ig(v1,i,0)) acum[i]=g(v0,i,0); + } // for + } // if Type 7 + + if (bbGetInputType()==8 ) + { + for (i=0;i); + BBTK_DECLARE_INPUT(In1,std::vector ); + BBTK_DECLARE_INPUT(In2,std::vector ); + BBTK_DECLARE_INPUT(In3,std::vector ); + BBTK_DECLARE_INPUT(In4,std::vector ); + BBTK_DECLARE_INPUT(In5,std::vector ); + BBTK_DECLARE_INPUT(In6,std::vector ); + BBTK_DECLARE_INPUT(In7,std::vector ); + BBTK_DECLARE_INPUT(In8,std::vector ); + BBTK_DECLARE_INPUT(In9,std::vector ); + BBTK_DECLARE_INPUT(Type,int); + BBTK_DECLARE_OUTPUT(Out,std::vector ); + BBTK_PROCESS(Process); + void Process(); + + bool firsttime; + std::vector acum; + + double g(std::vector*v,unsigned int i,double defValue ); + void SumVector(std::vector *v,std::vector *vr); + void MinVector(std::vector *v,std::vector *vr); + void MaxVector(std::vector *v,std::vector *vr); + + +//===== +// 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(MathOperationVector,bbtk::AtomicBlackBox); + BBTK_NAME("MathOperationVector"); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("Out[i] = In0[i] In1[i] In2[i] ... In8[i] In9[i]"); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(MathOperationVector,In0,"Input vector 0",std::vector,""); + BBTK_INPUT(MathOperationVector,In1,"Input vector 1",std::vector,""); + BBTK_INPUT(MathOperationVector,In2,"Input vector 2",std::vector,""); + BBTK_INPUT(MathOperationVector,In3,"Input vector 3",std::vector,""); + BBTK_INPUT(MathOperationVector,In4,"Input vector 4",std::vector,""); + BBTK_INPUT(MathOperationVector,In5,"Input vector 5",std::vector,""); + BBTK_INPUT(MathOperationVector,In6,"Input vector 6",std::vector,""); + BBTK_INPUT(MathOperationVector,In7,"Input vector 7",std::vector,""); + BBTK_INPUT(MathOperationVector,In8,"Input vector 8",std::vector,""); + BBTK_INPUT(MathOperationVector,In9,"Input vector 9",std::vector,""); + BBTK_INPUT(MathOperationVector,Type,"Type (defalult 0): 0 adition (default) In0[i]+In1[i]+..+In9[i], -99 adition In0[i] In1[i] ... In[9], 1 sustraction In0[i]-In1[i]-..-In9[i], 2 multiplication In0[i]*In2[i]*...*In9[i], 3 divisiuon In0/In2/.../In9, 4 sqrt In1, 5 log10 In1, 6 exp In1, 7 incremental int [In0..In1], 8 random int [In0..In1], 9 (rad) sin In0, 10 (rad) cos In0, 11 tan (rad) In0, 12 asin In0, 13 acos In0, 14 atan In0, 15 atan2 In0 In1 , 16 min (In0[i],In1[i]..In9[i]), -16 min(In0) min(In1) ... min(In9) , 17 max (In0[i],In1[i]..In9[i]), -17 max(In0) max(In1) ... max(In9) , 18 abs In0 " ,int,""); + + BBTK_OUTPUT(MathOperationVector,Out,"Output vector",std::vector,""); + +BBTK_END_DESCRIBE_BLACK_BOX(MathOperationVector); +//===== +// 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 bbstd + +#endif // __bbstdMathOperationVector_h_INCLUDED__ + diff --git a/packages/std/src/bbstdReadColumnsInt.cxx b/packages/std/src/bbstdReadColumnsInt.cxx index 2d5443f..f33d735 100644 --- a/packages/std/src/bbstdReadColumnsInt.cxx +++ b/packages/std/src/bbstdReadColumnsInt.cxx @@ -71,7 +71,7 @@ void ReadColumnsInt::Process() } fclose(ff1); } else { // else ff1 - printf("bbcreaMaracasVisuReadAxisTree3D::Process ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() ); + printf("ReadColumnsDouble::Process ...Error... reading file FileName <%s>\n", bbGetInputFileName().c_str() ); } //ff1 i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); } diff --git a/packages/std/src/bbstdReplaceString.cxx b/packages/std/src/bbstdReplaceString.cxx new file mode 100644 index 0000000..c8ea640 --- /dev/null +++ b/packages/std/src/bbstdReplaceString.cxx @@ -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 "bbstdReplaceString.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReplaceString) +BBTK_BLACK_BOX_IMPLEMENTATION(ReplaceString,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 ReplaceString::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 = " < + +namespace bbstd +{ + +class bbstd_EXPORT ReplaceString + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ReplaceString,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,std::string); + BBTK_DECLARE_INPUT(Search,std::string); + BBTK_DECLARE_INPUT(Replace,std::string); + BBTK_DECLARE_OUTPUT(Out,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(ReplaceString,bbtk::AtomicBlackBox); + BBTK_NAME("ReplaceString"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(ReplaceString,In,"Input string",std::string,""); + BBTK_INPUT(ReplaceString,Search,"Searche sub string ",std::string,""); + BBTK_INPUT(ReplaceString,Replace,"Replace new string",std::string,""); + BBTK_OUTPUT(ReplaceString,Out,"Output string",std::string,""); +BBTK_END_DESCRIBE_BLACK_BOX(ReplaceString); +//===== +// 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 bbstd + +#endif // __bbstdReplaceString_h_INCLUDED__ + diff --git a/packages/std/src/bbstdSplitFilePathVector.cxx b/packages/std/src/bbstdSplitFilePathVector.cxx new file mode 100644 index 0000000..1885c11 --- /dev/null +++ b/packages/std/src/bbstdSplitFilePathVector.cxx @@ -0,0 +1,104 @@ +//===== +// 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 "bbstdSplitFilePathVector.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SplitFilePathVector) +BBTK_BLACK_BOX_IMPLEMENTATION(SplitFilePathVector,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 SplitFilePathVector::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() );nt +// std::cout << "Output value = " < LstPath; + std::vector LstFileName; + std::vector LstBaseName; + std::vector LstExtention; + + unsigned int i, size=bbGetInputIn().size(); + for (i=0;i); + BBTK_DECLARE_OUTPUT(Path,std::vector); + BBTK_DECLARE_OUTPUT(BaseName,std::vector); + BBTK_DECLARE_OUTPUT(Ext,std::vector); + BBTK_DECLARE_OUTPUT(FileName,std::vector); + BBTK_DECLARE_OUTPUT(Slash,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(SplitFilePathVector,bbtk::AtomicBlackBox); + BBTK_NAME("SplitFilePathVector"); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(SplitFilePathVector,In,"PathFileName",std::vector,""); + + BBTK_OUTPUT(SplitFilePathVector,Path,"Path",std::vector,""); + BBTK_OUTPUT(SplitFilePathVector,BaseName,"Base Name",std::vector,""); + BBTK_OUTPUT(SplitFilePathVector,Ext,"Extention",std::vector,""); + BBTK_OUTPUT(SplitFilePathVector,FileName,"File Name",std::vector,""); + BBTK_OUTPUT(SplitFilePathVector,Slash,"Slash Linux or Back slash Windows",std::string,""); + +BBTK_END_DESCRIBE_BLACK_BOX(SplitFilePathVector); +//===== +// 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 bbstd + +#endif // __bbstdSplitFilePathVector_h_INCLUDED__ + diff --git a/packages/std/src/bbstdStringWriter.cxx b/packages/std/src/bbstdStringWriter.cxx index ebaaf7e..13f1bbe 100644 --- a/packages/std/src/bbstdStringWriter.cxx +++ b/packages/std/src/bbstdStringWriter.cxx @@ -47,16 +47,16 @@ void StringWriter::Process() FILE *ff = fopen(bbGetInputFileName().c_str(),"w"); if (ff!=NULL) { - fprintf(ff,"%s \n",bbGetInputIn0().c_str()); - fprintf(ff,"%s \n",bbGetInputIn1().c_str()); - fprintf(ff,"%s \n",bbGetInputIn2().c_str()); - fprintf(ff,"%s \n",bbGetInputIn3().c_str()); - fprintf(ff,"%s \n",bbGetInputIn4().c_str()); - fprintf(ff,"%s \n",bbGetInputIn5().c_str()); - fprintf(ff,"%s \n",bbGetInputIn6().c_str()); - fprintf(ff,"%s \n",bbGetInputIn7().c_str()); - fprintf(ff,"%s \n",bbGetInputIn8().c_str()); - fprintf(ff,"%s \n",bbGetInputIn9().c_str()); + if (bbGetInputIn0()!="") { fprintf(ff,"%s \n",bbGetInputIn0().c_str()); } + if (bbGetInputIn1()!="") { fprintf(ff,"%s \n",bbGetInputIn1().c_str()); } + if (bbGetInputIn2()!="") { fprintf(ff,"%s \n",bbGetInputIn2().c_str()); } + if (bbGetInputIn3()!="") { fprintf(ff,"%s \n",bbGetInputIn3().c_str()); } + if (bbGetInputIn4()!="") { fprintf(ff,"%s \n",bbGetInputIn4().c_str()); } + if (bbGetInputIn5()!="") { fprintf(ff,"%s \n",bbGetInputIn5().c_str()); } + if (bbGetInputIn6()!="") { fprintf(ff,"%s \n",bbGetInputIn6().c_str()); } + if (bbGetInputIn7()!="") { fprintf(ff,"%s \n",bbGetInputIn7().c_str()); } + if (bbGetInputIn8()!="") { fprintf(ff,"%s \n",bbGetInputIn8().c_str()); } + if (bbGetInputIn9()!="") { fprintf(ff,"%s \n",bbGetInputIn9().c_str()); } fclose(ff); } } diff --git a/packages/std/src/bbstdTransposeVectors.cxx b/packages/std/src/bbstdTransposeVectors.cxx new file mode 100644 index 0000000..c126f00 --- /dev/null +++ b/packages/std/src/bbstdTransposeVectors.cxx @@ -0,0 +1,21 @@ +//===== +// 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 "bbstdTransposeVectors.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(TransposeVectors,bbtk::AtomicBlackBox); + +BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,TransposeVectors,int); +BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,TransposeVectors,float); +BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,TransposeVectors,double); +typedef std::string string; +BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,TransposeVectors,string); + + +} +// EO namespace bbstd + + diff --git a/packages/std/src/bbstdTransposeVectors.h b/packages/std/src/bbstdTransposeVectors.h new file mode 100644 index 0000000..3ebc049 --- /dev/null +++ b/packages/std/src/bbstdTransposeVectors.h @@ -0,0 +1,196 @@ +//===== +// 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 __bbstdTransposeVectors_h_INCLUDED__ +#define __bbstdTransposeVectors_h_INCLUDED__ +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ +template +class bbstd_EXPORT TransposeVectors + : + public bbtk::AtomicBlackBox +{ + BBTK_TEMPLATE_BLACK_BOX_INTERFACE(TransposeVectors,bbtk::AtomicBlackBox,T); + +//===== +// 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(In0,std::vector); + BBTK_DECLARE_INPUT(In1,std::vector); + BBTK_DECLARE_INPUT(In2,std::vector); + BBTK_DECLARE_INPUT(In3,std::vector); + BBTK_DECLARE_INPUT(In4,std::vector); + BBTK_DECLARE_INPUT(In5,std::vector); + BBTK_DECLARE_INPUT(In6,std::vector); + BBTK_DECLARE_INPUT(In7,std::vector); + BBTK_DECLARE_INPUT(In8,std::vector); + BBTK_DECLARE_INPUT(In9,std::vector); + BBTK_DECLARE_OUTPUT(Out0,std::vector); + BBTK_DECLARE_OUTPUT(Out1,std::vector); + BBTK_DECLARE_OUTPUT(Out2,std::vector); + BBTK_DECLARE_OUTPUT(Out3,std::vector); + BBTK_DECLARE_OUTPUT(Out4,std::vector); + BBTK_DECLARE_OUTPUT(Out5,std::vector); + BBTK_DECLARE_OUTPUT(Out6,std::vector); + BBTK_DECLARE_OUTPUT(Out7,std::vector); + BBTK_DECLARE_OUTPUT(Out8,std::vector); + BBTK_DECLARE_OUTPUT(Out9,std::vector); + BBTK_PROCESS(DoIt); + void DoIt(); +//===== +// 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_TEMPLATE_BLACK_BOX(TransposeVectors,bbtk::AtomicBlackBox); + BBTK_NAME("TransposeVector"+bbtk::HumanTypeName >()); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + + typedef std::vector Tvector; + BBTK_TEMPLATE_INPUT(TransposeVectors,In0,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In1,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In2,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In3,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In4,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In5,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In6,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In7,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In8,"Vector input",Tvector); + BBTK_TEMPLATE_INPUT(TransposeVectors,In9,"Vector input",Tvector); + + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out0,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out1,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out2,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out3,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out4,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out5,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out6,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out7,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out8,"Vector output",Tvector); + BBTK_TEMPLATE_OUTPUT(TransposeVectors,Out9,"Vector output",Tvector); + +BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(TransposeVectors); + + + //================================================================= + template + void TransposeVectors::DoIt() + { + unsigned int i,j; + std::vector tmpVec; + + std::vector out0; + std::vector out1; + std::vector out2; + std::vector out3; + std::vector out4; + std::vector out5; + std::vector out6; + std::vector out7; + std::vector out8; + std::vector out9; + + unsigned int jSize=0; + + unsigned int s0 = bbGetInputIn0().size(); + unsigned int s1 = bbGetInputIn1().size(); + unsigned int s2 = bbGetInputIn2().size(); + unsigned int s3 = bbGetInputIn3().size(); + unsigned int s4 = bbGetInputIn4().size(); + unsigned int s5 = bbGetInputIn5().size(); + unsigned int s6 = bbGetInputIn6().size(); + unsigned int s7 = bbGetInputIn7().size(); + unsigned int s8 = bbGetInputIn8().size(); + unsigned int s9 = bbGetInputIn9().size(); + + + if (s0>0) { jSize++; } + if (s1>0) { jSize++; } + if (s2>0) { jSize++; } + if (s3>0) { jSize++; } + if (s4>0) { jSize++; } + if (s5>0) { jSize++; } + if (s6>0) { jSize++; } + if (s7>0) { jSize++; } + if (s8>0) { jSize++; } + if (s9>0) { jSize++; } + + + for (j=0;j + void TransposeVectors::bbUserSetDefaultValues() + { + } + //================================================================= + template + void TransposeVectors::bbUserInitializeProcessing() + { + } + //================================================================= + template + void TransposeVectors::bbUserFinalizeProcessing() + { + } + //================================================================= + + + + + +//===== +// 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 bbstd + +#endif // __bbstdTransposeVectors_h_INCLUDED__ + diff --git a/packages/vtk/src/bbvtkTransform.cxx b/packages/vtk/src/bbvtkTransform.cxx index 7923cb5..84aaddf 100644 --- a/packages/vtk/src/bbvtkTransform.cxx +++ b/packages/vtk/src/bbvtkTransform.cxx @@ -67,6 +67,7 @@ namespace bbvtk { bbUserFinalizeProcessing(); result = vtkTransform::New(); + result->Update(); } // -------------------------------------------------------------- @@ -88,25 +89,27 @@ namespace bbvtk result->Concatenate( bbGetInputIn()->GetMatrix() ); } - if (bbGetInputScale().size()>=3) - { - result->Scale(bbGetInputScale()[0], bbGetInputScale()[1], bbGetInputScale()[2]); - } if ((bbGetInputTranslate().size()>=3) && (bbGetInputSpacing().size()>=3)) { double tx = bbGetInputTranslate()[0] * bbGetInputSpacing()[0]; double ty = bbGetInputTranslate()[1] * bbGetInputSpacing()[1]; double tz = bbGetInputTranslate()[2] * bbGetInputSpacing()[2]; +printf("Transform::Process() %f %f %f\n",tx, ty,tz); result->Translate(tx,ty,tz); } + if (bbGetInputScale().size()>=3) + { + result->Scale(bbGetInputScale()[0], bbGetInputScale()[1], bbGetInputScale()[2]); + } + if (bbGetInputRotateWXYZ().size()>=4) { result->RotateWXYZ(bbGetInputRotateWXYZ()[0],bbGetInputRotateWXYZ()[1], bbGetInputRotateWXYZ()[2], bbGetInputRotateWXYZ()[3]); } - result->Update(); + bbSetOutputOut(result); } diff --git a/packages/vtk/src/bbvtkTransform.h b/packages/vtk/src/bbvtkTransform.h index 9349b70..7bd2dd5 100644 --- a/packages/vtk/src/bbvtkTransform.h +++ b/packages/vtk/src/bbvtkTransform.h @@ -57,18 +57,21 @@ namespace bbvtk vtkTransform *result; }; - BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform,bbtk::AtomicBlackBox); +BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform,bbtk::AtomicBlackBox); BBTK_NAME("Transform"); BBTK_AUTHOR("InfoTeam CREATIS-LRMN"); BBTK_DESCRIPTION("vtkTransform"); BBTK_CATEGORY("math"); + BBTK_INPUT(Transform,In,"vtkTransform to be concatenate",vtkLinearTransform *,""); BBTK_INPUT(Transform,Scale,"vector with sx sy sz",std::vector,""); BBTK_INPUT(Transform,Translate,"vector with x y z",std::vector,""); BBTK_INPUT(Transform,Spacing,"vector with spacingX spacingY spacingZ",std::vector,""); BBTK_INPUT(Transform,RotateWXYZ,"vector with Angle Vx Vy Vz",std::vector,""); + BBTK_OUTPUT(Transform,Out,"vtkTransform result",vtkLinearTransform *,""); - BBTK_END_DESCRIBE_BLACK_BOX(Transform); + +BBTK_END_DESCRIBE_BLACK_BOX(Transform); } // EO namespace bbvtk diff --git a/packages/vtk/src/bbvtkUpdateRender.cxx b/packages/vtk/src/bbvtkUpdateRender.cxx index ac4d109..640aada 100644 --- a/packages/vtk/src/bbvtkUpdateRender.cxx +++ b/packages/vtk/src/bbvtkUpdateRender.cxx @@ -40,6 +40,9 @@ namespace bbvtk { if (bbGetInputRenderer()!=NULL) { bbGetInputRenderer()->GetRenderWindow()->Render(); +//EED 4 nov 2015 Estelle +// bbGetInputRenderer()->GradientBackgroundOff(); +// bbGetInputRenderer()->SetBackground( 0 , 0 , 0 ); } // Renderer } // Active } -- 2.44.0