-#ifndef __FPA__BASE__REGIONGROW__H__
-#define __FPA__BASE__REGIONGROW__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__RegionGrow__h__
+#define __fpa__Base__RegionGrow__h__
#include <deque>
+
+#include <itkConceptChecking.h>
#include <itkFunctionBase.h>
-#include <fpa/Base/Algorithm.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;
- // Template arguments
- typedef typename Superclass::TVertex TVertex;
- typedef typename Superclass::TScalar TScalar;
- typedef typename Superclass::TFilter TFilter;
- typedef typename Superclass::TVertexCompare TVertexCompare;
- typedef typename Superclass::TFrontId TFrontId;
- typedef typename Superclass::TCollision TCollision;
- typedef typename Superclass::TCollisionsRow TCollisionsRow;
- typedef typename Superclass::TCollisions TCollisions;
- typedef typename Superclass::TNodeLabel TNodeLabel;
- typedef typename Superclass::TNode TNode;
- typedef typename Superclass::TNodes TNodes;
- typedef typename Superclass::TVertices TVertices;
-
- typedef itk::FunctionBase< TVertex, bool > TRegionGrowFunction;
+ 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 std::deque< TNode > TQueue;
+ typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
+ typedef itk::FunctionBase< TVertex, bool > TVertexPredicate;
public:
- itkTypeMacro( RegionGrow, Algorithm );
+ itkConceptMacro(
+ Check_TOutputValue,
+ ( itk::Concept::IsUnsignedInteger< TOutputValue > )
+ );
- itkGetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
- itkGetConstMacro( InsideValue, TScalar );
- itkGetConstMacro( OutsideValue, TScalar );
+ public:
+ itkGetObjectMacro( ValuePredicate, TValuePredicate );
+ itkGetObjectMacro( VertexPredicate, TVertexPredicate );
+ itkGetConstMacro( InsideValue, TOutputValue );
- itkSetObjectMacro( RegionGrowFunction, TRegionGrowFunction );
- itkSetMacro( InsideValue, TScalar );
- itkSetMacro( OutsideValue, TScalar );
+ itkSetMacro( InsideValue, TOutputValue );
+
+ 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:
- // Methods to extend itk-based architecture
RegionGrow( );
virtual ~RegionGrow( );
- // Front propagation methods to be overloaded
- virtual bool _Result( TNode& node, const TNode& parent ) fpa_OVERRIDE;
- virtual void _QueueClear( ) fpa_OVERRIDE;
- virtual void _QueuePush( const TNode& node ) fpa_OVERRIDE;
- virtual TNode _QueuePop( ) fpa_OVERRIDE;
- virtual bool _IsQueueEmpty( ) const fpa_OVERRIDE;
+ virtual void _ComputeOutputValue( TNode& n ) override;
+ virtual void _UpdateOutputValue( 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 implemented
+ // Purposely not implemented.
RegionGrow( const Self& other );
Self& operator=( const Self& other );
protected:
- std::deque< TNode > m_Queue;
- typename TRegionGrowFunction::Pointer m_RegionGrowFunction;
- TScalar m_InsideValue;
- TScalar m_OutsideValue;
+ typename TValuePredicate::Pointer m_ValuePredicate;
+ typename TVertexPredicate::Pointer m_VertexPredicate;
+
+ TOutputValue m_InsideValue;
+
+ TQueue m_Queue;
};
} // ecapseman
#ifndef ITK_MANUAL_INSTANTIATION
# include <fpa/Base/RegionGrow.hxx>
-#endif
+#endif // ITK_MANUAL_INSTANTIATION
-#endif // __FPA__BASE__REGIONGROW__H__
+#endif // __fpa__Base__RegionGrow__h__
// eof - $RCSfile$