]> Creatis software - bbtk.git/blobdiff - packages/std/src/bbstdVectorFilterDouble.cxx
Clean code
[bbtk.git] / packages / std / src / bbstdVectorFilterDouble.cxx
index 812f6469d399f802bc97db34172ee1609e9789f3..88370e28fa392ebd62d14121e3afddb1f0a6323d 100644 (file)
@@ -77,36 +77,39 @@ void VectorFilterDouble::Process()
 
        if (bbGetInputType()==0)  // Erase duplicate lines
        {
-               bool okSizeVec=true;
-               int ipLstvec; 
-               for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
+               if (bbGetInputIn0().size()!=0)  // At least one element 
                {
-                       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++ ) 
+                       bool okSizeVec=true;
+                       int ipLstvec; 
+                       for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
                        {
-                               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) ) 
+                               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++ ) 
                                {
-                                       for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+                                       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) ) 
                                        {
-                                               (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
-                                       } // for
-                               } // if okLine
-                       } // for iLine
-               } // if okSizeVec
+                                               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
 
 
@@ -342,13 +345,11 @@ void VectorFilterDouble::Process()
        } // Type 9
 
 
-printf("EED VectorFilterDouble::Process() start\n");
-       if (bbGetInputType()==10)   // Invert vectors
+       if (bbGetInputType()==10)   // Nearest point in vector
        {
                int     sizeLstX        =       In0.size();   // lstX
                int     sizeLstY        =       In1.size();   // lstY
                int     sizeLstZ        =       In2.size();   // lstZ
-               printf("EED Warnning VectorFilterDouble::Process() %d  %d  %d  %d\n", sizeLstX,sizeLstY,sizeLstZ,In3.size() );
                if ( (sizeLstX==sizeLstY) && (sizeLstY==sizeLstZ) && (sizeLstX>0) && (In3.size()==3) )
                {
                        int i;
@@ -384,7 +385,6 @@ printf("EED VectorFilterDouble::Process() start\n");
                }// if size
        } // Type 10
 
-printf("EED VectorFilterDouble::Process() end\n");
 
 
        bbSetOutputOut0( Out0 );