1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __cpExtensions__Algorithms__RasterContourFilter__h__
6 #define __cpExtensions__Algorithms__RasterContourFilter__h__
8 #include <cpExtensions/Config.h>
9 #include <itkImageSource.h>
10 #include <vtkSmartPointer.h>
12 // -------------------------------------------------------------------------
16 // -------------------------------------------------------------------------
17 namespace cpExtensions
23 template< class _TImage >
24 class RasterContourFilter
25 : public itk::ImageSource< _TImage >
29 typedef RasterContourFilter Self;
30 typedef itk::ImageSource< _TImage > Superclass;
31 typedef itk::SmartPointer< Self > Pointer;
32 typedef itk::SmartPointer< const Self > ConstPointer;
34 typedef _TImage TImage;
35 typedef typename _TImage::IndexType TIndex;
36 typedef typename _TImage::PixelType TPixel;
37 typedef typename _TImage::PointType TPoint;
38 typedef typename _TImage::RegionType TRegion;
39 typedef itk::ImageBase< 2 > TImageBase;
43 itkTypeMacro( RasterContourFilter, itk::ImageSource );
45 itkGetConstObjectMacro( Template, TImageBase );
46 itkGetConstMacro( InsideValue, TPixel );
47 itkGetConstMacro( OutsideValue, TPixel );
49 itkSetConstObjectMacro( Template, TImageBase );
50 itkSetMacro( InsideValue, TPixel );
51 itkSetMacro( OutsideValue, TPixel );
54 void AddPoint( double x, double y );
55 void AddPoint( double p[ 2 ] );
56 void AddPoints( vtkPoints* points );
60 RasterContourFilter( );
61 virtual ~RasterContourFilter( );
63 virtual void AllocateOutputs( ) cpExtensions_OVERRIDE;
64 virtual void BeforeThreadedGenerateData( ) cpExtensions_OVERRIDE;
65 virtual void AfterThreadedGenerateData( ) cpExtensions_OVERRIDE;
66 virtual void ThreadedGenerateData(
67 const TRegion& region, itk::ThreadIdType id
68 ) cpExtensions_OVERRIDE;
71 // Purposely not implemented
72 RasterContourFilter( const Self& );
73 void operator=( const Self& );
76 vtkSmartPointer< vtkPolygon > m_Polygon;
77 typename TImageBase::ConstPointer m_Template;
79 TPixel m_OutsideValue;
86 #ifndef ITK_MANUAL_INSTANTIATION
87 # include <cpExtensions/Algorithms/RasterContourFilter.hxx>
88 #endif // ITK_MANUAL_INSTANTIATION
90 #endif // __cpExtensions__Algorithms__RasterContourFilter__h__