]> Creatis software - bbtk.git/commitdiff
#3545 VectorFilterDouble option -1 : Erase line
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 24 Feb 2026 09:22:52 +0000 (10:22 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 24 Feb 2026 09:22:52 +0000 (10:22 +0100)
packages/std/src/bbstdVectorFilterDouble.cxx
packages/std/src/bbstdVectorFilterDouble.h

index ee0f1f4601d40ccd87194adfe07f9d4b3acf14bd..f4e0d69524c50f6d54e968c55f9812b7bfa8596f 100644 (file)
@@ -68,42 +68,85 @@ void VectorFilterDouble::Process()
        pLstVecOut.push_back( &Out7 );
        pLstVecOut.push_back( &Out8 );
        pLstVecOut.push_back( &Out9 );
-       if (bbGetInputType()==0)  // Erase duplicate lines
-       {
-               if (bbGetInputIn0().size()!=0)  // At least one element 
-               {
-                       bool okSizeVec=true;
-                       int ipLstvec; 
-                       for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
-                       {
-                               if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() )  { okSizeVec=false; }
-                       }
-                       if ( okSizeVec==false)
-                       {
-                               printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
-                       } else {
-                               int iLine;
-                               int ipLstvec2; 
-                               bool okLine;
-                               for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ ) 
-                               {
-                                       okLine=false;
-                                       for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
-                                       {
-                                               if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] )  { okLine=true; }
-                                       } // for ipLstVec2
-                                                       
-                                       if ( (okLine==true) || (iLine==0) ) 
-                                       {
-                                               for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
-                                               {
-                                                       (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
-                                               } // for
-                                       } // if okLine
-                               } // for iLine
-                       } // if okSizeVec
-               } // bbGetInputIn0()  size
-       } // Type==0
+    if (bbGetInputType()==-1)  // Erase lines if In0==k1
+    {
+        double k1 = bbGetInputk1()[0];
+        if (bbGetInputIn0().size()!=0)  // At least one element
+        {
+            bool okSizeVec=true;
+            int ipLstvec;
+            for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
+            {
+                if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() )  { okSizeVec=false; }
+            }
+            if ( okSizeVec==false)
+            {
+                printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
+            } else {
+                int iLine;
+                int ipLstvec2;
+                bool okLine;
+                for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ )
+                {
+                    okLine=false;
+                    
+                    if ( (*pLstVec[0])[iLine]!=k1 )
+                    {
+                        okLine=true;
+                    }
+//                    for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+//                    {
+//                        if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] )  { okLine=true; }
+//                    } // for ipLstVec2
+                            
+                    if ( (okLine==true) || (iLine==0) )
+                    {
+                        for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+                        {
+                            (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
+                        } // for
+                    } // if okLine
+                } // for iLine
+            } // if okSizeVec
+        } // bbGetInputIn0()  size
+    } // Type==0
+    
+    if (bbGetInputType()==0)  // Erase duplicate lines
+    {
+        if (bbGetInputIn0().size()!=0)  // At least one element
+        {
+            bool okSizeVec=true;
+            int ipLstvec;
+            for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
+            {
+                if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() )  { okSizeVec=false; }
+            }
+            if ( okSizeVec==false)
+            {
+                printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
+            } else {
+                int iLine;
+                int ipLstvec2;
+                bool okLine;
+                for (iLine=1 ; iLine < (*pLstVec[0]).size() ; iLine++ )
+                {
+                    okLine=false;
+                    for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+                    {
+                        if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] )  { okLine=true; }
+                    } // for ipLstVec2
+                            
+                    if ( (okLine==true) || (iLine==0) )
+                    {
+                        for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+                        {
+                            (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
+                        } // for
+                    } // if okLine
+                } // for iLine
+            } // if okSizeVec
+        } // bbGetInputIn0()  size
+    } // Type==0
        if (bbGetInputType()==1) // Resize vector
        {
                int             ipLstvec2;
index 68a94715893646caeb9c7b16f9e47df4c46ff930..ace9b2c27b4092a3d07b0441e0d5ba5e448d35ad 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 consecutive 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 (or the index k1 if exist) , 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,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k1=2 xz , 16 switch In0 and In1 (k1=0 nothing, k1=1 swhich)",int,"");
+  BBTK_INPUT(VectorFilterDouble,Type,"default (0) -1=Erase line if In0==k1,  0=Erase consecutive 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 (or the index k1 if exist) , 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,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k1=2 xz , 16 switch In0 and In1 (k1=0 nothing, k1=1 swhich)",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[0] In0..9 element base to be order (Type 8)  , 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) , k1[segment1, segment2,..] (type 14) , direction (type 15), direction (type 16) ",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");