]> Creatis software - bbtk.git/commitdiff
#3267 BBTK Feature New Normal - VectorFilterString Box
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Wed, 3 Jul 2019 14:23:05 +0000 (16:23 +0200)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Wed, 3 Jul 2019 14:23:05 +0000 (16:23 +0200)
packages/std/src/bbstdVectorFilterDouble.cxx
packages/std/src/bbstdVectorFilterDouble.h
packages/std/src/bbstdVectorFilterString.cxx
packages/std/src/bbstdVectorFilterString.h

index 9a948a85367b3884d62c19964248e2a20502f9bb..85dee1f9d0d11e21a6c1b8291c6d108fd90b549c 100644 (file)
@@ -197,7 +197,9 @@ void VectorFilterDouble::Process()
                } // for pLstVec                
        } // Type==5
 
-       if (bbGetInputType()==6) // Division  k1
+       if (bbGetInputType()==6) // Division  k1ng gadget (node check, owner GtkCheckButton)
+
+
        {
                int     ipLstvec;
                int     i;
@@ -220,6 +222,94 @@ void VectorFilterDouble::Process()
                } // for pLstVec                
        } // Type==6
 
+
+
+       if (bbGetInputType()==7) 
+       {
+               int i,j;
+               for (j=0;j<In4.size(); j++)
+               {
+                       Out0.push_back( In4[j] );
+                       Out1.push_back( In5[j] );
+                       Out2.push_back( In6[j] );
+               } //
+
+
+               int iGeneral=0,sizeI,sizeLst1Indexes=In3.size();
+               for (i=0; i<sizeLst1Indexes-1;i++) { iGeneral=iGeneral+In3[i]; }
+               sizeI=iGeneral+In3[ sizeLst1Indexes-1 ];
+
+               int jGeneral = 0;
+               int sizeJ        = In7[ 0 ];
+
+               double dist2,dist2Min,dx,dy,dz;
+               int iBack;
+
+               for (j=jGeneral;j<sizeJ;j++) 
+               {
+                       dist2Min=1000000;
+                       for (i=iGeneral;i<sizeI;i++) 
+                       {       
+                               dx              = In0[i]-In4[j];
+                               dy              = In1[i]-In5[j];
+                               dz              = In2[i]-In6[j];
+                               dist2           = dx*dx + dy*dy + dz*dz;
+                               if (dist2<dist2Min) 
+                               {
+                                               dist2Min=dist2;
+                                               iBack=i;
+                               } // if
+                       } // for j
+                       Out0[j]=In0[iBack]; 
+                       Out1[j]=In1[iBack]; 
+                       Out2[j]=In2[iBack]; 
+               } // for i
+
+
+       }       // Type 7
+
+
+
+       if (bbGetInputType()==8)   // order all vectors using as base the vector In0
+       {
+printf("EED VectorFilterDouble::Process Type 8 Start\n");
+               double tmp;
+               int i,j,ii,sizeII;
+               sizeII=pLstVec.size();
+
+
+               int size=In0.size();
+               for (i=0;i<size; i++)
+               {
+                       for (ii=0;ii<sizeII;ii++)
+                       {
+                                (*pLstVecOut[ii]).push_back( (*pLstVec[ii])[i] ); 
+                       } // for ii
+               } // i
+               for (i=0;i<size;i++)
+               {
+                       for (j=i;j<size;j++)
+                       {
+                               if ((*pLstVecOut[0])[j] <= (*pLstVecOut[0])[i] ) 
+                               {       
+                                       
+                                       for (ii=0;ii<sizeII;ii++)
+                                       {
+                                               tmp = (*pLstVecOut[ii])[i]; 
+                                               (*pLstVecOut[ii])[i] = (*pLstVecOut[ii])[j]; 
+                                               (*pLstVecOut[ii])[j] = tmp; 
+//                                             tmp=Out0[i]; Out0[i]=Out0[j]; Out0[j]=tmp; 
+                                       }
+                               }
+                       } // for j
+               } // for i
+printf("EED VectorFilterDouble::Process Type 8 End\n");
+
+       } // Type 8
+
+
+
+
        bbSetOutputOut0( Out0 );
        bbSetOutputOut1( Out1 );
        bbSetOutputOut2( Out2 );
index f3612ef205875227c7c53471106e0cb2113fe08c..a5d4b0fc7ec0bf012cbe1000b4ed0426499b934e 100644 (file)
@@ -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, 4=Substraction, 5=Multilication, 6=Division ",int,"");
+  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition, 4=Substraction, 5=Multilication, 6=Division, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 ",int,"");
   BBTK_INPUT(VectorFilterDouble,k1,"default (0)  nothing (Type0), k1=new size vectors (Type 1) , nothing (Type2), k1 = Addition const. (Type 3), k1 = Substraction const. (Type 4), k1 = Multiplication const. (Type 5) , k1 = Division const. (Type 6) ,  ",double,"");
   BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
index 23adb9d14197dfa08339e8b498f6eb526cbccb4c..7b5da8bb009aca6816f382b410a884c025785b5f 100644 (file)
@@ -31,6 +31,8 @@ void VectorFilterString::ConnectionRepetitions( std::vector<std::string> vIn,std
        vOut->push_back(std::to_string(acum));
 }
 
+
+
 void VectorFilterString::Process()
 {
 
@@ -83,7 +85,6 @@ void VectorFilterString::Process()
                bbSetOutputOut9( vOut9 );
        }
 
-       
 
 }
 //===== 
@@ -95,7 +96,8 @@ void VectorFilterString::bbUserSetDefaultValues()
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
    bbSetInputType(0);
-  
+   bbSetInputsk1("");
+   bbSetInputsk2("");
 }
 //===== 
 // 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)
index dd61882010a94acdb3a89589ed1c654197d84f0b..0856f6607a15cc1b4b09b5d47059a74c93e67129 100644 (file)
@@ -30,6 +30,8 @@ class bbstd_EXPORT VectorFilterString
   BBTK_DECLARE_INPUT(In8,std::vector<std::string>);
   BBTK_DECLARE_INPUT(In9,std::vector<std::string>);
   BBTK_DECLARE_INPUT(Type,int);
+  BBTK_DECLARE_INPUT(sk1,std::string);
+  BBTK_DECLARE_INPUT(sk2,std::string);
 
   BBTK_DECLARE_OUTPUT(Out0,std::vector<std::string>);
   BBTK_DECLARE_OUTPUT(Out1,std::vector<std::string>);
@@ -67,7 +69,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterString,bbtk::AtomicBlackBox);
   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",int,"");
+  BBTK_INPUT(VectorFilterString,Type,"(Default 0)  0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium",int,"");
+  BBTK_INPUT(VectorFilterString,sk1,"constant 1",std::string,"");
+  BBTK_INPUT(VectorFilterString,sk2,"constant 2",std::string,"");
 
   BBTK_OUTPUT(VectorFilterString,Out0,"First output",std::vector<std::string>,"");
   BBTK_OUTPUT(VectorFilterString,Out1,"First output",std::vector<std::string>,"");