]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Algorithm.h
...
[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 _TTraits >
21     class Algorithm
22       : public fpa::Base::Algorithm< _TTraits >
23     {
24     public:
25       typedef _TTraits TTraits;
26       typedef fpa::Base::Algorithm< _TTraits > Superclass;
27       typedef Algorithm                        Self;
28       typedef itk::SmartPointer< Self >        Pointer;
29       typedef itk::SmartPointer< const Self >  ConstPointer;
30
31       typedef typename TTraits::TFrontId      TFrontId;
32       typedef typename TTraits::TInputImage   TInputImage;
33       typedef typename TTraits::TInputValue   TInputValue;
34       typedef typename TTraits::TNeighborhood TNeighborhood;
35       typedef typename TTraits::TNode         TNode;
36       typedef typename TTraits::TNodes        TNodes;
37       typedef typename TTraits::TOutputImage  TOutputImage;
38       typedef typename TTraits::TOutputValue  TOutputValue;
39       typedef typename TTraits::TSeeds        TSeeds;
40       typedef typename TTraits::TVertex       TVertex;
41
42       typedef itk::Image< TFrontId, TTraits::Dimension > TMarks;
43
44       /* TODO
45          typedef _TMarksInterface TMarksInterface;
46          typedef _TSeedsInterface TSeedsInterface;
47
48          typedef typename TSeedsInterface::TTraits TTraits;
49          typedef typename TTraits::TInputImage   TInputImage;
50          typedef typename TTraits::TOutputImage  TOutputImage;
51          typedef typename TTraits::TInputValue   TInputValue;
52          typedef typename TTraits::TOutputValue  TOutputValue;
53          typedef typename TTraits::TFrontId      TFrontId;
54          typedef typename TTraits::TNeighborhood TNeighborhood;
55          typedef typename TTraits::TNode         TNode;
56          typedef typename TTraits::TNodes        TNodes;
57          typedef typename TTraits::TSeeds        TSeeds;
58          typedef typename TTraits::TVertex       TVertex;
59          typedef typename TTraits::TPoint        TPoint;
60
61          typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
62          typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
63          typedef Algorithm                       Self;
64       */
65
66     public:
67       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
68
69       itkGetConstMacro( NeigborhoodOrder, unsigned int );
70       itkSetMacro( NeigborhoodOrder, unsigned int );
71
72     public:
73       TMarks* GetMarks( );
74       const TMarks* GetMarks( ) const;
75
76     protected:
77       Algorithm( );
78       virtual ~Algorithm( );
79
80       virtual TNodes _UnifySeeds( ) override;
81       virtual void _ConfigureOutput( const TOutputValue& v ) override;
82       virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
83       virtual TInputValue _GetInputValue( const TVertex& v ) const override;
84       virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
85       virtual void _UpdateOutputValue( TNode& n ) override;
86       virtual bool _IsMarked( const TVertex& v ) const override;
87       virtual unsigned long _GetMark( const TVertex& v ) const override;
88       virtual void _Mark( const TVertex& v, unsigned long frontId ) override;
89
90     private:
91       // Purposely not implemented.
92       Algorithm( const Self& other );
93       Self& operator=( const Self& other );
94
95     protected:
96       unsigned long m_MarksIdx;
97       unsigned int  m_NeigborhoodOrder;
98     };
99
100   } // ecapseman
101
102 } // ecapseman
103
104 #ifndef ITK_MANUAL_INSTANTIATION
105 #  include <fpa/Image/Algorithm.hxx>
106 #endif // ITK_MANUAL_INSTANTIATION
107
108 #endif // __fpa__Image__Algorithm__h__
109
110 // eof - $RCSfile$