// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Filters__Algorithm__h__ #define __fpa__Filters__Algorithm__h__ #include #include #include #include namespace fpa { namespace Filters { /** */ template< class _TTraits > class Algorithm : public _TTraits::TFilter, public _TTraits::TMarksInterface, public _TTraits::TSeedsInterface { public: typedef _TTraits TTraits; fpaTraitsMacro( typename, TTraits ); typedef TFilter Superclass; typedef Algorithm Self; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef fpa::Filters::Event< TVertex > TEvent; protected: itkConceptMacro( Check_Marks, ( itk::Concept::IsUnsignedInteger< TMark > ) ); public: itkTypeMacro( fpa::Filters::Image::Algorithm, TFilter ); itkBooleanMacro( VisualDebug ); itkGetConstMacro( VisualDebug, bool ); itkSetMacro( VisualDebug, bool ); itkGetConstMacro( InitValue, TOutputValue ); itkSetMacro( InitValue, TOutputValue ); public: virtual itk::ModifiedTimeType GetMTime( ) const override; virtual void InvokeEvent( const itk::EventObject& e ); virtual void InvokeEvent( const itk::EventObject& e ) const; protected: Algorithm( ); virtual ~Algorithm( ); virtual void GenerateData( ) override; // Object association void _Associate( itk::Object* o ); void _Deassociate( itk::Object* o ); void _DeassociateAll( ); // Preparation and termination virtual void _BeforeGenerateData( ); virtual void _AfterGenerateData( ); virtual void _Reinitialize( ); // Memory allocation virtual void _ConfigureOutputs( ) = 0; // Value assignation/recuperation virtual const itk::DataObject* _GetReferenceInput( ) const; virtual TInputValue _GetInputValue( const TVertex& v ) const = 0; virtual TInputValue _GetInputValue( const TNode& n ) const; virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0; virtual TOutputValue _GetOutputValue( const TNode& n ) const; virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0; virtual void _UpdateOutputValue( TNode& n ) = 0; // Queue management virtual void _QueueClear( ) = 0; virtual TNode _QueuePop( ) = 0; virtual void _QueuePush( const TNode& n ) = 0; virtual unsigned long _QueueSize( ) const = 0; // Value update according to the particular algorithm virtual void _ComputeOutputValue( TNode& n ) = 0; private: // Purposely not implemented. Algorithm( const Self& other ); Self& operator=( const Self& other ); protected: bool m_VisualDebug; TOutputValue m_InitValue; std::set< itk::Object* > m_AssociatedObjects; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION # include #endif // ITK_MANUAL_INSTANTIATION #endif // __fpa__Filters__Algorithm__h__ // eof - $RCSfile$