]> Creatis software - FrontAlgorithms.git/blob - appli/CTBronchi/MoriLabelling.h
...
[FrontAlgorithms.git] / appli / CTBronchi / MoriLabelling.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __CTBronchi__MoriLabelling__h__
6 #define __CTBronchi__MoriLabelling__h__
7
8 #include <map>
9 #include <fpa/Filters/BaseMarksInterface.h>
10 #include <fpa/Filters/Image/SeedsFromLabelsInterface.h>
11 #include <fpa/Filters/Image/DefaultTraits.h>
12 #include <fpa/Filters/Image/RegionGrow.h>
13 #include <fpa/Functors/RegionGrow/BinaryThreshold.h>
14
15 namespace CTBronchi
16 {
17   /**
18    */
19   template< class _TInputImage, class _TLabelImage >
20   class MoriLabellingTraits
21     : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType >
22   {
23   public:
24     typedef _TInputImage TInputImage;
25     typedef _TLabelImage TLabelImage;
26     typedef typename TLabelImage::PixelType TLabel;
27     typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, TLabel > Superclass;
28     typedef typename Superclass::TInternalTraits  TInternalTraits;
29     typedef typename Superclass::TMarksImage      TMarksImage;
30     typedef typename Superclass::TFilterInterface TFilterInterface;
31
32     typedef fpa::Filters::BaseMarksInterface< TInternalTraits >  TMarksInterface;
33     typedef fpa::Filters::Image::SeedsFromLabelsInterface< TInternalTraits > TSeedsInterface;
34   };
35
36   /**
37    */
38   template< class _TInputImage, class _TLabelImage >
39   class MoriLabelling
40     : public fpa::Filters::Image::RegionGrow< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType, CTBronchi::MoriLabellingTraits< _TInputImage, _TLabelImage > >
41   {
42   public:
43     typedef _TInputImage TInputImage;
44     typedef _TLabelImage TLabelImage;
45     typedef CTBronchi::MoriLabellingTraits< TInputImage, TLabelImage > TTraits;
46     fpaTraitsMacro( typename TTraits );
47
48     typedef fpa::Filters::Image::RegionGrow< TInputImage, TLabelImage, TMark, TTraits > Superclass;
49     typedef MoriLabelling                   Self;
50     typedef itk::SmartPointer< Self >       Pointer;
51     typedef itk::SmartPointer< const Self > ConstPointer;
52     typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TFunctor;
53
54   public:
55     itkNewMacro( Self );
56     itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow );
57
58     itkGetConstMacro( LastThreshold, TInputValue );
59     itkSetMacro( LastThreshold, TInputValue );
60
61     fpaFilterInputMacro( InputLabels, TLabelImage );
62
63   public:
64     TInputValue GetUpperThreshold( ) const;
65     void SetUpperThreshold( TInputValue t );
66
67   protected:
68     MoriLabelling( );
69     virtual ~MoriLabelling( );
70
71     virtual const itk::DataObject* _GetReferenceInput( ) const override;
72     virtual void _PostComputeOutputValue( TNode& n ) override;
73
74   private:
75     // Purposely not implemented.
76     MoriLabelling( const Self& other );
77     Self& operator=( const Self& other );
78
79   protected:
80     typename TFunctor::Pointer m_Functor;
81     TInputValue m_LastThreshold;
82   };
83
84 } // ecapseman
85
86 #ifndef ITK_MANUAL_INSTANTIATION
87 #  include <CTBronchi/MoriLabelling.hxx>
88 #endif // ITK_MANUAL_INSTANTIATION
89
90 #endif // __CTBronchi__MoriLabelling__h__
91
92 // eof - $RCSfile$