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 >
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>
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
00111 #ifdef ITK_USE_CONCEPT_CHECKING
00112
00113 itkConceptMacro(MaskEqualityComparableCheck,
00114 (Concept::EqualityComparable<typename TMaskImage::PixelType>));
00115 itkConceptMacro(InputConvertibleToOutputCheck,
00116 (Concept::Convertible<typename TInputImage::PixelType,
00117 typename TOutputImage::PixelType>));
00118
00120 #endif
00121
00122 protected:
00123 MaskNegatedImageFilter() {}
00124 virtual ~MaskNegatedImageFilter() {}
00125
00126 private:
00127 MaskNegatedImageFilter(const Self&);
00128 void operator=(const Self&);
00129
00130 };
00131
00132 }
00133
00134
00135 #endif
00136