// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Filters__RegionGrow__hxx__ #define __fpa__Filters__RegionGrow__hxx__ // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: SetPredicate( TScalarPredicate* p ) { if( this->m_ScalarPredicate.GetPointer( ) != p ) { this->_Deassociate( this->m_ScalarPredicate ); this->m_ScalarPredicate = p; this->_Associate( this->m_ScalarPredicate ); this->Modified( ); } // fi } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: SetPredicate( TVertexPredicate* p ) { if( this->m_VertexPredicate.GetPointer( ) != p ) { this->_Deassociate( this->m_VertexPredicate ); this->m_VertexPredicate = p; this->_Associate( this->m_VertexPredicate ); this->Modified( ); } // fi } // ------------------------------------------------------------------------- template< class _TTraits > typename fpa::Filters::RegionGrow< _TTraits >:: TOutputValue fpa::Filters::RegionGrow< _TTraits >:: GetOutsideValue( ) const { return( this->GetInitValue( ) ); } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: SetOutsideValue( const TOutputValue& v ) { this->SetInitValue( v ); } // ------------------------------------------------------------------------- template< class _TTraits > fpa::Filters::RegionGrow< _TTraits >:: RegionGrow( ) : Superclass( ), m_InsideValue( TOutputValue( 1 ) ) { this->SetOutsideValue( 0 ); } // ------------------------------------------------------------------------- template< class _TTraits > fpa::Filters::RegionGrow< _TTraits >:: ~RegionGrow( ) { } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: _UpdateOutputValue( TNode& n ) { TInputValue value = this->_GetInputValue( n ); bool inside = false; if( this->m_ScalarPredicate.IsNotNull( ) ) inside = this->m_ScalarPredicate->Evaluate( value ); if( this->m_VertexPredicate.IsNotNull( ) ) inside &= this->m_VertexPredicate->Evaluate( n.Vertex, n.Parent ); if( !inside ) { n.Value = this->GetOutsideValue( ); n.FrontId = 0; } else n.Value = this->GetInsideValue( ); } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: _QueueClear( ) { this->m_Queue.clear( ); } // ------------------------------------------------------------------------- template< class _TTraits > typename fpa::Filters::RegionGrow< _TTraits >:: TNode fpa::Filters::RegionGrow< _TTraits >:: _QueuePop( ) { TNode n = this->m_Queue.front( ); this->m_Queue.pop_front( ); return( n ); } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: _QueuePush( const TNode& n ) { this->m_Queue.push_back( n ); } // ------------------------------------------------------------------------- template< class _TTraits > unsigned long fpa::Filters::RegionGrow< _TTraits >:: _QueueSize( ) const { return( this->m_Queue.size( ) ); } // ------------------------------------------------------------------------- template< class _TTraits > void fpa::Filters::RegionGrow< _TTraits >:: _ComputeOutputValue( TNode& n ) { // Do nothing } #endif // __fpa__Filters__RegionGrow__hxx__ // eof - $RCSfile$