1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Common__OriginalRandomWalker__h__
6 #define __fpa__Common__OriginalRandomWalker__h__
8 #include <fpa/Config.h>
11 #include <itkImageToImageFilter.h>
19 template< class _TImage, class _TLabels, class _TScalar = float >
20 class OriginalRandomWalker
21 : public itk::ImageToImageFilter< _TImage, _TLabels >
24 typedef _TImage TImage;
25 typedef _TLabels TLabels;
26 typedef _TScalar TScalar;
28 typedef OriginalRandomWalker Self;
29 typedef itk::ImageToImageFilter< TImage, TLabels > Superclass;
30 typedef itk::SmartPointer< Self > Pointer;
31 typedef itk::SmartPointer< const Self > ConstPointer;
33 typedef itk::Image< TScalar, TImage::ImageDimension > TScalarImage;
34 typedef typename TImage::IndexType TIndex;
35 typedef typename TImage::PixelType TPixel;
36 typedef typename TImage::RegionType TRegion;
37 typedef typename TLabels::PixelType TLabel;
42 fpa::Common::OriginalRandomWalker, itk::ImageToImageFilter
45 itkGetConstMacro( Beta, TScalar );
46 itkSetMacro( Beta, TScalar );
48 itkGetConstMacro( Epsilon, TScalar );
49 itkSetMacro( Epsilon, TScalar );
51 itkBooleanMacro( NormalizeWeights );
52 itkGetConstMacro( NormalizeWeights, bool );
53 itkSetMacro( NormalizeWeights, bool );
55 fpaFilterInputMacro( InputLabels, TLabels );
56 fpaFilterOutputMacro( OutputProbabilities, TScalarImage );
59 void AddSeed( const TIndex& seed, const TLabel& label );
62 OriginalRandomWalker( );
63 virtual ~OriginalRandomWalker( );
65 virtual void GenerateData( ) override;
67 static unsigned long _1D( const TIndex& idx, const TRegion& region );
68 static TIndex _ND( const unsigned long& i, const TRegion& region );
71 // Purposely not implemented
72 OriginalRandomWalker( const Self& other );
73 Self& operator=( const Self& other );
76 std::vector< TIndex > m_Seeds;
77 std::vector< TLabel > m_Labels;
81 bool m_NormalizeWeights;
88 #ifndef ITK_MANUAL_INSTANTIATION
89 # include <fpa/Common/OriginalRandomWalker.hxx>
90 #endif // ITK_MANUAL_INSTANTIATION
91 #endif // __fpa__Common__OriginalRandomWalker__h__