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: 2002/01/15 19:35:55 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) 2002 Insight 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     inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00065       {
00066       const AccumulatorType sum = A;
00067       return static_cast<TOutput>( sum + B );
00068       }
00069   }; 
00070 
00071 }
00072 template <class TInputImage1, class TInputImage2, class TOutputImage>
00073 class ITK_EXPORT AddImageFilter :
00074     public
00075     BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00076     Functor::Add2< 
00077               typename TInputImage1::PixelType, 
00078               typename TInputImage2::PixelType,
00079               typename TOutputImage::PixelType>   >
00080 
00081 
00082 {
00083 public:
00085   typedef AddImageFilter  Self;
00086   typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage, 
00087     Functor::Add2< 
00088               typename TInputImage1::PixelType, 
00089               typename TInputImage2::PixelType,
00090               typename TOutputImage::PixelType>   
00091                 >  Superclass;
00092   typedef SmartPointer<Self>   Pointer;
00093   typedef SmartPointer<const Self>  ConstPointer;
00094 
00096   itkNewMacro(Self);
00097   
00098 protected:
00099   AddImageFilter() {}
00100   virtual ~AddImageFilter() {}
00101 
00102 private:
00103   AddImageFilter(const Self&); //purposely not implemented
00104   void operator=(const Self&); //purposely not implemented
00105 
00106 };
00107 
00108 } // end namespace itk
00109 
00110 
00111 #endif

Generated at Fri May 21 01:14:23 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000