]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrow.hxx
...
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrow.hxx
index 9e7bb7b801276b1db0a853c042f3ce1cdc77c1c7..09fe59a726de35fa761af02f636317ee09db42f6 100644 (file)
@@ -91,8 +91,9 @@ GenerateData( )
   typedef std::pair< TVertex, unsigned long > _TNode;
   std::queue< _TNode > q;
   unsigned long frontId = 1;
-  for( TVertex seed: this->GetSeeds( ) )
-    q.push( _TNode( seed, frontId++ ) );
+  typename TSeedsInterface::TSeeds::const_iterator sIt = this->BeginSeeds( );
+  for( ; sIt != this->EndSeeds( ); ++sIt )
+    q.push( _TNode( *sIt, frontId++ ) );
 
   // Main loop
   while( q.size( ) > 0 )
@@ -119,8 +120,11 @@ GenerateData( )
 
     // Add neighborhood
     TVertices neighbors = this->_GetNeighbors( node.first );
-    for( TVertex neigh: neighbors )
+    typename TVertices::const_iterator neighIt = neighbors.begin( );
+    bool coll = false;
+    while( neighIt != neighbors.end( ) && !coll )
     {
+      TVertex neigh = *neighIt;
       if( this->_IsMarked( neigh ) )
       {
         // Invoke stop at collisions
@@ -130,13 +134,18 @@ GenerateData( )
           this->GetNumberOfSeeds( ) > 1 &&
           nColl == 1
           )
+        {
           while( q.size( ) > 0 )
             q.pop( );
+          coll = true;
+
+        } // fi
       }
       else
         q.push( _TNode( neigh, node.second ) );
+      ++neighIt;
 
-    } // rof
+    } // elihw
 
   } // elihw
   this->_FreeMarks( );