00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMaskImageFilter_h
00018 #define __itkMaskImageFilter_h
00019
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022
00023
00024 namespace itk
00025 {
00026
00049 namespace Functor {
00050
00051 template< class TInput, class TMask, class TOutput >
00052 class MaskInput
00053 {
00054 public:
00055 typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00056
00057 MaskInput() {};
00058 ~MaskInput() {};
00059 inline TOutput operator()( const TInput & A, const TMask & B)
00060 {
00061 if (B != 0)
00062 {
00063 return static_cast<TOutput>( A );
00064 }
00065 else
00066 return NumericTraits< TOutput >::Zero;
00067
00068 }
00069 };
00070
00071 }
00072 template <class TInputImage, class TMaskImage, class TOutputImage>
00073 class ITK_EXPORT MaskImageFilter :
00074 public
00075 BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage,
00076 Functor::MaskInput<
00077 typename TInputImage::PixelType,
00078 typename TMaskImage::PixelType,
00079 typename TOutputImage::PixelType> >
00080
00081
00082 {
00083 public:
00085 typedef MaskImageFilter Self;
00086 typedef BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage,
00087 Functor::MaskInput<
00088 typename TInputImage::PixelType,
00089 typename TMaskImage::PixelType,
00090 typename TOutputImage::PixelType>
00091 > Superclass;
00092 typedef SmartPointer<Self> Pointer;
00093 typedef SmartPointer<const Self> ConstPointer;
00094
00096 itkNewMacro(Self);
00097
00098 protected:
00099 MaskImageFilter() {}
00100 virtual ~MaskImageFilter() {}
00101
00102 private:
00103 MaskImageFilter(const Self&);
00104 void operator=(const Self&);
00105
00106 };
00107
00108 }
00109
00110
00111 #endif