X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FAlgorithm.hxx;h=26729aaa37e77fdad63c16d4d207fa7bf66e9ba7;hb=89393f2267e42e921571c0184320d6c6382f34ab;hp=383db743ad3f9ced6eb3c5c5152771978de9c5b0;hpb=3a438326c6901fafd9be8b5446a828aa5f63a1cc;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/Algorithm.hxx b/lib/fpa/Base/Algorithm.hxx index 383db74..26729aa 100644 --- a/lib/fpa/Base/Algorithm.hxx +++ b/lib/fpa/Base/Algorithm.hxx @@ -117,12 +117,14 @@ GenerateData( ) // Init objects this->_BeforeGenerateData( ); this->_ConfigureOutput( this->m_InitValue ); - this->_InitMarks( this->GetNumberOfSeeds( ) ); + this->_InitMarks( this->GetSeeds( ).size( ) ); + TNodes seeds = this->_UnifySeeds( ); + this->_PrepareSeeds( seeds ); // Init queue this->_QueueInit( ); - typename TSeeds::const_iterator sIt = this->BeginSeeds( ); - for( ; sIt != this->EndSeeds( ); ++sIt ) + typename TNodes::const_iterator sIt = seeds.begin( ); + for( ; sIt != seeds.end( ); ++sIt ) { this->_QueuePush( *sIt ); this->InvokeEvent( TEvent( sIt->Vertex, sIt->FrontId, true ) ); @@ -137,12 +139,13 @@ GenerateData( ) this->InvokeEvent( TEvent( node.Vertex, node.FrontId, false ) ); if( !( this->_IsMarked( node.Vertex ) ) ) { - // Mark it - if( this->_Mark( node.Vertex, node.FrontId ) ) - { - // Update output value - this->_UpdateOutputValue( node ); + // Update output value and mark vertex + this->_UpdateOutputValue( node ); + this->_Mark( node.Vertex, node.FrontId ); + // The actual node was effectively marked? + if( node.FrontId > 0 ) + { // Add neighborhood TNeighborhood neighbors = this->_GetNeighbors( node.Vertex ); typename TNeighborhood::const_iterator nIt = neighbors.begin( ); @@ -165,7 +168,7 @@ GenerateData( ) nnode.Vertex = *nIt; nnode.Parent = node.Vertex; nnode.FrontId = node.FrontId; - nnode.Value = this->_ComputeOutputValue( nnode ); + this->_ComputeOutputValue( nnode ); this->_QueuePush( nnode ); this->InvokeEvent( TEvent( nnode.Vertex, nnode.FrontId, true ) ); @@ -177,6 +180,7 @@ GenerateData( ) } // fi } // fi + this->_FinishOneLoop( ); } // elihw @@ -199,6 +203,13 @@ _AfterGenerateData( ) { } +// ------------------------------------------------------------------------- +template< class _TFilter, class _TMarksInterface, class _TSeedsInterface > +void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >:: +_FinishOneLoop( ) +{ +} + // ------------------------------------------------------------------------- template< class _TFilter, class _TMarksInterface, class _TSeedsInterface > void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::