X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FFilters%2FImage%2FAlgorithm.hxx;fp=lib%2Ffpa%2FFilters%2FImage%2FAlgorithm.hxx;h=0000000000000000000000000000000000000000;hb=a8ac405fe1422bc0792a810f7f0693096a22c20e;hp=5095992770ae9b394999764a0ff8b113e1b7dd63;hpb=8abe87eaa0d29ba667d5cbf35f4ca1ca2e38c6c4;p=FrontAlgorithms.git diff --git a/lib/fpa/Filters/Image/Algorithm.hxx b/lib/fpa/Filters/Image/Algorithm.hxx deleted file mode 100644 index 5095992..0000000 --- a/lib/fpa/Filters/Image/Algorithm.hxx +++ /dev/null @@ -1,137 +0,0 @@ -// ========================================================================= -// @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$