// ========================================================================= // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ========================================================================= #ifndef __RandomWalkSegmentation__h__ #define __RandomWalkSegmentation__h__ #include #include #include /** */ template< class _TInputImage, class _TOutputImage > class RandomWalkSegmentation : public itk::ImageToImageFilter< _TInputImage, _TOutputImage > { public: typedef _TInputImage TInputImage; typedef _TOutputImage TOutputImage; typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass; typedef RandomWalkSegmentation Self; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef typename TInputImage::IndexType TIndex; typedef typename TInputImage::PointType TPoint; struct TSeed { TIndex Index; TPoint Point; bool IsPoint; }; typedef fpa::DataStructures::Image::Path< TInputImage::ImageDimension > TPath; public: itkNewMacro( Self ); itkTypeMacro( RandomWalkSegmentation, itk::ImageToImageFilter ); itkGetConstMacro( StartSeed, TSeed ); itkGetConstMacro( EndSeed, TSeed ); itkGetConstMacro( Beta, double ); itkSetMacro( Beta, double ); itkGetConstMacro( Sigma, double ); itkSetMacro( Sigma, double ); itkGetConstMacro( Radius, double ); itkSetMacro( Radius, double ); fpaFilterOutputMacro( OutputAxis, TPath ); public: void AddSeed( const TIndex& s ); void AddSeed( const TPoint& s ); void ClearSeeds( ); unsigned long GetNumberOfSeeds( ) const; void SetStartSeed( const TIndex& s ); void SetStartSeed( const TPoint& s ); void SetEndSeed( const TIndex& s ); void SetEndSeed( const TPoint& s ); protected: RandomWalkSegmentation( ); virtual ~RandomWalkSegmentation( ); virtual void GenerateData( ) override; private: template< class _TImage > void _save( _TImage* image, const std::string& fname ); private: // Purposely not implemented RandomWalkSegmentation( const Self& other ); Self& operator=( const Self& other ); protected: TSeed m_StartSeed; TSeed m_EndSeed; std::vector< TSeed > m_Seeds; double m_Beta; double m_Sigma; double m_Radius; }; #ifndef ITK_MANUAL_INSTANTIATION # include "RandomWalkSegmentation.hxx" #endif // ITK_MANUAL_INSTANTIATION #endif // __RandomWalkSegmentation__h__ // eof - $RCSfile$