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: 2009-04-01 14:36:08 $
00007   Version:   $Revision: 1.16 $
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   
00059 namespace Functor {  
00060   
00061 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1>
00062 class Add2
00063 {
00064 public:
00065   typedef typename NumericTraits< TInput1 >::AccumulateType AccumulatorType;
00066   Add2() {};
00067   ~Add2() {};
00068   bool operator!=( const Add2 & ) const
00069     {
00070     return false;
00071     }
00072   bool operator==( const Add2 & other ) const
00073     {
00074     return !(*this != other);
00075     }
00076   inline TOutput operator() ( const TInput1 & A, const TInput2 & B) const
00077     {
00078     const AccumulatorType sum = A;
00079     return static_cast<TOutput>( sum + B );
00080     }
00081 }; 
00082 
00083 }
00084 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
00085 class ITK_EXPORT AddImageFilter :
00086     public
00087 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00088                          Functor::Add2< 
00089   typename TInputImage1::PixelType, 
00090   typename TInputImage2::PixelType,
00091   typename TOutputImage::PixelType>   >
00092 
00093 
00094 {
00095 public:
00097   typedef AddImageFilter               Self;
00098   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00099                                    Functor::Add2< 
00100     typename TInputImage1::PixelType, 
00101     typename TInputImage2::PixelType,
00102     typename TOutputImage::PixelType> > Superclass;
00103 
00104   typedef SmartPointer<Self>        Pointer;
00105   typedef SmartPointer<const Self>  ConstPointer;
00106 
00108   itkNewMacro(Self);
00109 
00111   itkTypeMacro(AddImageFilter, 
00112                BinaryFunctorImageFilter);
00113 
00114 #ifdef ITK_USE_CONCEPT_CHECKING
00115 
00116   itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00117     (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00118                                 typename TInputImage2::PixelType,
00119                                 typename TOutputImage::PixelType>));
00120 
00122 #endif
00123 
00124 protected:
00125   AddImageFilter() {}
00126   virtual ~AddImageFilter() {}
00127 
00128 private:
00129   AddImageFilter(const Self&); //purposely not implemented
00130   void operator=(const Self&); //purposely not implemented
00131 
00132 };
00133 
00134 } // end namespace itk
00135 
00136 
00137 #endif
00138 

Generated at Fri Apr 16 17:46:07 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000