// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Filters__RegionGrow__hxx__ #define __fpa__Filters__RegionGrow__hxx__ #include #include // ------------------------------------------------------------------------- template< class _TDataInterface > void fpa::Filters::RegionGrow< _TDataInterface >:: 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 _TDataInterface > void fpa::Filters::RegionGrow< _TDataInterface >:: 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 _TDataInterface > typename fpa::Filters::RegionGrow< _TDataInterface >:: TOutputValue fpa::Filters::RegionGrow< _TDataInterface >:: GetOutsideValue( ) const { return( this->GetInitValue( ) ); } // ------------------------------------------------------------------------- template< class _TDataInterface > void fpa::Filters::RegionGrow< _TDataInterface >:: SetOutsideValue( const TOutputValue& v ) { this->SetInitValue( v ); } // ------------------------------------------------------------------------- template< class _TDataInterface > fpa::Filters::RegionGrow< _TDataInterface >:: RegionGrow( ) : Superclass( false ) { this->SetOutsideValue( TOutputValue( 0 ) ); this->m_InsideValue = std::numeric_limits< TOutputValue >::max( ); this->SetPredicate( fpa::Functors::RegionGrow::Tautology< TInputValue >::New( ) ); } // ------------------------------------------------------------------------- template< class _TDataInterface > fpa::Filters::RegionGrow< _TDataInterface >:: ~RegionGrow( ) { } // ------------------------------------------------------------------------- template< class _TDataInterface > void fpa::Filters::RegionGrow< _TDataInterface >:: _PostComputeOutputValue( TNode& n ) { TInputValue value = this->_GetInputValue( n.Vertex ); 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 _TDataInterface > void fpa::Filters::RegionGrow< _TDataInterface >:: _PreComputeOutputValue( TNode& n ) { // Nothing to do with this algorithm } #endif // __fpa__Filters__RegionGrow__hxx__ // eof - $RCSfile$