]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Algorithm.h
12a2f9140994434a9ac85ef1c2b4854f81b5fdc5
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__Algorithm__h__
7 #define __fpa__Image__Algorithm__h__
8
9 #include <itkImage.h>
10 #include <itkImageToImageFilter.h>
11
12 #include <fpa/Base/Algorithm.h>
13
14 namespace fpa
15 {
16   namespace Image
17   {
18     /**
19      */
20     template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
21     class Algorithm
22       : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, _TMarksInterface, _TSeedsInterface >
23     {
24     public:
25       typedef _TInputImage     TInputImage;
26       typedef _TOutputImage    TOutputImage;
27       typedef _TMarksInterface TMarksInterface;
28       typedef _TSeedsInterface TSeedsInterface;
29       typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
30
31       typedef Algorithm Self;
32       typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
33       typedef itk::SmartPointer< Self >       Pointer;
34       typedef itk::SmartPointer< const Self > ConstPointer;
35
36       typedef typename TInputImage::PixelType    TInputValue;
37       typedef typename TOutputImage::PixelType   TOutputValue;
38       typedef typename Superclass::TFrontId      TFrontId;
39       typedef typename Superclass::TNeighborhood TNeighborhood;
40       typedef typename Superclass::TNode         TNode;
41       typedef typename Superclass::TNodes        TNodes;
42       typedef typename Superclass::TSeeds        TSeeds;
43       typedef typename Superclass::TVertex       TVertex;
44       typedef typename Superclass::TPoint        TPoint;
45
46       typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarks;
47
48     public:
49       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
50
51       itkGetConstMacro( NeigborhoodOrder, unsigned int );
52       itkSetMacro( NeigborhoodOrder, unsigned int );
53
54     public:
55       TMarks* GetMarks( );
56       const TMarks* GetMarks( ) const;
57
58     protected:
59       Algorithm( );
60       virtual ~Algorithm( );
61
62       virtual TNodes _UnifySeeds( ) override;
63       virtual void _ConfigureOutput( const TOutputValue& v ) override;
64       virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
65       virtual TInputValue _GetInputValue( const TVertex& v ) const override;
66       virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
67       virtual void _UpdateOutputValue( const TNode& n ) override;
68       virtual bool _IsMarked( const TVertex& v ) const override;
69       virtual unsigned long _GetMark( const TVertex& v ) const override;
70       virtual bool _Mark( const TVertex& v, unsigned long frontId ) override;
71
72     private:
73       // Purposely not implemented.
74       Algorithm( const Self& other );
75       Self& operator=( const Self& other );
76
77     protected:
78       unsigned long m_MarksIdx;
79       unsigned int  m_NeigborhoodOrder;
80     };
81
82   } // ecapseman
83
84 } // ecapseman
85
86 #ifndef ITK_MANUAL_INSTANTIATION
87 #  include <fpa/Image/Algorithm.hxx>
88 #endif // ITK_MANUAL_INSTANTIATION
89
90 #endif // __fpa__Image__Algorithm__h__
91
92 // eof - $RCSfile$