X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FAlgorithm.hxx;h=6e4eef139929c21ebb5fc22b182576067fde4b04;hb=40fb0405cfef444001429f8ba49c407ce9168a94;hp=ed7342130ba2389b6c64bbbac1dfc3208259ae01;hpb=cf298be2de026712c5ab3487978e3a6954a809cd;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Algorithm.hxx b/lib/fpa/Image/Algorithm.hxx index ed73421..6e4eef1 100644 --- a/lib/fpa/Image/Algorithm.hxx +++ b/lib/fpa/Image/Algorithm.hxx @@ -12,8 +12,7 @@ fpa::Image::Algorithm< _TInputImage, _TOutputImage >:: Algorithm( ) : Superclass( ) { - typedef itk::ImageBase< _TInputImage::ImageDimension > _TImageBase; - typedef fpa::Image::Functors::SimpleNeighborhood< _TImageBase > _TNeigh; + typedef fpa::Image::Functors::SimpleNeighborhood< _TInputImage::ImageDimension > _TNeigh; typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks; this->m_MarksIdx = this->GetNumberOfRequiredOutputs( ); @@ -47,6 +46,14 @@ _BeforeGenerateData( ) if( neighFunc == NULL ) itkExceptionMacro( << "NeighborhoodFunction not well defined." ); neighFunc->SetImage( this->GetInput( ) ); + + TVertexFunction* vertexFunc = + dynamic_cast< TVertexFunction* >( + this->GetVertexFunction( ) + ); + if( vertexFunc == NULL ) + itkExceptionMacro( << "VertexFunction not well defined." ); + vertexFunc->SetImage( this->GetInput( ) ); } // ------------------------------------------------------------------------- @@ -118,6 +125,26 @@ _UpdateResult( const _TQueueNode& n ) this->GetOutput( )->SetPixel( n.Vertex, n.Result ); } +// ------------------------------------------------------------------------- +template< class _TInputImage, class _TOutputImage > +typename fpa::Image::Algorithm< _TInputImage, _TOutputImage >::TOutput +fpa::Image::Algorithm< _TInputImage, _TOutputImage >:: +_GetResult( const TVertex& v ) const +{ + if( this->GetOutput( )->GetLargestPossibleRegion( ).IsInside( v ) ) + return( this->GetOutput( )->GetPixel( v ) ); + else + return( this->m_InitResult ); +} + +// ------------------------------------------------------------------------- +template< class _TInputImage, class _TOutputImage > +unsigned int fpa::Image::Algorithm< _TInputImage, _TOutputImage >:: +_GetNumberOfDimensions( ) const +{ + return( _TInputImage::ImageDimension ); +} + #endif // __fpa__Image__Algorithm__hxx__ // eof - $RCSfile$