X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrow.hxx;h=09fe59a726de35fa761af02f636317ee09db42f6;hb=c370699e769d8db284c58534c7a45f11dc9fb8b3;hp=9e7bb7b801276b1db0a853c042f3ce1cdc77c1c7;hpb=617f49bff4a6db5ed51b4f767c3634d1915fdced;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrow.hxx b/lib/fpa/Base/RegionGrow.hxx index 9e7bb7b..09fe59a 100644 --- a/lib/fpa/Base/RegionGrow.hxx +++ b/lib/fpa/Base/RegionGrow.hxx @@ -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( );