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