+++ /dev/null
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-#ifndef __fpa__Filters__Image__Algorithm__hxx__
-#define __fpa__Filters__Image__Algorithm__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-Algorithm( )
- : Superclass( ),
- m_NeighborhoodOrder( 1 )
-{
- fpaFilterOutputConfigureMacro( Marks, TMarksImage );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-~Algorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_ConfigureOutputs( )
-{
- 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( this->GetInitValue( ) );
-
- TMarksImage* 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( TMark( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-TInputValue fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_GetInputValue( const TVertex& v ) const
-{
- return( this->GetInput( )->GetPixel( v ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-TOutputValue fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_GetOutputValue( const TVertex& v ) const
-{
- return( this->GetOutput( )->GetPixel( v ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-TNeighborhood fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_GetNeighbors( const TVertex& v ) const
-{
- typename TInputImage::RegionType region =
- this->GetInput( )->GetRequestedRegion( );
- TNeighborhood neighborhood;
- if( this->m_NeighborhoodOrder == 1 )
- {
- for( unsigned int d = 0; d < Self::Dimension; ++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
- }
- else if( this->m_NeighborhoodOrder == 2 )
- {
- // TODO
-
- } // fi
- return( neighborhood );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_UpdateOutputValue( TNode& n )
-{
- this->Superclass::_UpdateOutputValue( n );
- this->GetOutput( )->SetPixel( n.Vertex, n.Value );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-unsigned long fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_GetMark( const TVertex& v ) const
-{
- return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-bool fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_IsMarked( const TVertex& v ) const
-{
- return( this->GetMarks( )->GetPixel( v ) != TMark( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TBaseAlgorithm >
-void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
-_Mark( const TVertex& v, unsigned long m )
-{
- this->GetMarks( )->SetPixel( v, TMark( m ) );
-}
-
-#endif // __fpa__Filters__Image__Algorithm__hxx__
-// eof - $RCSfile$