]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Image / ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h
1 #ifndef __FPA__IMAGE__EXTRACTENDPOINTSANDBIFURCATIONSFROMMINIMUMSPANNINGTREE__H__
2 #define __FPA__IMAGE__EXTRACTENDPOINTSANDBIFURCATIONSFROMMINIMUMSPANNINGTREE__H__
3
4 #include <fpa/Base/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h>
5
6 #include <itkImageFileWriter.h>
7 #include <itkImageFileWriter.hxx>
8 #include <itkImageAlgorithm.hxx>
9
10 namespace fpa
11 {
12   namespace Image
13   {
14     /**
15      */
16     template< class _TImage, class _TMST >
17     class ExtractEndPointsAndBifurcationsFromMinimumSpanningTree
18       : public fpa::Base::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree< _TMST >
19     {
20     public:
21       typedef
22         fpa::Base::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree< _TMST >
23         Superclass;
24       typedef ExtractEndPointsAndBifurcationsFromMinimumSpanningTree Self;
25       typedef itk::SmartPointer< Self >                              Pointer;
26       typedef itk::SmartPointer< const Self >                        ConstPointer;
27
28       typedef _TImage TImage;
29       typedef typename Superclass::TMinimumSpanningTree TMinimumSpanningTree;
30       typedef typename Superclass::TVertex              TVertex;
31
32       typedef itk::Image< unsigned short, TImage::ImageDimension > TMarkImage;
33
34     public:
35       itkNewMacro( Self );
36       itkTypeMacro(
37         ExtractEndPointsAndBifurcationsFromMinimumSpanningTree,
38         fpa::Base::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree
39         );
40
41       itkBooleanMacro( SquaredDistanceMap );
42       itkGetConstMacro( SquaredDistanceMap, bool );
43       itkSetMacro( SquaredDistanceMap, bool );
44
45     public:
46       const TImage* GetCostsImage( );
47       const TImage* GetDistanceMap( );
48       void SetCostsImage( TImage* image );
49       void SetDistanceMap( TImage* image );
50
51     protected:
52       ExtractEndPointsAndBifurcationsFromMinimumSpanningTree( );
53       virtual ~ExtractEndPointsAndBifurcationsFromMinimumSpanningTree( );
54
55       virtual void GenerateData( ) override;
56
57       virtual void _MarkSkeleton(
58         const TVertex& v, const unsigned long& l
59         ) override;
60       virtual void _MarkSphere(
61         const TVertex& v,
62         const double& r,
63         const unsigned long& l
64         ) override;
65       virtual unsigned long _Mark( const TVertex& v ) override;
66       virtual unsigned long _SkeletonMark( const TVertex& v ) override;
67       virtual double _Radius( const TVertex& v ) override;
68
69       virtual void _Tmp( ) override
70         {
71           /* TODO
72              static unsigned int i = 0;
73              std::stringstream s;
74              s << "marks_" << i << ".mhd";
75              i++;
76              typename itk::ImageFileWriter< TMarkImage >::Pointer w =
77              itk::ImageFileWriter< TMarkImage >::New( );
78              w->SetInput( this->m_MarkImage );
79              w->SetFileName( s.str( ) );
80              w->Update( );
81           */
82         }
83
84     private:
85       // Purposely not implemented
86       ExtractEndPointsAndBifurcationsFromMinimumSpanningTree( const Self& other );
87       Self& operator=( const Self& other );
88
89     protected:
90       typename TMarkImage::Pointer m_MarkImage;
91       typename TMarkImage::Pointer m_SkeletonImage;
92       bool m_SquaredDistanceMap;
93     };
94
95   } // ecapseman
96
97 } // ecapseman
98
99 #ifndef ITK_MANUAL_INSTANTIATION
100 #include <fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx>
101 #endif // ITK_MANUAL_INSTANTIATION
102
103 #endif // __FPA__IMAGE__EXTRACTENDPOINTSANDBIFURCATIONSFROMMINIMUMSPANNINGTREE__H__
104
105 // eof - $RCSfile$