]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/SpatialObjectMaskImageFilter.h
...
[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 <itkInPlaceImageFilter.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::InPlaceImageFilter< I, O >
17     {
18     public:
19       typedef SpatialObjectMaskImageFilter    Self;
20       typedef itk::InPlaceImageFilter< 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       // Begin concept checking
32       itkConceptMacro(
33         SameDimensionCheck1,
34         ( itk::Concept::SameDimension< InputDimension, OutputDimension > )
35         );
36       // End concept checking
37 #endif
38
39       typedef typename I::RegionType TRegion;
40       typedef typename O::PixelType  TOutPixel;
41       typedef itk::SpatialObject< InputDimension > TSpatialObject;
42
43     public:
44       itkNewMacro( Self );
45       itkTypeMacro( SpatialObjectMaskImageFilter, itk::InPlaceImageFilter );
46
47       itkGetObjectMacro( SpatialObject, TSpatialObject );
48       itkGetConstObjectMacro( SpatialObject, TSpatialObject );
49       itkGetConstMacro( OutsideValue, TOutPixel );
50
51       itkSetObjectMacro( SpatialObject, TSpatialObject );
52       itkSetMacro( OutsideValue, TOutPixel );
53
54     protected:
55       SpatialObjectMaskImageFilter( );
56       virtual ~SpatialObjectMaskImageFilter( );
57
58       virtual void GenerateOutputInformation( );
59       virtual void ThreadedGenerateData(
60         const TRegion& region, itk::ThreadIdType threadId
61         );
62
63     private:
64       // Purposely not implemented.
65       SpatialObjectMaskImageFilter( const Self& other );
66       Self& operator=( const Self& other );
67
68     protected:
69       typename TSpatialObject::Pointer m_SpatialObject;
70       TOutPixel m_OutsideValue;
71     };
72
73   } // ecapseman
74
75 } // ecapseman
76
77 #ifndef ITK_MANUAL_INSTANTIATION
78 #include <cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx>
79 #endif // ITK_MANUAL_INSTANTIATION
80
81 #endif // __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
82
83 // eof - $RCSfile$