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

itkNaryAddImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNaryAddImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/08/22 18:49:28 $
00007   Version:   $Revision: 1.24 $
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 __itkNaryAddImageFilter_h
00018 #define __itkNaryAddImageFilter_h
00019 
00020 #include "itkNaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00056 namespace Functor {  
00057   
00058   template< class TInput, class TOutput >
00059   class Add1
00060   {
00061   public:
00062     typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00063     Add1() {}
00064     ~Add1() {}
00065     inline TOutput operator()( const TOutput & A, const TInput & B)
00066       {
00067       const AccumulatorType sum = A;
00068       return static_cast<TOutput>( sum + B );
00069       }
00070     bool operator != (const Add1&) const
00071       {
00072       return false;
00073       }
00074   }; 
00075 }
00076 template <class TInputImage, class TOutputImage>
00077 class ITK_EXPORT NaryAddImageFilter :
00078     public
00079     NaryFunctorImageFilter<TInputImage,TOutputImage, 
00080     Functor::Add1<  typename TInputImage::PixelType, 
00081                     typename TOutputImage::PixelType>   >
00082 {
00083 public:
00085   typedef NaryAddImageFilter  Self;
00086   typedef NaryFunctorImageFilter<TInputImage,TOutputImage, 
00087     Functor::Add1< typename TInputImage::PixelType, 
00088                    typename TOutputImage::PixelType> >  Superclass;
00089   typedef SmartPointer<Self>   Pointer;
00090   typedef SmartPointer<const Self>  ConstPointer;
00091 
00093   itkNewMacro(Self);
00094   
00095 protected:
00096   NaryAddImageFilter() {}
00097   virtual ~NaryAddImageFilter() {}
00098 
00099 private:
00100   NaryAddImageFilter(const Self&); //purposely not implemented
00101   void operator=(const Self&); //purposely not implemented
00102 
00103 };
00104 
00105 } // end namespace itk
00106 
00107 
00108 #endif

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