Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSubtractImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSubtractImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-18 16:11:14 $
00007   Version:   $Revision: 1.28 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkSubtractImageFilter_h
00018 #define __itkSubtractImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024   
00036 namespace Function {  
00037   
00038 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1>
00039 class Sub2
00040 {
00041 public:
00042   Sub2() {}
00043   ~Sub2() {}
00044   bool operator!=( const Sub2 & ) const
00045     {
00046     return false;
00047     }
00048   bool operator==( const Sub2 & other ) const
00049     {
00050     return !(*this != other);
00051     }
00052   inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00053     { return (TOutput)(A - B); }
00054 }; 
00055 }
00056 
00057 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
00058 class ITK_EXPORT SubtractImageFilter :
00059     public
00060 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00061                          Function::Sub2< 
00062   typename TInputImage1::PixelType, 
00063   typename TInputImage2::PixelType,
00064   typename TOutputImage::PixelType>   >
00065 {
00066 public:
00068   typedef SubtractImageFilter                            Self;
00069   typedef BinaryFunctorImageFilter<
00070     TInputImage1,TInputImage2,TOutputImage, 
00071     Function::Sub2< typename TInputImage1::PixelType, 
00072                     typename TInputImage2::PixelType,
00073                     typename TOutputImage::PixelType> >  Superclass;
00074   typedef SmartPointer<Self>                             Pointer;
00075   typedef SmartPointer<const Self>                       ConstPointer;
00076 
00077 
00079   itkNewMacro(Self);
00080 
00082   itkTypeMacro(SubtractImageFilter, 
00083                BinaryFunctorImageFilter);
00084 
00085 #ifdef ITK_USE_CONCEPT_CHECKING
00086 
00087   itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00088     (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00089                                 typename TInputImage2::PixelType,
00090                                 typename TOutputImage::PixelType>));
00091 
00093 #endif
00094 
00095 protected:
00096   SubtractImageFilter() {}
00097   virtual ~SubtractImageFilter() {}
00098 
00099 private:
00100   SubtractImageFilter(const Self&); //purposely not implemented
00101   void operator=(const Self&); //purposely not implemented
00102 
00103 
00104 };
00105 
00106 } // end namespace itk
00107 
00108 
00109 #endif
00110 

Generated at Thu Nov 6 00:21:25 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000