#ifndef __FPA__IMAGE__REGIONGROW__H__ #define __FPA__IMAGE__REGIONGROW__H__ #include #include #include #include #include namespace fpa { namespace Image { /** * @param I Input image type */ template< class I > 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: // 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 RegionGrow Self; typedef Algorithm< I, TBaseAlgorithm > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef itk::ImageFunction< I, bool > TMembershipFunction; public: itkNewMacro( Self ); itkTypeMacro( RegionGrow, fpaBaseRegionGrow ); itkGetObjectMacro( 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 ); } private: // Purposely not implemented RegionGrow( const Self& ); void operator=( const Self& ); protected: typename TMembershipFunction::Pointer m_MembershipFunction; }; } // ecapseman } // ecapseman #endif // __FPA__IMAGE__REGIONGROW__H__ // eof - $RCSfile$