From: Eduardo DAVILA Date: Thu, 8 Dec 2022 15:00:45 +0000 (+0100) Subject: #3492 SaveLstPoints X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bbf24c629edcb4780e121875bd4e5850f1565698;p=bbtk.git #3492 SaveLstPoints --- diff --git a/packages/std/src/bbstdSaveLstPoints.cxx b/packages/std/src/bbstdSaveLstPoints.cxx new file mode 100644 index 0000000..ed60e0f --- /dev/null +++ b/packages/std/src/bbstdSaveLstPoints.cxx @@ -0,0 +1,117 @@ +//===== +// 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 "bbstdSaveLstPoints.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SaveLstPoints) +BBTK_BLACK_BOX_IMPLEMENTATION(SaveLstPoints,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 SaveLstPoints::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 = " < lstIndexs = bbGetInputLstIndexs(); + std::vector lstParams = bbGetInputParams(); + std::vector lstX = bbGetInputLstX(); + std::vector lstY = bbGetInputLstY(); + std::vector lstZ = bbGetInputLstZ(); + if (bbGetInputType()==0) + { + FILE *ffx; + FILE *ffy; + FILE *ffz; + int iPoint,sizeLstPoints; + int iParams,sizeParams=lstParams.size(); + int ii,size,iAcum; + for (iParams=0; iParams); + BBTK_DECLARE_INPUT(LstY,std::vector); + BBTK_DECLARE_INPUT(LstZ,std::vector); + BBTK_DECLARE_INPUT(LstIndexs,std::vector); + BBTK_DECLARE_INPUT(Params,std::vector); + BBTK_DECLARE_INPUT(Type,int); +// BBTK_DECLARE_OUTPUT(Out,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(SaveLstPoints,bbtk::AtomicBlackBox); + BBTK_NAME("SaveLstPoints"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(SaveLstPoints,FileNameBase,"automatic add .pnt extention",std::string,""); + BBTK_INPUT(SaveLstPoints,LstX,"List of points in X",std::vector,""); + BBTK_INPUT(SaveLstPoints,LstY,"List of points in Y",std::vector,""); + BBTK_INPUT(SaveLstPoints,LstZ,"List of points in Z",std::vector,""); + BBTK_INPUT(SaveLstPoints,LstIndexs,"List of indexs",std::vector,""); + BBTK_INPUT(SaveLstPoints,Params,"(default 0) 0:Param give the i-Lst to be exported",std::vector,""); + BBTK_INPUT(SaveLstPoints,Type,"List of params",int,""); + +//BBTK_OUTPUT(SaveLstPoints,Out,"First output",double,""); + +BBTK_END_DESCRIBE_BLACK_BOX(SaveLstPoints); +//===== +// 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 // __bbstdSaveLstPoints_h_INCLUDED__ + diff --git a/packages/std/src/bbstdVectorFilterDouble.cxx b/packages/std/src/bbstdVectorFilterDouble.cxx index 9d59c39..95dae0a 100644 --- a/packages/std/src/bbstdVectorFilterDouble.cxx +++ b/packages/std/src/bbstdVectorFilterDouble.cxx @@ -469,10 +469,18 @@ void VectorFilterDouble::Process() } else { printf("EED Warnning VectorFilterDouble::Process() For Type 12 the K1 vector (spacing) is not coherent.\n"); }// if size + } // Type 12 - } // Type 11 - - + if (bbGetInputType()==13) // Distance point 3D between In0 and In1 + { + if ( In0.size()==3 and In1.size()==3) + { + double x = In0[0] - In1[0]; + double y = In0[1] - In1[1]; + double z = In0[2] - In1[2]; + Out0.push_back( sqrt( x*x +y*y +z*z ) ); + } + } // Type 13 bbSetOutputOut0( Out0 ); bbSetOutputOut1( Out1 ); @@ -485,12 +493,12 @@ void VectorFilterDouble::Process() bbSetOutputOut8( Out8 ); bbSetOutputOut9( Out9 ); } + //===== // 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 VectorFilterDouble::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputType(0); @@ -498,32 +506,29 @@ void VectorFilterDouble::bbUserSetDefaultValues() k1.push_back(0); bbSetInputk1(k1); } + //===== // 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 VectorFilterDouble::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 VectorFilterDouble::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - -} } -// EO namespace bbstd + +}// EO namespace bbstd diff --git a/packages/std/src/bbstdVectorFilterDouble.h b/packages/std/src/bbstdVectorFilterDouble.h index e807839..d012541 100644 --- a/packages/std/src/bbstdVectorFilterDouble.h +++ b/packages/std/src/bbstdVectorFilterDouble.h @@ -52,7 +52,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterDouble,bbtk::AtomicBlackBox); BBTK_AUTHOR("InfoDev"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing)",int,""); + BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1",int,""); BBTK_INPUT(VectorFilterDouble,k1,"(default [0]) nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6) , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11), k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) ",std::vector,""); BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector,""); BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector,""); diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx index 1cfa6a2..d7ceec8 100644 --- a/packages/std/src/bbstdVectorFilterString.cxx +++ b/packages/std/src/bbstdVectorFilterString.cxx @@ -116,6 +116,46 @@ void VectorFilterString::InsertStringPos() bbSetOutputOut9( vOut9 ); } +void VectorFilterString::InvertLists() +{ + std::vector vOut0; + std::vector vOut1; + std::vector vOut2; + std::vector vOut3; + std::vector vOut4; + std::vector vOut5; + std::vector vOut6; + std::vector vOut7; + std::vector vOut8; + std::vector vOut9; + int i,size = bbGetInputIn0().size(); +// std::string sk1 = bbGetInputsk1(); +// int pos = atoi( bbGetInputsk2().c_str() ); + for (i=size-1; i>=0; i--) + { + if ( i < bbGetInputIn0().size() ) { vOut0.push_back( bbGetInputIn0()[i] ); } + if ( i < bbGetInputIn1().size() ) { vOut1.push_back( bbGetInputIn1()[i] ); } + if ( i < bbGetInputIn2().size() ) { vOut2.push_back( bbGetInputIn2()[i] ); } + if ( i < bbGetInputIn3().size() ) { vOut3.push_back( bbGetInputIn3()[i] ); } + if ( i < bbGetInputIn4().size() ) { vOut4.push_back( bbGetInputIn4()[i] ); } + if ( i < bbGetInputIn5().size() ) { vOut5.push_back( bbGetInputIn5()[i] ); } + if ( i < bbGetInputIn6().size() ) { vOut6.push_back( bbGetInputIn6()[i] ); } + if ( i < bbGetInputIn7().size() ) { vOut7.push_back( bbGetInputIn7()[i] ); } + if ( i < bbGetInputIn8().size() ) { vOut8.push_back( bbGetInputIn8()[i] ); } + if ( i < bbGetInputIn9().size() ) { vOut9.push_back( bbGetInputIn9()[i] ); } + } // for i + bbSetOutputOut0( vOut0 ); + bbSetOutputOut1( vOut1 ); + bbSetOutputOut2( vOut2 ); + bbSetOutputOut3( vOut3 ); + bbSetOutputOut4( vOut4 ); + bbSetOutputOut5( vOut5 ); + bbSetOutputOut6( vOut6 ); + bbSetOutputOut7( vOut7 ); + bbSetOutputOut8( vOut8 ); + bbSetOutputOut9( vOut9 ); +} + void VectorFilterString::Process() @@ -179,6 +219,13 @@ void VectorFilterString::Process() { InsertStringPos(); } + + if (bbGetInputType()==4) + { + InvertLists(); + } + + } //===== // 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/packages/std/src/bbstdVectorFilterString.h b/packages/std/src/bbstdVectorFilterString.h index 1bccec2..87514f6 100644 --- a/packages/std/src/bbstdVectorFilterString.h +++ b/packages/std/src/bbstdVectorFilterString.h @@ -44,13 +44,11 @@ class bbstd_EXPORT VectorFilterString BBTK_DECLARE_OUTPUT(Out8,std::vector); BBTK_DECLARE_OUTPUT(Out9,std::vector); BBTK_PROCESS(Process); - void Process(); - -void ConnectionRepetitions( std::vector vIn,std::vector *vOut ); -void FilterByFindinIn0(); -void InsertStringPos(); - - + void Process(); + void ConnectionRepetitions( std::vector vIn,std::vector *vOut ); + void FilterByFindinIn0(); + void InsertStringPos(); + void InvertLists(); //===== // 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) //===== @@ -72,7 +70,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterString,bbtk::AtomicBlackBox); BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector,""); BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector,""); BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector,""); - BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium, 2: Select lines contain sk1 in In0 (the other intputs In1..In9 are afected, 3: insert string:sk1 in position:sk2 for all elements )",int,""); + BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium, 2: Select lines contain sk1 in In0 (the other intputs In1..In9 are afected, 3: insert string:sk1 in position:sk2 for all elements ), 4: Invert input lists",int,""); BBTK_INPUT(VectorFilterString,sk1,"constant 1",std::string,""); BBTK_INPUT(VectorFilterString,sk2,"constant 2",std::string,""); diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 2cdb383..2c75a26 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -53,15 +53,11 @@ void CreateImage::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - - int dim[3]; + int dim[3]; dim[0] = bbGetInputDimensions()[0]; dim[1] = bbGetInputDimensions()[1]; dim[2] = bbGetInputDimensions()[2]; - - - - if (imageoutput!=NULL) + if (imageoutput!=NULL) { imageoutput->Delete(); imageoutput = NULL; @@ -168,10 +164,8 @@ void CreateImage::Process() #endif imageoutput->Modified(); } // if dim = 0 - bbSetOutputOut(imageoutput); - -} +} //===== // 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)