X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FRegionGrowWithMultipleCriteria.hxx;h=0fd4378c5fbabef49d5cd827d25e44bcfcd927d6;hb=5b7ed1fdb6665dd1ebc4451062a5032d75597e4a;hp=34420b24ad029a8e3164486082e632def436e652;hpb=2479b55370fe1bec58d94faa3cc268bac419f6d6;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx b/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx index 34420b2..0fd4378 100644 --- a/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx +++ b/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx @@ -45,25 +45,46 @@ fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: // ------------------------------------------------------------------------- template< class V, class R, class VV, class VC, class B > void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: -_BeforeLoop( ) +_BeforeMainLoop( ) { - this->_BeforeLoop( ); + this->Superclass::_BeforeMainLoop( ); this->m_ActualFunction = this->m_Functions.begin( ); } // ------------------------------------------------------------------------- template< class V, class R, class VV, class VC, class B > -typename fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: -_TNode fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: -_QueuePop( ) +void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: +_AfterLoop( ) { - _TNode node = this->Superclass::_QueuePop( ); - if( this->_IsQueueEmpty( ) ) + this->Superclass::_AfterLoop( ); + + // Replace queue + this->_QueueClear( ); + while( !( this->m_AuxiliaryQueue.empty( ) ) ) { - std::cerr << "ERROR!!!!" << std::endl; + // Get node + _TNode node = this->m_AuxiliaryQueue.front( ); + this->m_AuxiliaryQueue.pop( ); + this->_QueuePush( node ); + + // Unmark it + typename _TMarks::iterator mIt = this->m_Marks.find( node.Vertex ); + if( mIt != this->m_Marks.end( ) ) + this->m_Marks.erase( mIt ); + + } // elihw + + // Move to next function + this->m_ActualFunction++; +} - } // fi - return( node ); +// ------------------------------------------------------------------------- +template< class V, class R, class VV, class VC, class B > +void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: +_Loop( ) +{ + while( this->m_ActualFunction != this->m_Functions.end( ) ) + this->Superclass::_Loop( ); } // ------------------------------------------------------------------------- @@ -71,10 +92,15 @@ template< class V, class R, class VV, class VC, class B > bool fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >:: _CheckMembership( const _TNode& n ) const { - bool ret = ( *( this->m_ActualFunction ) )->Evaluate( n.Vertex ); - if( !ret ) - this->m_AuxiliaryQueue.push( n ); - return( ret ); + if( this->m_ActualFunction != this->m_Functions.end( ) ) + { + bool ret = ( *( this->m_ActualFunction ) )->Evaluate( n.Vertex ); + if( !ret ) + this->m_AuxiliaryQueue.push( n ); + return( ret ); + } + else + return( false ); } #endif // __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__HXX__