]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/SpatialObjectMaskImageFilter.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Algorithms / SpatialObjectMaskImageFilter.h
1 #ifndef __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
2 #define __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
3
4 #include <itkConceptChecking.h>
5 #include <itkImageToImageFilter.h>
6 #include <itkSpatialObject.h>
7
8 namespace cpExtensions
9 {
10   namespace Algorithms
11   {
12     /**
13      */
14     template< class I, class O = I >
15     class SpatialObjectMaskImageFilter
16       : public itk::ImageToImageFilter< I, O >
17     {
18     public:
19       typedef SpatialObjectMaskImageFilter    Self;
20       typedef itk::ImageToImageFilter< I, O > Superclass;
21       typedef itk::SmartPointer< Self >       Pointer;
22       typedef itk::SmartPointer< const Self > ConstPointer;
23
24       typedef I TInputImage;
25       typedef O TOutputImage;
26
27       itkStaticConstMacro( InputDimension, unsigned int, I::ImageDimension );
28       itkStaticConstMacro( OutputDimension, unsigned int, O::ImageDimension );
29
30 #ifdef ITK_USE_CONCEPT_CHECKING
31       itkConceptMacro(
32         SameDimensionCheck1,
33         ( itk::Concept::SameDimension< InputDimension, OutputDimension > )
34         );
35 #endif
36
37       typedef typename I::RegionType TRegion;
38       typedef typename O::PixelType  TOutPixel;
39       typedef itk::SpatialObject< InputDimension > TSpatialObject;
40
41     public:
42       itkNewMacro( Self );
43       itkTypeMacro( SpatialObjectMaskImageFilter, itk::ImageToImageFilter );
44
45       itkGetObjectMacro( SpatialObject, TSpatialObject );
46       itkGetConstObjectMacro( SpatialObject, TSpatialObject );
47       itkGetConstMacro( OutsideValue, TOutPixel );
48
49       itkSetObjectMacro( SpatialObject, TSpatialObject );
50       itkSetMacro( OutsideValue, TOutPixel );
51
52     public:
53       O* GetPositiveOutput( );
54       const O* GetPositiveOutput( ) const;
55       O* GetNegativeOutput( );
56       const O* GetNegativeOutput( ) const;
57
58     protected:
59       SpatialObjectMaskImageFilter( );
60       virtual ~SpatialObjectMaskImageFilter( );
61
62       virtual void GenerateOutputInformation( );
63       virtual void ThreadedGenerateData(
64         const TRegion& region, itk::ThreadIdType threadId
65         );
66
67     private:
68       // Purposely not implemented.
69       SpatialObjectMaskImageFilter( const Self& other );
70       Self& operator=( const Self& other );
71
72     protected:
73       typename TSpatialObject::Pointer m_SpatialObject;
74       TOutPixel m_OutsideValue;
75     };
76
77   } // ecapseman
78
79 } // ecapseman
80
81 #ifndef ITK_MANUAL_INSTANTIATION
82 #include <cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx>
83 #endif // ITK_MANUAL_INSTANTIATION
84
85 #endif // __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
86
87 // eof - $RCSfile$