--- /dev/null
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Algorithm__hxx__
+#define __fpa__Image__Algorithm__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TMarks*
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+GetMarks( )
+{
+ dynamic_cast< TMarks* >(
+ this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+ );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+const typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TMarks*
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+GetMarks( ) const
+{
+ dynamic_cast< const TMarks* >(
+ this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+ );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+Algorithm( )
+ : Superclass( ),
+ m_NeigborhoodOrder( 1 )
+{
+ this->m_MarksIdx = this->GetNumberOfRequiredOutputs( );
+ this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MarksIdx + 1 );
+ this->SetNthOutput( this->m_MarksIdx, TMarks::New( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+~Algorithm( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_ConfigureOutput( const TOutputValue& v )
+{
+ const TInputImage* in = this->GetInput( );
+
+ TOutputImage* out = this->GetOutput( );
+ out->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+ out->SetRequestedRegion( in->GetRequestedRegion( ) );
+ out->SetBufferedRegion( in->GetBufferedRegion( ) );
+ out->SetSpacing( in->GetSpacing( ) );
+ out->SetOrigin( in->GetOrigin( ) );
+ out->SetDirection( in->GetDirection( ) );
+ out->Allocate( );
+ out->FillBuffer( v );
+
+ TMarks* marks = this->GetMarks( );
+ marks->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+ marks->SetRequestedRegion( in->GetRequestedRegion( ) );
+ marks->SetBufferedRegion( in->GetBufferedRegion( ) );
+ marks->SetSpacing( in->GetSpacing( ) );
+ marks->SetOrigin( in->GetOrigin( ) );
+ marks->SetDirection( in->GetDirection( ) );
+ marks->Allocate( );
+ marks->FillBuffer( TFrontId( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TNeighborhood fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_GetNeighbors( const TVertex& v ) const
+{
+ typename TInputImage::RegionType region =
+ this->GetInput( )->GetRequestedRegion( );
+ TNeighborhood neighborhood;
+ if( this->m_NeigborhoodOrder != 1 )
+ {
+ // TODO
+ }
+ else
+ {
+ for( unsigned int d = 0; d < TInputImage::ImageDimension; ++d )
+ {
+ for( int s = -1; s <= 1; s += 2 )
+ {
+ TVertex n = v;
+ n[ d ] += s;
+ if( region.IsInside( n ) )
+ neighborhood.push_back( n );
+
+ } // rof
+
+ } // rof
+
+ } // fi
+ return( neighborhood );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TInputValue
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_GetInputValue( const TVertex& v ) const
+{
+ return( this->GetInput( )->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TOutputValue fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_GetOutputValue( const TVertex& v ) const
+{
+ return( this->GetOutput( )->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_UpdateOutputValue( const TNode& n )
+{
+ this->GetOutput( )->SetPixel( n.Vertex, n.Value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+bool
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_IsMarked( const TVertex& v ) const
+{
+ return( this->GetMarks( )->GetPixel( v ) > 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+unsigned long
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_GetMark( const TVertex& v ) const
+{
+ return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+bool
+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__
+
+// eof - $RCSfile$