X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FAlgorithm.h;h=6bed9adc858a68b142aca6effff34065fef065a5;hb=c9542e420b94b0bfc1f285599f7816eab1191519;hp=0105cc3080d13166c0a23ca5b702b7622012c795;hpb=40fb0405cfef444001429f8ba49c407ce9168a94;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Algorithm.h b/lib/fpa/Image/Algorithm.h index 0105cc3..6bed9ad 100644 --- a/lib/fpa/Image/Algorithm.h +++ b/lib/fpa/Image/Algorithm.h @@ -1,10 +1,14 @@ +// ========================================================================= +// @author Leonardo Florez Valencia +// @email florez-l@javeriana.edu.co +// ========================================================================= + #ifndef __fpa__Image__Algorithm__h__ #define __fpa__Image__Algorithm__h__ -#include +#include #include #include -#include namespace fpa { @@ -12,53 +16,100 @@ namespace fpa { /** */ - template< class _TInputImage, class _TOutputImage > + template< class _TTraits, class _TMarks, class _TSeeds > class Algorithm - : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType, typename _TOutputImage::PixelType > + : public fpa::Base::Algorithm< itk::ImageToImageFilter< typename _TTraits::TInputImage, typename _TTraits::TOutputImage >, _TMarks, _TSeeds > { public: - typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > TFilter; - typedef typename _TInputImage::IndexType TVertex; - typedef typename _TOutputImage::PixelType TOutput; - - typedef Algorithm Self; - typedef fpa::Base::Algorithm< TFilter, TVertex, TOutput > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef _TTraits TTraits; + typedef _TMarks TMarksInterface; + typedef _TSeeds TSeedsInterface; + typedef typename TTraits::TInputImage TInputImage; + typedef typename TTraits::TOutputImage TOutputImage; + typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter; + + typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass; + typedef Algorithm Self; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + fpa_Base_TraitTypes( typename TTraits ); + + /* TODO + typedef typename TTraits::TFrontId TFrontId; + typedef typename TTraits::TInputImage TInputImage; + typedef typename TTraits::TInputValue TInputValue; + typedef typename TTraits::TNeighborhood TNeighborhood; + typedef typename TTraits::TNode TNode; + typedef typename TTraits::TNodes TNodes; + typedef typename TTraits::TOutputImage TOutputImage; + typedef typename TTraits::TOutputValue TOutputValue; + typedef typename TTraits::TSeeds TSeeds; + typedef typename TTraits::TVertex TVertex; + */ + + typedef itk::Image< TFrontId, TTraits::Dimension > TMarks; + + /* TODO + typedef _TMarksInterface TMarksInterface; + typedef _TSeedsInterface TSeedsInterface; + + typedef typename TSeedsInterface::TTraits TTraits; + typedef typename TTraits::TInputImage TInputImage; + typedef typename TTraits::TOutputImage TOutputImage; + typedef typename TTraits::TInputValue TInputValue; + typedef typename TTraits::TOutputValue TOutputValue; + typedef typename TTraits::TFrontId TFrontId; + typedef typename TTraits::TNeighborhood TNeighborhood; + typedef typename TTraits::TNode TNode; + typedef typename TTraits::TNodes TNodes; + typedef typename TTraits::TSeeds TSeeds; + typedef typename TTraits::TVertex TVertex; + typedef typename TTraits::TPoint TPoint; + + typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter; + typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass; + typedef Algorithm Self; + */ - typedef typename Superclass::TFrontId TFrontId; - typedef typename Superclass::TNeighborhood TNeighborhood; + private: + itkConceptMacro( + Marks_SameTraits, + ( itk::Concept::SameType< typename _TMarks::TTraits, TTraits > ) + ); - typedef fpa::Image::Functors::Base< itk::ImageBase< _TInputImage::ImageDimension >, typename Superclass::TNeighborhoodFunction > TNeighborhoodFunction; - typedef fpa::Image::Functors::Base< _TInputImage, typename Superclass::TVertexFunction > TVertexFunction; + public: + itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm ); - protected: - typedef typename Superclass::_TQueueNode _TQueueNode; + itkGetConstMacro( NeigborhoodOrder, unsigned int ); + itkSetMacro( NeigborhoodOrder, unsigned int ); public: - itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm ); + TMarks* GetMarks( ); + const TMarks* GetMarks( ) const; protected: Algorithm( ); virtual ~Algorithm( ); - virtual void _BeforeGenerateData( ) override; - virtual void _InitMarks( ) override; - virtual void _InitResults( const TOutput& init_value ) override; + virtual TNodes _UnifySeeds( ) override; + virtual void _ConfigureOutput( const TOutputValue& v ) override; + virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override; + virtual TInputValue _GetInputValue( const TVertex& v ) const override; + virtual TOutputValue _GetOutputValue( const TVertex& v ) const override; + virtual void _UpdateOutputValue( TNode& n ) override; virtual bool _IsMarked( const TVertex& v ) const override; - virtual void _Mark( const _TQueueNode& n ) override; - virtual TFrontId _GetMark( const TVertex& v ) const override; - virtual void _UpdateResult( const _TQueueNode& n ) override; - virtual TOutput _GetResult( const TVertex& v ) const override; - virtual unsigned int _GetNumberOfDimensions( ) const override; + virtual unsigned long _GetMark( const TVertex& v ) const override; + virtual void _Mark( const TVertex& v, unsigned long frontId ) override; private: - // Purposely not defined + // Purposely not implemented. Algorithm( const Self& other ); Self& operator=( const Self& other ); protected: - unsigned int m_MarksIdx; + unsigned long m_MarksIdx; + unsigned int m_NeigborhoodOrder; }; } // ecapseman