// @author Leonardo Florez Valencia
// @email florez-l@javeriana.edu.co
// =========================================================================
-
#ifndef __CTBronchi__MoriLabelling__h__
#define __CTBronchi__MoriLabelling__h__
-#include <fpa/Base/RegionGrow.h>
-#include <fpa/Base/MarksInterface.h>
-#include <fpa/Base/Functors/RegionGrow/BinaryThreshold.h>
-#include <fpa/Image/Algorithm.h>
-#include <fpa/Image/LabelledSeedsInterface.h>
+#include <map>
+#include <fpa/Filters/BaseMarksInterface.h>
+#include <fpa/Filters/Image/SeedsFromLabelsInterface.h>
+#include <fpa/Filters/Image/DefaultTraits.h>
+#include <fpa/Filters/Image/RegionGrow.h>
+#include <fpa/Functors/RegionGrow/BinaryThreshold.h>
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::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 MoriLabelling Self;
- typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef typename TLabelImage::PixelType TLabel;
+ typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, TLabel > Superclass;
+ typedef typename Superclass::TInternalTraits TInternalTraits;
+ typedef typename Superclass::TMarksImage TMarksImage;
+ typedef typename Superclass::TFilterInterface TFilterInterface;
+
+ typedef fpa::Filters::BaseMarksInterface< TInternalTraits > TMarksInterface;
+ typedef fpa::Filters::Image::SeedsFromLabelsInterface< TInternalTraits > TSeedsInterface;
+ };
- typedef typename TSeedsInterface::TNode TNode;
- typedef typename TSeedsInterface::TNodes TNodes;
+ /**
+ */
+ template< class _TInputImage, class _TLabelImage >
+ class MoriLabelling
+ : public fpa::Filters::Image::RegionGrow< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType, CTBronchi::MoriLabellingTraits< _TInputImage, _TLabelImage > >
+ {
+ public:
+ typedef _TInputImage TInputImage;
+ typedef _TLabelImage TLabelImage;
+ typedef CTBronchi::MoriLabellingTraits< TInputImage, TLabelImage > TTraits;
+ fpaTraitsMacro( typename TTraits );
- typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TThresholdFunction;
+ typedef fpa::Filters::Image::RegionGrow< TInputImage, TLabelImage, TMark, TTraits > Superclass;
+ typedef MoriLabelling Self;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TFunctor;
public:
itkNewMacro( Self );
- itkTypeMacro( MoriLabelling, fpa::Base::RegionGrow );
+ itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow );
- itkGetConstMacro( InsideLabel, TOutputValue );
- itkSetMacro( InsideLabel, TOutputValue );
+ itkGetConstMacro( LastThreshold, TInputValue );
+ itkSetMacro( LastThreshold, TInputValue );
- public:
- const TLabelImage* GetInputLabelImage( ) const;
- void SetInputLabelImage( TLabelImage* image );
-
- const TInputImage* GetInputRawImage( ) const;
- void SetInputRawImage( TInputImage* image );
+ fpaFilterInputMacro( InputLabels, TLabelImage );
+ public:
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;
+ virtual const itk::DataObject* _GetReferenceInput( ) const override;
+ virtual void _PostComputeOutputValue( TNode& n ) override;
private:
// Purposely not implemented.
Self& operator=( const Self& other );
protected:
- TOutputValue m_InsideLabel;
+ typename TFunctor::Pointer m_Functor;
+ TInputValue m_LastThreshold;
};
} // ecapseman