]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/RandomWalker.h
...
[FrontAlgorithms.git] / lib / fpa / Image / RandomWalker.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__RandomWalker__h__
7 #define __fpa__Image__RandomWalker__h__
8
9 #include <itkImage.h>
10 #include <fpa/Base/DijkstraBase.h>
11 #include <fpa/Base/MarksInterface.h>
12 #include <fpa/Image/Algorithm.h>
13 #include <fpa/Image/DefaultTraits.h>
14 #include <fpa/Image/LabelledSeedsInterface.h>
15
16 namespace fpa
17 {
18   namespace Image
19   {
20     /**
21      */
22     template< class _TInputImage, class _TLabelImage, class _TScalar >
23     class RandomWalkerTraits
24       : public fpa::Image::DefaultTraits< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, typename _TLabelImage::PixelType >
25     {
26     public:
27       typedef RandomWalkerTraits Self;
28       typedef _TInputImage       TInputImage;
29       typedef _TLabelImage       TLabelImage;
30       typedef _TScalar           TScalar;
31       typedef typename _TLabelImage::PixelType TFrontId;
32       typedef itk::Image< TScalar, _TInputImage::ImageDimension > TOutputImage;
33       typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > Superclass;
34
35       typedef typename Superclass::TVertex       TVertex;
36       typedef typename Superclass::TInputValue   TInputValue;
37       typedef typename Superclass::TPoint        TPoint;
38       typedef typename Superclass::TOutputValue  TOutputValue;
39       typedef typename Superclass::TCompare      TCompare;
40       typedef typename Superclass::TNeighborhood TNeighborhood;
41       typedef typename Superclass::TFilter       TFilter;
42
43       typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface;
44       typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
45
46       typedef typename TSeedsInterface::TNode  TNode;
47       typedef typename TSeedsInterface::TNodes TNodes;
48       typedef typename TSeedsInterface::TSeed  TSeed;
49       typedef typename TSeedsInterface::TSeeds TSeeds;
50
51     public:
52       itkConceptMacro(
53         Check_SameDimension,
54         ( itk::Concept::SameDimension< TInputImage::ImageDimension, TLabelImage::ImageDimension > )
55         );
56
57     private:
58       // Purposely not implemented.
59       RandomWalkerTraits( );
60       RandomWalkerTraits( const Self& other );
61       virtual ~RandomWalkerTraits( );
62       Self& operator=( const Self& other );
63     };
64
65     /**
66      */
67     template< class _TInputImage, class _TLabelImage, class _TScalar >
68     class RandomWalker
69       : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< fpa::Image::RandomWalkerTraits< _TInputImage, _TLabelImage, _TScalar > > >
70         /* TODO
71            : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, fpa::Base::MarksInterface< typename _TInputImage::IndexType >, fpa::Image::LabelledSeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, _TScalar, typename _TLabelImage::PixelType, typename _TInputImage::IndexType::LexicographicCompare > > >
72         */
73     {
74     public:
75       /* TODO
76          typedef _TInputImage TInputImage;
77          typedef _TLabelImage TLabelImage;
78          typedef _TScalar     TScalar;
79          typedef typename TInputImage::IndexType        TVertex;
80          typedef typename TInputImage::PointType        TPoint;
81          typedef typename TVertex::LexicographicCompare TVertexCompare;
82          typedef typename TInputImage::PixelType        TInputValue;
83          typedef typename TLabelImage::PixelType        TFrontId;
84
85          typedef itk::Image< TScalar, _TInputImage::ImageDimension > TOutputImage;
86          typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
87          typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, _TScalar, TFrontId, TVertexCompare > TSeedsInterface;
88          typedef fpa::Image::Algorithm< _TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
89          typedef RandomWalker                          Self;
90          typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass;
91          typedef itk::SmartPointer< Self >             Pointer;
92          typedef itk::SmartPointer< const Self >       ConstPointer;
93
94          typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TScalar > TWeightFunction;
95          typedef typename TSeedsInterface::TNode  TNode;
96          typedef typename TSeedsInterface::TNodes TNodes;
97       */
98
99     public:
100       itkNewMacro( Self );
101       itkTypeMacro( fpa::Image::RandomWalker, fpa::Base::RandomWalker );
102
103     public:
104       virtual itk::ModifiedTimeType GetMTime( ) const override;
105
106     protected:
107       RandomWalker( );
108       virtual ~RandomWalker( );
109
110       virtual void _BeforeGenerateData( ) override;
111       virtual TNodes _UnifySeeds( ) override;
112
113     private:
114       // Purposely not implemented.
115       RandomWalker( const Self& other );
116       Self& operator=( const Self& other );
117     };
118
119   } // ecapseman
120
121 } // ecapseman
122
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #  include <fpa/Image/RandomWalker.hxx>
125 #endif // ITK_MANUAL_INSTANTIATION
126
127 #endif // __fpa__Image__RandomWalker__h__
128
129 // eof - $RCSfile$