+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
#ifndef __fpa__Base__RegionGrow__h__
#define __fpa__Base__RegionGrow__h__
-#include <queue>
-#include <fpa/Config.h>
-#include <fpa/Base/RegionGrowFunctionBase.h>
+#include <deque>
+
+#include <itkConceptChecking.h>
+#include <itkFunctionBase.h>
namespace fpa
{
{
/**
*/
- template< class _TSuperclass >
+ template< class _TAlgorithm >
class RegionGrow
- : public _TSuperclass
+ : public _TAlgorithm
{
public:
typedef RegionGrow Self;
- typedef _TSuperclass Superclass;
+ typedef _TAlgorithm Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
- typedef typename Superclass::TOutput TOutput;
- typedef typename Superclass::TVertex TVertex;
+ typedef typename _TAlgorithm::TNode TNode;
+ typedef typename _TAlgorithm::TNodes TNodes;
+ typedef typename _TAlgorithm::TInputValue TInputValue;
+ typedef typename _TAlgorithm::TOutputValue TOutputValue;
+ typedef typename _TAlgorithm::TFrontId TFrontId;
+ typedef typename _TAlgorithm::TVertex TVertex;
- typedef fpa::Base::RegionGrowFunctionBase< TVertex > TGrowFunction;
+ typedef std::deque< TNode > TQueue;
+ typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
+ typedef itk::FunctionBase< TVertex, bool > TVertexPredicate;
- protected:
- typedef typename Superclass::_TQueueNode _TQueueNode;
- typedef std::queue< _TQueueNode > _TQueue;
+ public:
+ itkConceptMacro(
+ Check_TOutputValue,
+ ( itk::Concept::IsUnsignedInteger< TOutputValue > )
+ );
public:
- itkTypeMacro( RegionGrow, Algorithm );
+ itkGetObjectMacro( ValuePredicate, TValuePredicate );
+ itkGetObjectMacro( VertexPredicate, TVertexPredicate );
+ itkGetConstMacro( InsideValue, TOutputValue );
- itkGetObjectMacro( GrowFunction, TGrowFunction );
- itkGetConstMacro( InsideValue, TOutput );
- itkGetConstMacro( OutsideValue, TOutput );
+ itkSetMacro( InsideValue, TOutputValue );
- itkSetObjectMacro( GrowFunction, TGrowFunction );
- itkSetMacro( InsideValue, TOutput );
- itkSetMacro( OutsideValue, TOutput );
+ public:
+ virtual itk::ModifiedTimeType GetMTime( ) const override;
+ virtual TOutputValue GetOutsideValue( ) const;
+ virtual void SetOutsideValue( const TOutputValue& v );
+
+ void SetPredicate( TValuePredicate* p );
+ void SetPredicate( TVertexPredicate* p );
protected:
RegionGrow( );
virtual ~RegionGrow( );
- virtual bool _UpdateValue(
- _TQueueNode& v, const _TQueueNode& p
- ) fpa_OVERRIDE;
- virtual unsigned long _QueueSize( ) const fpa_OVERRIDE;
- virtual void _QueueClear( ) fpa_OVERRIDE;
- virtual void _QueuePush( const _TQueueNode& node ) fpa_OVERRIDE;
- virtual _TQueueNode _QueuePop( ) fpa_OVERRIDE;
+ virtual TOutputValue _ComputeOutputValue( const TNode& n ) override;
+ virtual void _QueueClear( ) override;
+ virtual TNode _QueuePop( ) override;
+ virtual void _QueuePush( const TNode& node ) override;
+ virtual unsigned long _QueueSize( ) const override;
+ virtual void _PrepareSeeds( TNodes& nodes ) override;
private:
- // Purposely not defined
+ // Purposely not implemented.
RegionGrow( const Self& other );
Self& operator=( const Self& other );
protected:
- TOutput m_InsideValue;
- TOutput m_OutsideValue;
- _TQueue m_Queue;
- typename TGrowFunction::Pointer m_GrowFunction;
+ typename TValuePredicate::Pointer m_ValuePredicate;
+ typename TVertexPredicate::Pointer m_VertexPredicate;
+
+ TOutputValue m_InsideValue;
+
+ TQueue m_Queue;
};
} // ecapseman