// -------------------------------------------------------------------------
template< class _TSuperclass >
-fpa::Base::RegionGrow< _TSuperclass >::
-RegionGrow( )
- : Superclass( ),
- m_InsideValue( TOutput( 1 ) ),
- m_OutsideValue( TOutput( 0 ) )
+typename fpa::Base::RegionGrow< _TSuperclass >::
+TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
+GetGrowFunction( )
{
- this->m_InitResult = TOutput( 0 );
- this->SetGrowFunction(
- fpa::Base::Functors::RegionGrow::Tautology< TVertex >::New( )
+ return( dynamic_cast< TGrowFunction* >( this->GetVertexFunction( ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TSuperclass >
+const typename fpa::Base::RegionGrow< _TSuperclass >::
+TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
+GetGrowFunction( ) const
+{
+ return(
+ dynamic_cast< const TGrowFunction* >( this->GetVertexFunction( ) )
);
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
-fpa::Base::RegionGrow< _TSuperclass >::
-~RegionGrow( )
+typename fpa::Base::RegionGrow< _TSuperclass >::
+TOutput fpa::Base::RegionGrow< _TSuperclass >::
+GetInsideValue( ) const
{
+ const TGrowFunction* f = this->GetGrowFunction( );
+ if( f != NULL )
+ return( f->GetInsideValue( ) );
+ else
+ return( this->m_InitResult );
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
-bool fpa::Base::RegionGrow< _TSuperclass >::
-_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
+typename fpa::Base::RegionGrow< _TSuperclass >::
+TOutput fpa::Base::RegionGrow< _TSuperclass >::
+GetOutsideValue( ) const
{
- if( this->m_GrowFunction.IsNotNull( ) )
- {
- bool in = this->m_GrowFunction->Evaluate( p.Vertex, v.Vertex );
- v.Result = ( in )? this->m_InsideValue: this->m_OutsideValue;
- return( in );
- }
+ const TGrowFunction* f = this->GetGrowFunction( );
+ if( f != NULL )
+ return( f->GetOutsideValue( ) );
else
+ return( this->m_InitResult );
+}
+
+// -------------------------------------------------------------------------
+template< class _TSuperclass >
+void fpa::Base::RegionGrow< _TSuperclass >::
+SetGrowFunction( TGrowFunction* f )
+{
+ TGrowFunction* old_f = this->GetGrowFunction( );
+ if( old_f != NULL )
{
- v.Result = this->m_InitResult;
- return( false );
+ f->SetInsideValue( old_f->GetInsideValue( ) );
+ f->SetOutsideValue( old_f->GetOutsideValue( ) );
} // fi
+ this->SetVertexFunction( f );
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
-unsigned long fpa::Base::RegionGrow< _TSuperclass >::
-_QueueSize( ) const
+void fpa::Base::RegionGrow< _TSuperclass >::
+SetInsideValue( const TOutput& v )
{
- return( this->m_Queue.size( ) );
+ TGrowFunction* f = this->GetGrowFunction( );
+ if( f != NULL )
+ {
+ f->SetInsideValue( v );
+ this->Modified( );
+
+ } // fi
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
void fpa::Base::RegionGrow< _TSuperclass >::
-_QueueClear( )
+SetOutsideValue( const TOutput& v )
{
- while( this->m_Queue.size( ) > 0 )
- this->m_Queue.pop( );
+ TGrowFunction* f = this->GetGrowFunction( );
+ if( f != NULL )
+ {
+ f->SetOutsideValue( v );
+ this->Modified( );
+
+ } // fi
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
-void fpa::Base::RegionGrow< _TSuperclass >::
-_QueuePush( const _TQueueNode& node )
+fpa::Base::RegionGrow< _TSuperclass >::
+RegionGrow( )
+ : Superclass( )
{
- this->m_Queue.push( node );
+ typedef fpa::Base::Functors::RegionGrow::Tautology< TVertex, TOutput > _TFunc;
+ this->SetGrowFunction( _TFunc::New( ) );
+ this->m_InitResult = this->GetGrowFunction( )->GetOutsideValue( );
}
// -------------------------------------------------------------------------
template< class _TSuperclass >
-typename fpa::Base::RegionGrow< _TSuperclass >::
-_TQueueNode fpa::Base::RegionGrow< _TSuperclass >::
-_QueuePop( )
+fpa::Base::RegionGrow< _TSuperclass >::
+~RegionGrow( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TSuperclass >
+bool fpa::Base::RegionGrow< _TSuperclass >::
+_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
{
- _TQueueNode f = this->m_Queue.front( );
- this->m_Queue.pop( );
- return( f );
+ v.Result = this->_GetInputValue( v, p );
+ return( v.Result == this->GetInsideValue( ) );
}
#endif // __fpa__Base__RegionGrow__hxx__