X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FRegionGrow.h;h=e20f062e07cf6c2563da1533437ed969bb2f4207;hb=b70a564ee2d7bc180b77a05c37ab431ab9c393e7;hp=d65fa6cbbe815e9a3b3c21a290cc18357cec4421;hpb=9622bd5b833a8845881003228207e0caca59b081;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/RegionGrow.h b/lib/fpa/Image/RegionGrow.h index d65fa6c..e20f062 100644 --- a/lib/fpa/Image/RegionGrow.h +++ b/lib/fpa/Image/RegionGrow.h @@ -1,9 +1,8 @@ #ifndef __FPA__IMAGE__REGIONGROW__H__ #define __FPA__IMAGE__REGIONGROW__H__ -#include +#include #include -#include #include #include @@ -13,62 +12,55 @@ namespace fpa { /** * @param I Input image type + * @param O Output image type */ - template< class I > + template< class I, class O > class RegionGrow - : public Algorithm< I, fpa::Base::RegionGrow< typename I::IndexType, typename I::PixelType, typename I::PixelType, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, I > > > + : public Algorithm< I, O, fpa::Base::RegionGrow< typename I::IndexType, typename I::PixelType, typename O::PixelType, itk::ImageToImageFilter< I, O > > > { public: - // Standard class typdedefs - typedef typename I::IndexType TVertex; - typedef typename I::PixelType TResult; - typedef typename I::PixelType TVertexValue; - typedef itk::ImageToImageFilter< I, I > TBaseFilter; - typedef fpa::Base::RegionGrow< TVertex, TResult, TVertexValue, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, TBaseFilter > TBaseAlgorithm; + typedef fpa::Base::RegionGrow< typename I::IndexType, typename I::PixelType, typename O::PixelType, itk::ImageToImageFilter< I, O > > TBaseAlgorithm; - typedef RegionGrow Self; - typedef Algorithm< I, TBaseAlgorithm > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef RegionGrow Self; + typedef Algorithm< I, O, TBaseAlgorithm > Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; - typedef itk::ImageFunction< I, bool > TMembershipFunction; + typedef typename Superclass::TInputImage TInputImage; + typedef typename Superclass::TOutputImage TOutputImage; + typedef typename Superclass::TVertex TVertex; + typedef typename Superclass::TValue TValue; + typedef typename Superclass::TResult TResult; + + typedef itk::FunctionBase< TValue, bool > TMembershipFunction; + + protected: + typedef typename Superclass::_TVertices _TVertices; + typedef typename Superclass::_TCollision _TCollision; + typedef typename Superclass::_TCollisionsRow _TCollisionsRow; + typedef typename Superclass::_TCollisions _TCollisions; + typedef typename Superclass::_TNode _TNode; + typedef typename Superclass::_TNodes _TNodes; public: itkNewMacro( Self ); - itkTypeMacro( RegionGrow, fpaBaseRegionGrow ); + itkTypeMacro( RegionGrow, Algorithm ); itkGetObjectMacro( MembershipFunction, TMembershipFunction ); + itkGetConstObjectMacro( MembershipFunction, TMembershipFunction ); itkSetObjectMacro( MembershipFunction, TMembershipFunction ); protected: - RegionGrow( ) - : Superclass( ), - m_MembershipFunction( NULL ) - { } - virtual ~RegionGrow( ) - { } - - virtual bool _CheckMembership( - const typename Superclass::_TNode& n - ) const - { - if( this->m_MembershipFunction.IsNotNull( ) ) - { - if( - this->m_MembershipFunction->GetInputImage( ) != - this->GetInput( ) - ) - this->m_MembershipFunction->SetInputImage( this->GetInput( ) ); - return( this->m_MembershipFunction->EvaluateAtIndex( n.Vertex ) ); - } - else - return( false ); - } + RegionGrow( ); + virtual ~RegionGrow( ); + + virtual bool _CheckMembership( const TVertex& v ) const; + virtual void _InitResults( ); private: // Purposely not implemented - RegionGrow( const Self& ); - void operator=( const Self& ); + RegionGrow( const Self& other ); + Self& operator=( const Self& other ); protected: typename TMembershipFunction::Pointer m_MembershipFunction; @@ -78,6 +70,8 @@ namespace fpa } // ecapseman +#include + #endif // __FPA__IMAGE__REGIONGROW__H__ // eof - $RCSfile$