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

itkAddImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAddImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/03/24 16:03:15 $
00007   Version:   $Revision: 1.11 $
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 __itkAddImageFilter_h
00018 #define __itkAddImageFilter_h
00019 
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00055 namespace Functor {  
00056   
00057 template< class TInput1, class TInput2, class TOutput >
00058 class Add2
00059 {
00060 public:
00061   typedef typename NumericTraits< TInput1 >::AccumulateType AccumulatorType;
00062   Add2() {};
00063   ~Add2() {};
00064   bool operator!=( const Add2 & ) const
00065   {
00066     return false;
00067   }
00068   bool operator==( const Add2 & other ) const
00069   {
00070     return !(*this != other);
00071   }
00072   inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00073   {
00074     const AccumulatorType sum = A;
00075     return static_cast<TOutput>( sum + B );
00076   }
00077 }; 
00078 
00079 }
00080 template <class TInputImage1, class TInputImage2, class TOutputImage>
00081 class ITK_EXPORT AddImageFilter :
00082     public
00083 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00084                          Functor::Add2< 
00085   typename TInputImage1::PixelType, 
00086   typename TInputImage2::PixelType,
00087   typename TOutputImage::PixelType>   >
00088 
00089 
00090 {
00091 public:
00093   typedef AddImageFilter  Self;
00094   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00095                                    Functor::Add2< 
00096     typename TInputImage1::PixelType, 
00097     typename TInputImage2::PixelType,
00098     typename TOutputImage::PixelType>   
00099   >  Superclass;
00100   typedef SmartPointer<Self>   Pointer;
00101   typedef SmartPointer<const Self>  ConstPointer;
00102 
00104   itkNewMacro(Self);
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00109     (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00110                                 typename TInputImage2::PixelType,
00111                                 typename TOutputImage::PixelType>));
00112 
00114 #endif
00115 
00116 protected:
00117   AddImageFilter() {}
00118   virtual ~AddImageFilter() {}
00119 
00120 private:
00121   AddImageFilter(const Self&); //purposely not implemented
00122   void operator=(const Self&); //purposely not implemented
00123 
00124 };
00125 
00126 } // end namespace itk
00127 
00128 
00129 #endif
00130 

Generated at Sun Mar 11 23:26:01 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000