]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Dijkstra.h
Almost there...
[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::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, O > > >
21     {
22     public:
23       typedef fpa::Base::Dijkstra< typename I::IndexType, typename I::PixelType, typename O::PixelType, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, 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 typename Superclass::TStartEvent     TStartEvent;
37       typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
38       typedef typename Superclass::TEndEvent       TEndEvent;
39       typedef typename Superclass::TEndLoopEvent   TEndLoopEvent;
40       typedef typename Superclass::TAliveEvent     TAliveEvent;
41       typedef typename Superclass::TFrontEvent     TFrontEvent;
42       typedef typename Superclass::TFreezeEvent    TFreezeEvent;
43
44       typedef typename Superclass::TStartBacktrackingEvent TStartBacktrackingEvent;
45       typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
46       typedef typename Superclass::TBacktrackingEvent TBacktrackingEvent;
47
48       typedef fpa::Image::Functors::ImageCostFunction< TInputImage, TResult > TCostFunction;
49       typedef itk::FunctionBase< TResult, TResult > TConversionFunction;
50
51     protected:
52       typedef typename Superclass::_TVertices      _TVertices;
53       typedef typename Superclass::_TCollision     _TCollision;
54       typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
55       typedef typename Superclass::_TCollisions    _TCollisions;
56       typedef typename Superclass::_TNode          _TNode;
57       typedef typename Superclass::_TNodes         _TNodes;
58
59     public:
60       itkNewMacro( Self );
61       itkTypeMacro( Dijkstra, Algorithm );
62
63       itkGetObjectMacro( CostFunction, TCostFunction );
64       itkGetObjectMacro( ConversionFunction, TConversionFunction );
65
66       itkGetConstObjectMacro( CostFunction, TCostFunction );
67       itkGetConstObjectMacro( ConversionFunction, TConversionFunction );
68
69       itkSetObjectMacro( CostFunction, TCostFunction );
70       itkSetObjectMacro( ConversionFunction, TConversionFunction );
71
72     protected:
73       Dijkstra( );
74       virtual ~Dijkstra( );
75
76       virtual TResult _Cost( const TVertex& v, const TVertex& p ) const;
77
78       virtual void _BeforeGenerateData( );
79       virtual void _InitResults( );
80
81     private:
82       // Purposely not implemented
83       Dijkstra( const Self& other );
84       Self& operator=( const Self& other );
85
86     protected:
87       typename TCostFunction::Pointer m_CostFunction;
88       typename TConversionFunction::Pointer m_ConversionFunction;
89     };
90
91   } // ecapseman
92
93 } // ecapseman
94
95 #include <fpa/Image/Dijkstra.hxx>
96
97 #endif // __FPA__IMAGE__DIJKSTRA__H__
98
99 // eof - $RCSfile$