]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DefaultTraits.h
...
[FrontAlgorithms.git] / lib / fpa / Image / DefaultTraits.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__DefaultTraits__h__
7 #define __fpa__Image__DefaultTraits__h__
8
9 #include <set>
10 #include <vector>
11 #include <itkConceptChecking.h>
12 #include <fpa/Base/Event.h>
13
14 namespace fpa
15 {
16   namespace Image
17   {
18     /**
19      */
20     template< class _TInputImage, class _TOutputImage, class _TFrontId >
21     class DefaultTraits
22     {
23     public:
24       typedef DefaultTraits Self;
25       typedef _TInputImage  TInputImage;
26       typedef _TOutputImage TOutputImage;
27       typedef _TFrontId     TFrontId;
28       itkStaticConstMacro( Dimension, unsigned int, TInputImage::ImageDimension );
29
30       typedef typename TInputImage::IndexType        TVertex;
31       typedef typename TInputImage::PixelType        TInputValue;
32       typedef typename TInputImage::PointType        TPoint;
33       typedef typename TOutputImage::PixelType       TOutputValue;
34       typedef typename TVertex::LexicographicCompare TCompare;
35
36       typedef fpa::Base::Event< TVertex > TEvent;
37       typedef std::vector< TVertex >      TNeighborhood;
38
39       struct TSeed
40       {
41         TVertex Vertex;
42         TPoint  Point;
43         bool    IsPoint;
44         bool    IsUnified;
45         TFrontId FrontId;
46         TSeed( )
47           : IsUnified( false ),
48             FrontId( TFrontId( 0 ) )
49           { }
50       };
51       typedef std::vector< TSeed > TSeeds;
52
53       struct TNode
54       {
55         TVertex  Vertex;
56         TVertex  Parent;
57         TFrontId FrontId;
58
59         // Hack to hide the fact that seed values need to be initialized
60         mutable TOutputValue Value;
61       };
62       struct TNodeCompare
63       {
64         bool operator()( const TNode& a, const TNode& b ) const
65           {
66             TCompare cmp;
67             return( cmp( a.Vertex, b.Vertex ) );
68           }
69       };
70       typedef std::set< TNode, TNodeCompare > TNodes;
71
72     private:
73       itkConceptMacro(
74         Check_SameDimension,
75         ( itk::Concept::SameDimension< Self::Dimension, TOutputImage::ImageDimension > )
76         );
77
78     private:
79       // Purposely not implemented.
80       DefaultTraits( );
81       DefaultTraits( const Self& other );
82       virtual ~DefaultTraits( );
83       Self& operator=( const Self& other );
84     };
85
86   } // ecapseman
87
88 } // ecapseman
89
90 #endif // __fpa__Image__DefaultTraits__h__
91
92 // eof - $RCSfile$