--- /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 "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 = " <<bbGetOutputOut() << std::endl;
+
+ printf("EED SaveLstPoints::Process Start \n");
+ std::string filenameX;
+ std::string filenameY;
+ std::string filenameZ;
+ std::vector<int> lstIndexs = bbGetInputLstIndexs();
+ std::vector<double> lstParams = bbGetInputParams();
+ std::vector<double> lstX = bbGetInputLstX();
+ std::vector<double> lstY = bbGetInputLstY();
+ std::vector<double> 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<sizeParams; iParams++)
+ {
+ if (iParams<lstIndexs.size())
+ {
+ iAcum = 0;
+ size = lstParams[iParams];
+ for (ii=0; ii<size; ii++)
+ {
+ iAcum = iAcum+lstIndexs[ii];
+ } // for ii
+ // printf( "SaveLstPoints::Process %d %d\n", iAcum, lstIndexs[iParams]);
+ sizeLstPoints = lstIndexs[iParams];
+ filenameX = bbGetInputFileNameBase()+"-X-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
+ filenameY = bbGetInputFileNameBase()+"-Y-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
+ filenameZ = bbGetInputFileNameBase()+"-Z-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
+ ffx = fopen(filenameX.c_str(), "w+" );
+ ffy = fopen(filenameY.c_str(), "w+" );
+ ffz = fopen(filenameZ.c_str(), "w+" );
+ for (iPoint=0;iPoint<sizeLstPoints;iPoint++)
+ {
+ fprintf(ffx,"%f ", lstX[iPoint+iAcum]);
+ fprintf(ffy,"%f ", lstY[iPoint+iAcum]);
+ fprintf(ffz,"%f ", lstZ[iPoint+iAcum]);
+ } // for iPoint
+ fclose(ffx);
+ fclose(ffy);
+ fclose(ffz);
+ } // if iParams < lstIndexs.size()
+ } // for iParams
+ } // Type == O
+
+ printf("EED SaveLstPoints::Process End \n");
+
+}
+
+//=====
+// 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::bbUserSetDefaultValues()
+{
+ // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+ // Here we initialize the input 'In' to 0
+ bbSetInputType(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 SaveLstPoints::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 SaveLstPoints::bbUserFinalizeProcessing()
+{
+ // THE FINALIZATION METHOD BODY :
+ // Here does nothing
+ // but this is where you should desallocate the internal/output pointers
+ // if any
+}
+
+} // EO namespace bbstd
+
+
--- /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 __bbstdSaveLstPoints_h_INCLUDED__
+#define __bbstdSaveLstPoints_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT SaveLstPoints
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(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)
+//=====
+ BBTK_DECLARE_INPUT(FileNameBase,std::string);
+ BBTK_DECLARE_INPUT(LstX,std::vector<double>);
+ BBTK_DECLARE_INPUT(LstY,std::vector<double>);
+ BBTK_DECLARE_INPUT(LstZ,std::vector<double>);
+ BBTK_DECLARE_INPUT(LstIndexs,std::vector<int>);
+ BBTK_DECLARE_INPUT(Params,std::vector<double>);
+ 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<double>,"");
+ BBTK_INPUT(SaveLstPoints,LstY,"List of points in Y",std::vector<double>,"");
+ BBTK_INPUT(SaveLstPoints,LstZ,"List of points in Z",std::vector<double>,"");
+ BBTK_INPUT(SaveLstPoints,LstIndexs,"List of indexs",std::vector<int>,"");
+ BBTK_INPUT(SaveLstPoints,Params,"(default 0) 0:Param give the i-Lst to be exported",std::vector<double>,"");
+ 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__
+
} 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 );
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);
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
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<double>,"");
BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
bbSetOutputOut9( vOut9 );
}
+void VectorFilterString::InvertLists()
+{
+ std::vector<std::string> vOut0;
+ std::vector<std::string> vOut1;
+ std::vector<std::string> vOut2;
+ std::vector<std::string> vOut3;
+ std::vector<std::string> vOut4;
+ std::vector<std::string> vOut5;
+ std::vector<std::string> vOut6;
+ std::vector<std::string> vOut7;
+ std::vector<std::string> vOut8;
+ std::vector<std::string> 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()
{
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)
BBTK_DECLARE_OUTPUT(Out8,std::vector<std::string>);
BBTK_DECLARE_OUTPUT(Out9,std::vector<std::string>);
BBTK_PROCESS(Process);
- void Process();
-
-void ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut );
-void FilterByFindinIn0();
-void InsertStringPos();
-
-
+ void Process();
+ void ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *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)
//=====
BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector<std::string>,"");
BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector<std::string>,"");
BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector<std::string>,"");
- 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,"");
// * 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;
#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)