X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FCTBronchi%2FMoriLabelling.h;h=d4eea090eec3e1a9ad02d6229d885ed439afaf77;hb=b69a5d04d117c1fdd297999c4fb034db54911aca;hp=eecb4ad52910e2aa11df53acea7a1a79cf8a4268;hpb=e97624b0f1db169d85337d9045bce1bbd83f72e4;p=FrontAlgorithms.git diff --git a/appli/CTBronchi/MoriLabelling.h b/appli/CTBronchi/MoriLabelling.h index eecb4ad..d4eea09 100644 --- a/appli/CTBronchi/MoriLabelling.h +++ b/appli/CTBronchi/MoriLabelling.h @@ -2,72 +2,71 @@ // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= - #ifndef __CTBronchi__MoriLabelling__h__ #define __CTBronchi__MoriLabelling__h__ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace CTBronchi { /** */ template< class _TInputImage, class _TLabelImage > - class MoriLabelling - : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TInputImage, _TLabelImage, fpa::Base::MarksInterface< typename _TInputImage::IndexType >, fpa::Image::LabelledSeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, typename _TLabelImage::PixelType, typename _TLabelImage::PixelType, typename _TInputImage::IndexType::LexicographicCompare > > > + class MoriLabellingTraits + : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType > { public: typedef _TInputImage TInputImage; typedef _TLabelImage TLabelImage; - typedef typename TInputImage::PixelType TInputValue; - typedef typename TInputImage::PointType TPoint; - typedef typename TInputImage::IndexType TVertex; - typedef typename TLabelImage::PixelType TOutputValue; - typedef typename TVertex::LexicographicCompare TVertexCompare; + typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, typename TLabelImage::PixelType > Superclass; - typedef fpa::Base::MarksInterface< TVertex > TMarksInterface; - typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TOutputValue, TVertexCompare > TSeedsInterface; - typedef fpa::Image::Algorithm< TInputImage, TLabelImage, TMarksInterface, TSeedsInterface > TAlgorithm; + typedef typename Superclass::TInternalTraits TInternalTraits; + typedef typename Superclass::TFilter TFilter; + typedef fpa::Filters::MarksInterface< TInternalTraits > TMarksInterface; + typedef fpa::Filters::Image::LabelsSeedInterface< TInternalTraits > TSeedsInterface; + }; - typedef MoriLabelling Self; - typedef fpa::Base::RegionGrow< TAlgorithm > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + /** + */ + 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 typename TSeedsInterface::TNode TNode; - typedef typename TSeedsInterface::TNodes TNodes; + typedef fpa::Filters::RegionGrow< TTraits > TBase; + typedef fpa::Filters::Image::Algorithm< TBase > 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::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TThresholdFunction; + typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TLabelFunctor; public: itkNewMacro( Self ); - itkTypeMacro( MoriLabelling, fpa::Base::RegionGrow ); + itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow ); - itkGetConstMacro( InsideLabel, TOutputValue ); - itkSetMacro( InsideLabel, TOutputValue ); + itkGetConstMacro( InputInsideValue, TInputValue ); + itkSetMacro( InputInsideValue, TInputValue ); 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: @@ -76,7 +75,8 @@ namespace CTBronchi Self& operator=( const Self& other ); protected: - TOutputValue m_InsideLabel; + typename TLabelFunctor::Pointer m_LabelFunctor; + TInputValue m_InputInsideValue; }; } // ecapseman