X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fstd%2Fsrc%2FbbstdVectorFilterString.cxx;h=350c845447159672ca955475dd9462cd12c19d8e;hb=0864b46768b25800120d16758b65abbf6f1412ff;hp=ee02ef6d2436fcfff7323b9e218aab7ebbe505a7;hpb=0476e60e846b03c8796cc74a1308b575cd3dcad6;p=bbtk.git diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx index ee02ef6..350c845 100644 --- a/packages/std/src/bbstdVectorFilterString.cxx +++ b/packages/std/src/bbstdVectorFilterString.cxx @@ -15,6 +15,40 @@ BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,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 VectorFilterString::CountConnectedRepetitions() +{ + 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; + ConnectionRepetitions( bbGetInputIn0() , &vOut0 ); + ConnectionRepetitions( bbGetInputIn1() , &vOut1 ); + ConnectionRepetitions( bbGetInputIn2() , &vOut2 ); + ConnectionRepetitions( bbGetInputIn3() , &vOut3 ); + ConnectionRepetitions( bbGetInputIn4() , &vOut4 ); + ConnectionRepetitions( bbGetInputIn5() , &vOut5 ); + ConnectionRepetitions( bbGetInputIn6() , &vOut6 ); + ConnectionRepetitions( bbGetInputIn7() , &vOut7 ); + ConnectionRepetitions( bbGetInputIn8() , &vOut8 ); + ConnectionRepetitions( bbGetInputIn9() , &vOut9 ); + bbSetOutputOut0( vOut0 ); + bbSetOutputOut1( vOut1 ); + bbSetOutputOut2( vOut2 ); + bbSetOutputOut3( vOut3 ); + bbSetOutputOut4( vOut4 ); + bbSetOutputOut5( vOut5 ); + bbSetOutputOut6( vOut6 ); + bbSetOutputOut7( vOut7 ); + bbSetOutputOut8( vOut8 ); + bbSetOutputOut9( vOut9 ); +} + void VectorFilterString::ConnectionRepetitions( std::vector vIn,std::vector *vOut ) { int i,size=vIn.size(); @@ -273,11 +307,107 @@ void VectorFilterString::SubString() } +void VectorFilterString::EraseDuplicateLines() +{ + std::vector< std::vector< std::string > * > pLstVec; + std::vector< std::vector< std::string > * > pLstVecOut; + std::vector< std::string > In0 = bbGetInputIn0(); + std::vector< std::string > In1 = bbGetInputIn1(); + std::vector< std::string > In2 = bbGetInputIn2(); + std::vector< std::string > In3 = bbGetInputIn3(); + std::vector< std::string > In4 = bbGetInputIn4(); + std::vector< std::string > In5 = bbGetInputIn5(); + std::vector< std::string > In6 = bbGetInputIn6(); + std::vector< std::string > In7 = bbGetInputIn7(); + std::vector< std::string > In8 = bbGetInputIn8(); + std::vector< std::string > In9 = bbGetInputIn9(); + if (bbGetInputIn0().size()!=0) { pLstVec.push_back( &In0 ); } + if (bbGetInputIn1().size()!=0) { pLstVec.push_back( &In1 ); } + if (bbGetInputIn2().size()!=0) { pLstVec.push_back( &In2 ); } + if (bbGetInputIn3().size()!=0) { pLstVec.push_back( &In3 ); } + if (bbGetInputIn4().size()!=0) { pLstVec.push_back( &In4 ); } + if (bbGetInputIn5().size()!=0) { pLstVec.push_back( &In5 ); } + if (bbGetInputIn6().size()!=0) { pLstVec.push_back( &In6 ); } + if (bbGetInputIn7().size()!=0) { pLstVec.push_back( &In7 ); } + if (bbGetInputIn8().size()!=0) { pLstVec.push_back( &In8 ); } + if (bbGetInputIn9().size()!=0) { pLstVec.push_back( &In9 ); } + std::vector< std::string > Out0; + std::vector< std::string > Out1; + std::vector< std::string > Out2; + std::vector< std::string > Out3; + std::vector< std::string > Out4; + std::vector< std::string > Out5; + std::vector< std::string > Out6; + std::vector< std::string > Out7; + std::vector< std::string > Out8; + std::vector< std::string > Out9; + pLstVecOut.push_back( &Out0 ); + pLstVecOut.push_back( &Out1 ); + pLstVecOut.push_back( &Out2 ); + pLstVecOut.push_back( &Out3 ); + pLstVecOut.push_back( &Out4 ); + pLstVecOut.push_back( &Out5 ); + pLstVecOut.push_back( &Out6 ); + pLstVecOut.push_back( &Out7 ); + pLstVecOut.push_back( &Out8 ); + pLstVecOut.push_back( &Out9 ); + std::string tmp1; + std::string tmp2; + if (bbGetInputIn0().size()!=0) // At least one element + { + bool okSizeVec=true; + int ipLstvec; + for (ipLstvec=1;ipLstvec 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; - ConnectionRepetitions( bbGetInputIn0() , &vOut0 ); - ConnectionRepetitions( bbGetInputIn1() , &vOut1 ); - ConnectionRepetitions( bbGetInputIn2() , &vOut2 ); - ConnectionRepetitions( bbGetInputIn3() , &vOut3 ); - ConnectionRepetitions( bbGetInputIn4() , &vOut4 ); - ConnectionRepetitions( bbGetInputIn5() , &vOut5 ); - ConnectionRepetitions( bbGetInputIn6() , &vOut6 ); - ConnectionRepetitions( bbGetInputIn7() , &vOut7 ); - ConnectionRepetitions( bbGetInputIn8() , &vOut8 ); - ConnectionRepetitions( bbGetInputIn9() , &vOut9 ); - bbSetOutputOut0( vOut0 ); - bbSetOutputOut1( vOut1 ); - bbSetOutputOut2( vOut2 ); - bbSetOutputOut3( vOut3 ); - bbSetOutputOut4( vOut4 ); - bbSetOutputOut5( vOut5 ); - bbSetOutputOut6( vOut6 ); - bbSetOutputOut7( vOut7 ); - bbSetOutputOut8( vOut8 ); - bbSetOutputOut9( vOut9 ); + CountConnectedRepetitions(); } if (bbGetInputType()==2) @@ -351,8 +452,10 @@ void VectorFilterString::Process() { SubString(); } - - + if ( (bbGetInputType()==8) || (bbGetInputType()==9) ) + { + EraseDuplicateLines(); + } } //===== // 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)