]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Dijkstra.h
Major refactoring
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.h
1 #ifndef __FPA__IMAGE__DIJKSTRA__H__
2 #define __FPA__IMAGE__DIJKSTRA__H__
3
4 #include <itkFunctionBase.h>
5 #include <itkImageToImageFilter.h>
6 #include <fpa/Base/Dijkstra.h>
7 #include <fpa/Image/Algorithm.h>
8 #include <fpa/Image/Functors/ImageCostFunction.h>
9
10 namespace fpa
11 {
12   namespace Image
13   {
14     /**
15      * @param I Input image type
16      * @param O Output image type
17      */
18     template< class I, class O >
19     class Dijkstra
20       : public Algorithm< I, O, fpa::Base::Dijkstra< typename I::IndexType, typename I::PixelType, typename O::PixelType, itk::ImageToImageFilter< I, O > > >
21     {
22     public:
23       typedef fpa::Base::Dijkstra< typename I::IndexType, typename I::PixelType, typename O::PixelType, itk::ImageToImageFilter< I, O > > TBaseAlgorithm;
24
25       typedef Dijkstra                          Self;
26       typedef Algorithm< I, O, TBaseAlgorithm > Superclass;
27       typedef itk::SmartPointer< Self >         Pointer;
28       typedef itk::SmartPointer< const Self >   ConstPointer;
29
30       typedef typename Superclass::TInputImage  TInputImage;
31       typedef typename Superclass::TOutputImage TOutputImage;
32       typedef typename Superclass::TVertex      TVertex;
33       typedef typename Superclass::TValue       TValue;
34       typedef typename Superclass::TResult      TResult;
35
36       typedef fpa::Image::Functors::ImageCostFunction< TInputImage, TResult > TCostFunction;
37       typedef itk::FunctionBase< TResult, TResult > TConversionFunction;
38
39     protected:
40       typedef typename Superclass::_TVertices      _TVertices;
41       typedef typename Superclass::_TCollision     _TCollision;
42       typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
43       typedef typename Superclass::_TCollisions    _TCollisions;
44       typedef typename Superclass::_TNode          _TNode;
45       typedef typename Superclass::_TNodes         _TNodes;
46
47     public:
48       itkNewMacro( Self );
49       itkTypeMacro( Dijkstra, Algorithm );
50
51       itkGetObjectMacro( CostFunction, TCostFunction );
52       itkGetObjectMacro( ConversionFunction, TConversionFunction );
53
54       itkGetConstObjectMacro( CostFunction, TCostFunction );
55       itkGetConstObjectMacro( ConversionFunction, TConversionFunction );
56
57       itkSetObjectMacro( CostFunction, TCostFunction );
58       itkSetObjectMacro( ConversionFunction, TConversionFunction );
59
60     protected:
61       Dijkstra( );
62       virtual ~Dijkstra( );
63
64       virtual TResult _Cost( const TVertex& v, const TVertex& p ) const;
65
66       virtual void _BeforeGenerateData( );
67       virtual void _InitResults( );
68
69     private:
70       // Purposely not implemented
71       Dijkstra( const Self& other );
72       Self& operator=( const Self& other );
73
74     protected:
75       typename TCostFunction::Pointer m_CostFunction;
76       typename TConversionFunction::Pointer m_ConversionFunction;
77     };
78
79   } // ecapseman
80
81 } // ecapseman
82
83 #include <fpa/Image/Dijkstra.hxx>
84
85 #endif // __FPA__IMAGE__DIJKSTRA__H__
86
87 // eof - $RCSfile$