00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef __itkXorImageFilter_h
00018 #define __itkXorImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00046 namespace Functor {  
00047   
00048 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1 >
00049 class XOR
00050 {
00051 public:
00052   XOR() {};
00053   ~XOR() {};
00054   inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00055   {
00056     return static_cast<TOutput>( A ^ B );
00057   }
00058 }; 
00059 
00060 }
00061 template <class TInputImage1, class TInputImage2, class TOutputImage>
00062 class ITK_EXPORT XorImageFilter :
00063     public
00064 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00065                          Functor::XOR< 
00066   typename TInputImage1::PixelType, 
00067   typename TInputImage2::PixelType,
00068   typename TOutputImage::PixelType>   >
00069 
00070 
00071 {
00072 public:
00074   typedef XorImageFilter  Self;
00075   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00076                                    Functor::XOR< 
00077     typename TInputImage1::PixelType, 
00078     typename TInputImage2::PixelType,
00079     typename TOutputImage::PixelType>   
00080   >  Superclass;
00081   typedef SmartPointer<Self>   Pointer;
00082   typedef SmartPointer<const Self>  ConstPointer;
00083 
00085   itkNewMacro(Self);
00086   
00087 protected:
00088   XorImageFilter() {}
00089   virtual ~XorImageFilter() {}
00090 
00091 private:
00092   XorImageFilter(const Self&); 
00093   void operator=(const Self&); 
00094 
00095 };
00096 
00097 } 
00098 
00099 
00100 #endif