]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/SkeletonFilter.h
Skeleton filter added.
[FrontAlgorithms.git] / lib / fpa / Image / SkeletonFilter.h
1 #ifndef __fpa__Image__SkeletonFilter__h__
2 #define __fpa__Image__SkeletonFilter__h__
3
4 #include <itkProcessObject.h>
5 #include <fpa/Image/MinimumSpanningTree.h>
6 #include <cpExtensions/DataStructures/Skeleton.h>
7 #include <set>
8
9 namespace fpa
10 {
11   namespace Image
12   {
13     /**
14      */
15     template< class _TDistanceMap, class _TCostMap >
16     class SkeletonFilter
17       : public itk::ProcessObject
18     {
19     public:
20       typedef SkeletonFilter                  Self;
21       typedef itk::ProcessObject              Superclass;
22       typedef itk::SmartPointer< Self >       Pointer;
23       typedef itk::SmartPointer< const Self > ConstPointer;
24
25 #ifdef ITK_USE_CONCEPT_CHECKING
26       itkConceptMacro(
27         SameDimension,
28         ( itk::Concept::SameDimension< _TDistanceMap::ImageDimension, _TCostMap::ImageDimension > )
29         );
30 #endif
31       typedef _TDistanceMap TDistanceMap;
32       typedef _TCostMap     TCostMap;
33       typedef typename TCostMap::IndexType TIndex;
34       typedef MinimumSpanningTree< TCostMap::ImageDimension > TMST;
35       typedef
36       cpExtensions::DataStructures::Skeleton< TCostMap::ImageDimension >
37       TSkeleton;
38
39       typedef
40       itk::Functor::IndexLexicographicCompare< _TCostMap::ImageDimension >
41       TIndexCompare;
42       typedef std::set< TIndex, TIndexCompare > TIndicesData;
43       typedef itk::SimpleDataObjectDecorator< TIndicesData > TIndices;
44
45     public:
46       itkNewMacro( Self );
47       itkTypeMacro( fpa::Image::SkeletonFilter, itk::Object );
48
49     public:
50       _TDistanceMap* GetDistanceMap( );
51       const _TDistanceMap* GetDistanceMap( ) const;
52       void SetDistanceMap( _TDistanceMap* dmap );
53
54       _TCostMap* GetCostMap( );
55       const _TCostMap* GetCostMap( ) const;
56       void SetCostMap( _TCostMap* cmap );
57
58       TMST* GetMinimumSpanningTree( );
59       const TMST* GetMinimumSpanningTree( ) const;
60       void SetMinimumSpanningTree( TMST* mst );
61
62       TIndices* GetEndPoints( );
63       const TIndices* GetEndPoints( ) const;
64
65       TIndices* GetBifurcations( );
66       const TIndices* GetBifurcations( ) const;
67
68       TSkeleton* GetSkeleton( );
69       const TSkeleton* GetSkeleton( ) const;
70
71     protected:
72       SkeletonFilter( );
73       virtual ~SkeletonFilter( );
74
75       virtual void GenerateData( ) fpa_OVERRIDE;
76
77       void _EndPoints(
78         const TDistanceMap* dmap,
79         const TCostMap* cmap,
80         const TMST* mst,
81         TIndices* end_points
82         );
83
84       void _Skeleton(
85         const TDistanceMap* dmap,
86         const TCostMap* cmap,
87         const TMST* mst,
88         TIndices* end_points
89         TIndices* bifurcations,
90         TSkeleton* skeleton
91         );
92
93     private:
94       // Purposely not defined
95       SkeletonFilter( const Self& other );
96       Self& operator=( const Self& other );
97     };
98
99   } // ecapseman
100
101 } // ecapseman
102
103 #ifndef ITK_MANUAL_INSTANTIATION
104 #  include <fpa/Image/SkeletonFilter.hxx>
105 #endif // ITK_MANUAL_INSTANTIATION
106
107 #endif // __fpa__Image__SkeletonFilter__h__
108
109 // eof - $RCSfile$