// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #ifndef __cpExtensions__Algorithms__RasterContourFilter__h__ #define __cpExtensions__Algorithms__RasterContourFilter__h__ #include #include #include // ------------------------------------------------------------------------- class vtkPoints; class vtkPolygon; // ------------------------------------------------------------------------- namespace cpExtensions { namespace Algorithms { /** */ template< class _TImage > class RasterContourFilter : public itk::ImageSource< _TImage > { public: // Basic types typedef RasterContourFilter Self; typedef itk::ImageSource< _TImage > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef _TImage TImage; typedef typename _TImage::IndexType TIndex; typedef typename _TImage::PixelType TPixel; typedef typename _TImage::PointType TPoint; typedef typename _TImage::RegionType TRegion; typedef itk::ImageBase< 2 > TImageBase; public: itkNewMacro( Self ); itkTypeMacro( RasterContourFilter, itk::ImageSource ); itkGetConstObjectMacro( Template, TImageBase ); itkGetConstMacro( InsideValue, TPixel ); itkGetConstMacro( OutsideValue, TPixel ); itkSetConstObjectMacro( Template, TImageBase ); itkSetMacro( InsideValue, TPixel ); itkSetMacro( OutsideValue, TPixel ); public: void AddPoint( double x, double y ); void AddPoint( double p[ 2 ] ); void AddPoints( vtkPoints* points ); void ClearPoints( ); protected: RasterContourFilter( ); virtual ~RasterContourFilter( ); virtual void AllocateOutputs( ) cpExtensions_OVERRIDE; virtual void BeforeThreadedGenerateData( ) cpExtensions_OVERRIDE; virtual void AfterThreadedGenerateData( ) cpExtensions_OVERRIDE; virtual void ThreadedGenerateData( const TRegion& region, itk::ThreadIdType id ) cpExtensions_OVERRIDE; private: // Purposely not implemented RasterContourFilter( const Self& ); void operator=( const Self& ); protected: vtkSmartPointer< vtkPolygon > m_Polygon; typename TImageBase::ConstPointer m_Template; TPixel m_InsideValue; TPixel m_OutsideValue; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION # include #endif // ITK_MANUAL_INSTANTIATION #endif // __cpExtensions__Algorithms__RasterContourFilter__h__ // eof - $RCSfile$