#ifndef __itkEqualImageFilter_h #define __itkEqualImageFilter_h #include "itkBinaryFunctorImageFilter.h" #include "itkNumericTraits.h" namespace itk { /** \class EqualImageFilter * \brief Implements the Equal logical operator pixel-wise between two images. * * This class is parametrized over the types of the two * input images and the type of the output image. * Numeric conversions (castings) are done by the C++ defaults. * * * The total operation over one pixel will be * * output_pixel = static_cast( input1_pixel == input2_pixel ) * * Where "==" is the equality operator in C++. * * \ingroup IntensityImageFilters Multithreaded */ namespace Functor { template< class TInput1, class TInput2=TInput1, class TOutput=TInput1 > class EQUAL { public: EQUAL() {}; ~EQUAL() {}; bool operator!=( const EQUAL & ) const { return false; } bool operator==( const EQUAL & other ) const { return !(*this != other); } inline TOutput operator()( const TInput1 & A, const TInput2 & B) { return static_cast( A == B ); } }; } template class ITK_EXPORT EqualImageFilter : public BinaryFunctorImageFilter > { public: /** Standard class typedefs. */ typedef EqualImageFilter Self; typedef BinaryFunctorImageFilter > Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(Input1Input2OutputLogicalOperatorsCheck, (Concept::LogicalOperators)); /** End concept checking */ #endif protected: EqualImageFilter() {} virtual ~EqualImageFilter() {} private: EqualImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace itk #endif