00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMaskNegatedImageFilter_h
00018 #define __itkMaskNegatedImageFilter_h
00019
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022
00023
00024 namespace itk
00025 {
00026
00053 namespace Functor {
00054
00055 template< class TInput, class TMask, class TOutput=TInput >
00056 class MaskNegatedInput
00057 {
00058 public:
00059 typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00060
00061 MaskNegatedInput() {};
00062 ~MaskNegatedInput() {};
00063 bool operator!=( const MaskNegatedInput & ) const
00064 {
00065 return false;
00066 }
00067 bool operator==( const MaskNegatedInput & other ) const
00068 {
00069 return !(*this != other);
00070 }
00071 inline TOutput operator()( const TInput & A, const TMask & B)
00072 {
00073 if (B != NumericTraits< TMask >::Zero )
00074 {
00075 return NumericTraits< TOutput >::Zero;
00076 }
00077 else
00078 {
00079 return static_cast<TOutput>( A );
00080 }
00081 }
00082 };
00083
00084 }
00085 template <class TInputImage, class TMaskImage, class TOutputImage=TInputImage>
00086 class ITK_EXPORT MaskNegatedImageFilter :
00087 public
00088 BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage,
00089 Functor::MaskNegatedInput<
00090 typename TInputImage::PixelType,
00091 typename TMaskImage::PixelType,
00092 typename TOutputImage::PixelType> >
00093
00094
00095 {
00096 public:
00098 typedef MaskNegatedImageFilter Self;
00099 typedef BinaryFunctorImageFilter<TInputImage,TMaskImage,TOutputImage,
00100 Functor::MaskNegatedInput<
00101 typename TInputImage::PixelType,
00102 typename TMaskImage::PixelType,
00103 typename TOutputImage::PixelType>
00104 > Superclass;
00105 typedef SmartPointer<Self> Pointer;
00106 typedef SmartPointer<const Self> ConstPointer;
00107
00109 itkNewMacro(Self);
00110
00112 itkTypeMacro(MaskNegatedImageFilter,
00113 BinaryFunctorImageFilter);
00114
00115 #ifdef ITK_USE_CONCEPT_CHECKING
00116
00117 itkConceptMacro(MaskEqualityComparableCheck,
00118 (Concept::EqualityComparable<typename TMaskImage::PixelType>));
00119 itkConceptMacro(InputConvertibleToOutputCheck,
00120 (Concept::Convertible<typename TInputImage::PixelType,
00121 typename TOutputImage::PixelType>));
00122
00124 #endif
00125
00126 protected:
00127 MaskNegatedImageFilter() {}
00128 virtual ~MaskNegatedImageFilter() {}
00129
00130 private:
00131 MaskNegatedImageFilter(const Self&);
00132 void operator=(const Self&);
00133
00134 };
00135
00136 }
00137
00138
00139 #endif
00140