]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Functors/Dijkstra/Image/Identity.h
...
[FrontAlgorithms.git] / lib / fpa / Functors / Dijkstra / Image / Identity.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Functors__Dijkstra__Image__Identity__h__
6 #define __fpa__Functors__Dijkstra__Image__Identity__h__
7
8 #include <fpa/Functors/BaseVertexFunction.h>
9
10 namespace fpa
11 {
12   namespace Functors
13   {
14     namespace Dijkstra
15     {
16       namespace Image
17       {
18         /**
19          */
20         template< class _TImage, class _TValue >
21         class Identity
22           : public fpa::Functors::BaseVertexFunction< typename _TImage::IndexType, _TValue >
23         {
24         public:
25           typedef _TImage TImage;
26           typedef _TValue TValue;
27           typedef typename TImage::IndexType TVertex;
28           typedef fpa::Functors::BaseVertexFunction< TVertex, TValue >  Superclass;
29           typedef Identity                        Self;
30           typedef itk::SmartPointer< Self >       Pointer;
31           typedef itk::SmartPointer< const Self > ConstPointer;
32
33         public:
34           itkNewMacro( Self );
35           itkTypeMacro(
36             fpa::Functors::Dijkstra::Image::Identity,
37             fpa::Functors::BaseVertexFunction
38             );
39
40         public:
41           virtual TValue Evaluate( const TVertex& v, const TVertex& p ) const override
42             {
43               const TImage* image =
44                 dynamic_cast< const TImage* >(
45                   this->m_DataObject.GetPointer( )
46                   );
47               if( image != NULL )
48                 return( TValue( image->GetPixel( v ) ) );
49               else
50                 return( TValue( -1 ) );
51             }
52
53         protected:
54           Identity( )
55             : Superclass( )
56             {
57             }
58           virtual ~Identity( )
59             {
60             }
61
62         private:
63           // Purposely not implemented.
64           Identity( const Self& other );
65           Self& operator=( const Self& other );
66         };
67
68       } // ecapseman
69
70     } // ecapseman
71
72   } // ecapseman
73
74 } // ecapseman
75
76 #endif // __fpa__Functors__Dijkstra__Identity__h__
77 // eof - $RCSfile$