]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Algorithm.h
5547ff01d9dc233b1aec95eb4ae99663979090dc
[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::TVertex       TVertex;
42
43       typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarks;
44
45     public:
46       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
47
48       itkGetConstMacro( NeigborhoodOrder, unsigned int );
49       itkSetMacro( NeigborhoodOrder, unsigned int );
50
51     public:
52       TMarks* GetMarks( );
53       const TMarks* GetMarks( ) const;
54
55     protected:
56       Algorithm( );
57       virtual ~Algorithm( );
58
59       virtual void _ConfigureOutput( const TOutputValue& v ) override;
60       virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
61       virtual TInputValue _GetInputValue( const TVertex& v ) const override;
62       virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
63       virtual void _UpdateOutputValue( const TNode& n ) override;
64       virtual bool _IsMarked( const TVertex& v ) const override;
65       virtual unsigned long _GetMark( const TVertex& v ) const override;
66       virtual bool _Mark( const TVertex& v, unsigned long frontId ) override;
67
68     private:
69       // Purposely not implemented.
70       Algorithm( const Self& other );
71       Self& operator=( const Self& other );
72
73     protected:
74       unsigned long m_MarksIdx;
75       unsigned int  m_NeigborhoodOrder;
76     };
77
78   } // ecapseman
79
80 } // ecapseman
81
82 #ifndef ITK_MANUAL_INSTANTIATION
83 #  include <fpa/Image/Algorithm.hxx>
84 #endif // ITK_MANUAL_INSTANTIATION
85
86 #endif // __fpa__Image__Algorithm__h__
87
88 // eof - $RCSfile$