// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #ifndef __cpExtensions__Algorithms__ImageFunctorFilter__hxx__ #define __cpExtensions__Algorithms__ImageFunctorFilter__hxx__ #include #include #include // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > cpExtensions::Algorithms::ImageFunctorFilter< _TInputImage, _TOutputImage >:: ImageFunctorFilter( ) : Superclass( ) { } // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > cpExtensions::Algorithms::ImageFunctorFilter< _TInputImage, _TOutputImage >:: ~ImageFunctorFilter( ) { } // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > void cpExtensions::Algorithms::ImageFunctorFilter< _TInputImage, _TOutputImage >:: ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId ) { // Configure data for this thread const typename TRegion::SizeType& regionSize = region.GetSize( ); if( regionSize[ 0 ] == 0 ) return; const TInputImage* in = this->GetInput( ); TOutputImage* out = this->GetOutput( 0 ); const size_t nLines = region.GetNumberOfPixels( ) / regionSize[ 0 ]; itk::ProgressReporter progress( this, threadId, nLines ); // Iterate over this region itk::ImageScanlineConstIterator< TInputImage > iIt( in, region ); itk::ImageScanlineIterator< TOutputImage > oIt( out, region ); iIt.GoToBegin( ); oIt.GoToBegin( ); while( !iIt.IsAtEnd( ) ) { while( !iIt.IsAtEndOfLine( ) ) { oIt.Set( this->m_Functor->Evaluate( iIt.Get( ) ) ); ++iIt; ++oIt; } // elihw iIt.NextLine( ); oIt.NextLine( ); progress.CompletedPixel( ); } // elihw } #endif // __cpExtensions__Algorithms__ImageFunctorFilter__hxx__ // eof - $RCSfile$