X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FCTBronchi%2FMoriLabelling.h;h=caa96aab98be496910be43883512c1a35ff71ea0;hb=b6c80dbd5be1caf6cbdbfc21d2075021c57d7af2;hp=0a9c58609735f86daea46fd91cb60c9ef4518333;hpb=03200c96631e0c6e35b5be9c78d651185efcbdf2;p=FrontAlgorithms.git diff --git a/appli/CTBronchi/MoriLabelling.h b/appli/CTBronchi/MoriLabelling.h index 0a9c586..caa96aa 100644 --- a/appli/CTBronchi/MoriLabelling.h +++ b/appli/CTBronchi/MoriLabelling.h @@ -6,6 +6,13 @@ #ifndef __CTBronchi__MoriLabelling__h__ #define __CTBronchi__MoriLabelling__h__ +#include +#include +#include +#include +#include +#include + /* TODO #include #include @@ -19,64 +26,63 @@ namespace CTBronchi { /** */ - /* TODO - template< class _TInputImage, class _TLabelImage, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType > > - class MoriLabelling - : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Image::LabelledSeedsInterface< _TTraits > > > - { - public: - typedef _TInputImage TInputImage; - typedef _TLabelImage TLabelImage; - typedef _TTraits TTraits; - fpa_Base_TraitTypes( typename TTraits ); - - typedef fpa::Base::MarksInterface< TTraits > TMarksInterface; - typedef fpa::Image::LabelledSeedsInterface< TTraits > TSeedsInterface; - typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm; - - typedef MoriLabelling Self; - typedef fpa::Base::RegionGrow< TAlgorithm > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TThresholdFunction; - - public: - itkNewMacro( Self ); - itkTypeMacro( MoriLabelling, fpa::Base::RegionGrow ); - - itkGetConstMacro( InsideLabel, TOutputValue ); - itkSetMacro( InsideLabel, TOutputValue ); - - public: - const TLabelImage* GetInputLabelImage( ) const; - void SetInputLabelImage( TLabelImage* image ); - - const TInputImage* GetInputRawImage( ) const; - void SetInputRawImage( TInputImage* image ); - - TInputValue GetUpperThreshold( ) const; - void SetUpperThreshold( TInputValue t ); - - TOutputValue GetOutsideValue( ) const; - void SetOutsideLabel( TOutputValue o ); - - protected: - MoriLabelling( ); - virtual ~MoriLabelling( ); - - virtual TNodes _UnifySeeds( ) override; - virtual void _UpdateOutputValue( TNode& n ) override; - - private: - // Purposely not implemented. - MoriLabelling( const Self& other ); - Self& operator=( const Self& other ); - - protected: - TOutputValue m_InsideLabel; - }; - */ + template< class _TInputImage, class _TLabelImage > + class MoriLabellingTraits + : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType > + { + public: + typedef _TInputImage TInputImage; + typedef _TLabelImage TLabelImage; + typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, typename TLabelImage::PixelType > Superclass; + + typedef typename Superclass::TInternalTraits TInternalTraits; + typedef typename Superclass::TFilter TFilter; + typedef fpa::Filters::MarksInterface< TInternalTraits > TMarksInterface; + typedef fpa::Filters::Image::LabelsSeedInterface< TInternalTraits > TSeedsInterface; + }; + + /** + */ + template< class _TInputImage, class _TLabelImage > + class MoriLabelling + : public fpa::Filters::Image::LabelsSeedFilter< fpa::Filters::Image::Algorithm< fpa::Filters::RegionGrow< CTBronchi::MoriLabellingTraits< _TInputImage, _TLabelImage > > >, _TLabelImage > + { + public: + typedef _TInputImage TInputImage; + typedef _TLabelImage TLabelImage; + typedef CTBronchi::MoriLabellingTraits< TInputImage, TLabelImage > TTraits; + fpaTraitsMacro( typename, TTraits ); + + typedef fpa::Filters::Image::Algorithm< fpa::Filters::RegionGrow< TTraits > > TAlgorithm; + typedef fpa::Filters::Image::LabelsSeedFilter< TAlgorithm, _TLabelImage > Superclass; + typedef MoriLabelling Self; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TLabelFunctor; + + public: + itkNewMacro( Self ); + itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow ); + + public: + TInputValue GetUpperThreshold( ) const; + void SetUpperThreshold( TInputValue t ); + + protected: + MoriLabelling( ); + virtual ~MoriLabelling( ); + + virtual void _UpdateOutputValue( TNode& n ) override; + + private: + // Purposely not implemented. + MoriLabelling( const Self& other ); + Self& operator=( const Self& other ); + + protected: + typename TLabelFunctor::Pointer m_LabelFunctor; + }; } // ecapseman