virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
- virtual bool _ComputeOutputValue( TNode& n ) = 0;
- virtual void _UpdateOutputValue( const TNode& n ) = 0;
+ virtual void _ComputeOutputValue( TNode& n ) = 0;
+ virtual void _UpdateOutputValue( TNode& n ) = 0;
virtual void _QueueClear( ) = 0;
virtual void _QueuePush( const TNode& node ) = 0;
virtual unsigned long _QueueSize( ) const = 0;
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( );
nnode.Vertex = *nIt;
nnode.Parent = node.Vertex;
nnode.FrontId = node.FrontId;
- if( this->_ComputeOutputValue( nnode ) )
- {
- this->_QueuePush( nnode );
- this->InvokeEvent( TEvent( nnode.Vertex, nnode.FrontId, true ) );
-
- } // fi
+ this->_ComputeOutputValue( nnode );
+ this->_QueuePush( nnode );
+ this->InvokeEvent( TEvent( nnode.Vertex, nnode.FrontId, true ) );
} // fi
++nIt;
virtual bool _IsMarked( const TVertex& v ) const = 0;
virtual unsigned long _GetMark( const TVertex& v ) const = 0;
- virtual bool _Mark( const TVertex& v, unsigned long frontId ) = 0;
+ virtual void _Mark( const TVertex& v, unsigned long frontId ) = 0;
virtual void _InitMarks( unsigned long nSeeds );
virtual bool _Collisions( const TVertex& a, const TVertex& b );
virtual void _BeforeGenerateData( ) override;
virtual void _AfterGenerateData( ) override;
virtual void _FinishOneLoop( ) override;
- virtual bool _ComputeOutputValue( TNode& n ) override;
+ virtual void _ComputeOutputValue( TNode& n ) override;
+ virtual void _UpdateOutputValue( TNode& n ) override;
virtual void _QueueClear( ) override;
virtual TNode _QueuePop( ) override;
virtual void _QueuePush( const TNode& node ) override;
std::cout << int( sIt->first ) << " " << int( sIt->second.first ) << " " << sIt->second.second << std::endl;
} // rof
- std::cerr << ( this->m_CurrentThreshold != this->m_Thresholds.end( ) ) << std::endl;
}
// -------------------------------------------------------------------------
{
this->m_Signal[ this->m_Signal.size( ) + 1 ] =
TSignalData( *this->m_CurrentThreshold, this->m_Count );
- std::cerr << *( this->m_CurrentThreshold ) << std::endl;
this->m_CurrentThreshold++;
this->m_CurrentQueue = ( this->m_CurrentQueue + 1 ) % 2;
if( this->m_CurrentThreshold != this->m_Thresholds.end( ) )
// -------------------------------------------------------------------------
template< class _TAlgorithm >
-bool fpa::Base::Mori< _TAlgorithm >::
+void fpa::Base::Mori< _TAlgorithm >::
_ComputeOutputValue( TNode& n )
+{
+ // Do nothing!!!
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::Mori< _TAlgorithm >::
+_UpdateOutputValue( TNode& n )
{
TInputValue value = this->_GetInputValue( n.Vertex );
bool inside = this->m_Predicate->Evaluate( value );
- n.Value = this->m_InsideValue;
if( !inside )
{
+ n.Value = this->m_InitValue;
n.FrontId++;
this->m_Queues[ ( this->m_CurrentQueue + 1 ) % 2 ].push_back( n );
+ n.FrontId = 0;
}
else
+ {
+ n.Value = this->m_InsideValue;
this->m_Count++;
- return( inside );
+
+ } // fi
+ this->Superclass::_UpdateOutputValue( n );
}
-
+
// -------------------------------------------------------------------------
template< class _TAlgorithm >
void fpa::Base::Mori< _TAlgorithm >::
{
typename TNodes::iterator nIt = nodes.begin( );
for( ; nIt != nodes.end( ); ++nIt )
- nIt->Value = this->m_InsideValue;
+ nIt->Value = this->m_InitValue;
}
#endif // __fpa__Base__Mori__hxx__
RegionGrow( );
virtual ~RegionGrow( );
- virtual bool _ComputeOutputValue( TNode& n ) override;
+ virtual void _ComputeOutputValue( TNode& n ) override;
+ virtual void _UpdateOutputValue( TNode& n ) override;
virtual void _QueueClear( ) override;
virtual TNode _QueuePop( ) override;
virtual void _QueuePush( const TNode& node ) override;
// -------------------------------------------------------------------------
template< class _TAlgorithm >
-bool fpa::Base::RegionGrow< _TAlgorithm >::
+void fpa::Base::RegionGrow< _TAlgorithm >::
_ComputeOutputValue( TNode& n )
+{
+ // Do nothing!!!
+}
+
+// -------------------------------------------------------------------------
+template< class _TAlgorithm >
+void fpa::Base::RegionGrow< _TAlgorithm >::
+_UpdateOutputValue( TNode& n )
{
TInputValue value = this->_GetInputValue( n.Vertex );
bool inside = false;
inside = this->m_ValuePredicate->Evaluate( value );
if( this->m_VertexPredicate.IsNotNull( ) )
inside &= this->m_VertexPredicate->Evaluate( n.Vertex );
- n.Value = ( inside )? this->m_InsideValue: this->m_InitValue;
- return( inside );
+ if( !inside )
+ {
+ n.Value = this->m_InitValue;
+ n.FrontId = 0;
+ }
+ else
+ n.Value = this->m_InsideValue;
+ this->Superclass::_UpdateOutputValue( n );
}
// -------------------------------------------------------------------------
{
typename TNodes::iterator nIt = nodes.begin( );
for( ; nIt != nodes.end( ); ++nIt )
- nIt->Value = this->m_InsideValue;
+ nIt->Value = this->m_InitValue;
}
#endif // __fpa__Base__RegionGrow__hxx__
virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
virtual TInputValue _GetInputValue( const TVertex& v ) const override;
virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
- virtual void _UpdateOutputValue( const TNode& n ) override;
+ virtual void _UpdateOutputValue( TNode& n ) override;
virtual bool _IsMarked( const TVertex& v ) const override;
virtual unsigned long _GetMark( const TVertex& v ) const override;
- virtual bool _Mark( const TVertex& v, unsigned long frontId ) override;
+ virtual void _Mark( const TVertex& v, unsigned long frontId ) override;
private:
// Purposely not implemented.
template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
void
fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-_UpdateOutputValue( const TNode& n )
+_UpdateOutputValue( TNode& n )
{
this->GetOutput( )->SetPixel( n.Vertex, n.Value );
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-bool
+void
fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
_Mark( const TVertex& v, unsigned long frontId )
{
this->GetMarks( )->SetPixel( v, TFrontId( frontId ) );
- return( true );
}
#endif // __fpa__Image__Algorithm__hxx__
filter->SetOutsideValue( 0 );
// Get all seeds
- for( int i = 6; i < argc; i += 2 )
+ for( int i = 5; i < argc; i += 2 )
{
if( i + 1 < argc )
{