]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/MinimumSpanningTreeToImageFilter.h
a119702f4e7c22eb9263294e7dff454b75cf835f
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTreeToImageFilter.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__MinimumSpanningTreeToImageFilter__h__
7 #define __fpa__Image__MinimumSpanningTreeToImageFilter__h__
8
9 #include <itkRGBAPixel.h>
10 #include <itkImageToImageFilter.h>
11 #include <vector>
12
13 namespace fpa
14 {
15   namespace Image
16   {
17     /**
18      */
19     template< class _TMST, class _TOutputPixelValue >
20     class MinimumSpanningTreeToImageFilter
21       : public itk::ImageToImageFilter< _TMST, itk::Image< itk::RGBAPixel< _TOutputPixelValue >, _TMST::ImageDimension > >
22     {
23     public:
24       typedef _TMST TMST;
25       typedef _TOutputPixelValue TOutputPixelValue;
26       typedef itk::RGBAPixel< TOutputPixelValue > TOutputPixel;
27       typedef itk::Image< TOutputPixel, TMST::ImageDimension > TOutputImage;
28
29       typedef MinimumSpanningTreeToImageFilter              Self;
30       typedef itk::SmartPointer< Self >                     Pointer;
31       typedef itk::SmartPointer< const Self >               ConstPointer;
32       typedef itk::ImageToImageFilter< TMST, TOutputImage > Superclass;
33
34       typedef typename TMST::IndexType TIndex;
35       struct TPathData
36       {
37         TIndex Start;
38         TIndex End;
39         TOutputPixelValue Red;
40         TOutputPixelValue Green;
41         TOutputPixelValue Blue;
42       };
43       typedef std::vector< TPathData > TPaths;
44
45     public:
46       itkNewMacro( Self );
47       itkTypeMacro(
48         fpa::Image::MinimumSpanningTreeToImageFilter,
49         itk::ImageToImageFilter
50         );
51
52     public:
53       void AddPath(
54         const TIndex& start, const TIndex& end,
55         const TOutputPixelValue& r = TOutputPixelValue( 1 ),
56         const TOutputPixelValue& g = TOutputPixelValue( 0 ),
57         const TOutputPixelValue& b = TOutputPixelValue( 0 )
58         );
59
60     protected:
61       MinimumSpanningTreeToImageFilter( );
62       virtual ~MinimumSpanningTreeToImageFilter( );
63
64       virtual void GenerateData( ) override;
65
66     private:
67       MinimumSpanningTreeToImageFilter( const Self& other );
68       Self& operator=( const Self& other );
69
70     protected:
71       TPaths m_Paths;
72     };
73
74   } // ecapseman
75
76 } // ecapseman
77
78 #ifndef ITK_MANUAL_INSTANTIATION
79 #  include <fpa/Image/MinimumSpanningTreeToImageFilter.hxx>
80 #endif // ITK_MANUAL_INSTANTIATION
81
82 #endif // __fpa__Image__MinimumSpanningTreeToImageFilter__h__
83
84 // eof - $RCSfile$