- // Get next candidate
- _TNode node = q.front( );
- q.pop( );
- if( this->_IsMarked( node.first ) )
- continue;
- this->_Mark( node.first, node.second );
-
- // Apply inclusion predicate
- TInputValue value = this->_GetInputValue( node.first );
- bool inside = false;
- if( this->m_IntensityFunctor.IsNotNull( ) )
- inside = this->m_IntensityFunctor->Evaluate( value );
- if( this->m_VertexFunctor.IsNotNull( ) )
- inside &= this->m_VertexFunctor->Evaluate( node.first );
- if( !inside )
- continue;
-
- // Ok, pixel lays inside region
- this->_SetOutputValue( node.first, this->m_InsideValue );
-
- // Add neighborhood
- TVertices neighbors = this->_GetNeighbors( node.first );
- for( TVertex neigh: neighbors )
- {
- if( this->_IsMarked( neigh ) )
- {
- // Invoke stop at collisions
- unsigned long nColl = this->_Collisions( node.first, neigh );
- if(
- this->StopAtOneFront( ) &&
- this->GetNumberOfSeeds( ) > 1 &&
- nColl == 1
- )
- while( q.size( ) > 0 )
- q.pop( );
- }
- else
- q.push( _TNode( neigh, node.second ) );
-
- } // rof
-
- } // elihw
- this->_FreeMarks( );
+ n.Value = this->m_InitValue;
+ n.FrontId = 0;
+ }
+ else
+ n.Value = this->m_InsideValue;
+ this->Superclass::_UpdateOutputValue( n );
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_QueueClear( )
+{
+ this->m_Queue.clear( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+typename fpa::Base::RegionGrow< _TAlgorithm >::
+TNode fpa::Base::RegionGrow< _TAlgorithm >::
+_QueuePop( )
+{
+ TNode n = this->m_Queue.front( );
+ this->m_Queue.pop_front( );
+ return( n );
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_QueuePush( const TNode& node )
+{
+ this->m_Queue.push_back( node );
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+unsigned long fpa::Base::RegionGrow< _TAlgorithm >::
+_QueueSize( ) const
+{
+ return( this->m_Queue.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_PrepareSeeds( TNodes& nodes )
+{
+ typename TNodes::iterator nIt = nodes.begin( );
+ for( ; nIt != nodes.end( ); ++nIt )
+ nIt->Value = this->m_InitValue;