1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __RandomWalkSegmentation__h__
5 #define __RandomWalkSegmentation__h__
7 #include <itkImageToImageFilter.h>
8 #include <fpa/Config.h>
9 #include <fpa/DataStructures/Image/Path.h>
13 template< class _TInputImage, class _TOutputImage >
14 class RandomWalkSegmentation
15 : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
18 typedef _TInputImage TInputImage;
19 typedef _TOutputImage TOutputImage;
21 typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
22 typedef RandomWalkSegmentation Self;
23 typedef itk::SmartPointer< Self > Pointer;
24 typedef itk::SmartPointer< const Self > ConstPointer;
26 typedef typename TInputImage::IndexType TIndex;
27 typedef typename TInputImage::PointType TPoint;
35 typedef fpa::DataStructures::Image::Path< TInputImage::ImageDimension > TPath;
39 itkTypeMacro( RandomWalkSegmentation, itk::ImageToImageFilter );
41 itkGetConstMacro( StartSeed, TSeed );
42 itkGetConstMacro( EndSeed, TSeed );
44 itkGetConstMacro( Beta, double );
45 itkSetMacro( Beta, double );
47 itkGetConstMacro( Sigma, double );
48 itkSetMacro( Sigma, double );
50 itkGetConstMacro( Radius, double );
51 itkSetMacro( Radius, double );
53 fpaFilterOutputMacro( OutputAxis, TPath );
56 void AddSeed( const TIndex& s );
57 void AddSeed( const TPoint& s );
59 unsigned long GetNumberOfSeeds( ) const;
61 void SetStartSeed( const TIndex& s );
62 void SetStartSeed( const TPoint& s );
64 void SetEndSeed( const TIndex& s );
65 void SetEndSeed( const TPoint& s );
68 RandomWalkSegmentation( );
69 virtual ~RandomWalkSegmentation( );
71 virtual void GenerateData( ) override;
74 template< class _TImage >
75 void _save( _TImage* image, const std::string& fname );
78 // Purposely not implemented
79 RandomWalkSegmentation( const Self& other );
80 Self& operator=( const Self& other );
85 std::vector< TSeed > m_Seeds;
92 #ifndef ITK_MANUAL_INSTANTIATION
93 # include "RandomWalkSegmentation.hxx"
94 #endif // ITK_MANUAL_INSTANTIATION
96 #endif // __RandomWalkSegmentation__h__