--- /dev/null
+#ifndef __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
+#define __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
+
+#include <itkConceptChecking.h>
+#include <itkImageToImageFilter.h>
+#include <itkSpatialObject.h>
+
+namespace cpExtensions
+{
+ namespace Algorithms
+ {
+ /**
+ */
+ template< class I, class O = I >
+ class SpatialObjectMaskImageFilter
+ : public itk::ImageToImageFilter< I, O >
+ {
+ public:
+ typedef SpatialObjectMaskImageFilter Self;
+ typedef itk::ImageToImageFilter< I, O > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef I TInputImage;
+ typedef O TOutputImage;
+
+ itkStaticConstMacro( InputDimension, unsigned int, I::ImageDimension );
+ itkStaticConstMacro( OutputDimension, unsigned int, O::ImageDimension );
+
+#ifdef ITK_USE_CONCEPT_CHECKING
+ itkConceptMacro(
+ SameDimensionCheck1,
+ ( itk::Concept::SameDimension< InputDimension, OutputDimension > )
+ );
+#endif
+
+ typedef typename I::RegionType TRegion;
+ typedef typename O::PixelType TOutPixel;
+ typedef itk::SpatialObject< InputDimension > TSpatialObject;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( SpatialObjectMaskImageFilter, itk::ImageToImageFilter );
+
+ itkGetObjectMacro( SpatialObject, TSpatialObject );
+ itkGetConstObjectMacro( SpatialObject, TSpatialObject );
+ itkGetConstMacro( OutsideValue, TOutPixel );
+
+ itkSetObjectMacro( SpatialObject, TSpatialObject );
+ itkSetMacro( OutsideValue, TOutPixel );
+
+ public:
+ O* GetPositiveOutput( );
+ const O* GetPositiveOutput( ) const;
+ O* GetNegativeOutput( );
+ const O* GetNegativeOutput( ) const;
+
+ protected:
+ SpatialObjectMaskImageFilter( );
+ virtual ~SpatialObjectMaskImageFilter( );
+
+ virtual void GenerateOutputInformation( );
+ virtual void ThreadedGenerateData(
+ const TRegion& region, itk::ThreadIdType threadId
+ );
+
+ private:
+ // Purposely not implemented.
+ SpatialObjectMaskImageFilter( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ typename TSpatialObject::Pointer m_SpatialObject;
+ TOutPixel m_OutsideValue;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include <cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__H__
+
+// eof - $RCSfile$