1 #ifndef __FPA__IMAGE__ALGORITHM__H__
2 #define __FPA__IMAGE__ALGORITHM__H__
5 #include <itkFunctionBase.h>
12 * A generic front propagation algorithm were vertices are image pixels.
14 * @param I Input image type
15 * @param A Base algorithm (RegionGrow, Dijkstra or FastMarching)
17 template< class I, class A >
22 /// Standard class typdedefs
23 typedef Algorithm Self;
25 typedef itk::SmartPointer< Self > Pointer;
26 typedef itk::SmartPointer< const Self > ConstPointer;
28 /// Template input values
29 typedef I TInputImage;
30 typedef A TBaseAlgorithm;
32 typedef typename A::TTraits TTraits;
33 typedef typename TTraits::TCost TCost;
34 typedef typename TTraits::TResult TResult;
35 typedef typename TTraits::TVertex TVertex;
36 typedef typename TTraits::TVertexValue TVertexValue;
38 typedef itk::Image< TResult, I::ImageDimension > TOutputImage;
39 typedef itk::FunctionBase< TCost, TCost > TCostConversionFunction;
42 typedef typename TTraits::TFrontId _TFrontId;
43 typedef typename TTraits::TNode _TNode;
44 typedef typename TTraits::TNodes _TNodes;
47 typedef itk::Image< bool, I::ImageDimension > _TMarks;
48 typedef itk::Image< _TFrontId, I::ImageDimension > _TFrontsIds;
49 typedef itk::Image< TVertex, I::ImageDimension > _TParents;
52 itkTypeMacro( Algorithm, TAlgorithm );
55 itkGetConstMacro( NeighborhoodOrder, unsigned int );
56 itkGetConstObjectMacro( CostConversion, TCostConversionFunction );
57 itkGetObjectMacro( CostConversion, TCostConversionFunction );
59 itkSetMacro( NeighborhoodOrder, unsigned int );
60 itkSetObjectMacro( CostConversion, TCostConversionFunction );
64 virtual ~Algorithm( );
67 virtual bool _UpdateResult( _TNode& n );
69 /// Pure virtual interface: vertices
70 virtual unsigned long _NumberOfVertices ( ) const;
71 virtual TVertexValue _Value ( const TVertex& v ) const;
72 virtual TResult _Result ( const TVertex& v ) const;
74 /// Pure virtual interface: edges
75 virtual double _Norm ( const TVertex& a, const TVertex& b ) const;
76 virtual bool _Edge ( const TVertex& a, const TVertex& b ) const;
77 virtual TCost _Cost ( const TVertex& a, const TVertex& b ) const;
79 /// Pure virtual interface: neighborhood
80 virtual void _Neighs ( const _TNode& n, _TNodes& N ) const;
81 virtual void _NeighsInDim ( const _TNode& n,
82 const unsigned int& d,
85 /// Pure virtual interface: results
86 virtual void _InitializeResults ( );
89 Algorithm( const Self& ); // Not impl.
90 void operator=( const Self& ); // Not impl.
93 unsigned int m_NeighborhoodOrder;
94 typename TCostConversionFunction::Pointer m_CostConversion;
101 #include <fpa/Image/Algorithm.hxx>
103 #endif // __FPA__IMAGE__ALGORITHM__H__