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

itkSumProjectionImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSumProjectionImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-28 18:14:36 $
00007   Version:   $Revision: 1.2 $
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 __itkSumProjectionImageFilter_h
00018 #define __itkSumProjectionImageFilter_h
00019 
00020 #include "itkProjectionImageFilter.h"
00021 #include "itkNumericTraits.h"
00022 #include "itkConceptChecking.h"
00023 
00024 namespace itk {
00046 namespace Function {
00047 template <class TInputPixel, class TOuputPixel>
00048 class SumAccumulator
00049 {
00050 public:
00051   SumAccumulator( unsigned long ) {}
00052   ~SumAccumulator(){}
00053 
00054   inline void Initialize()
00055     {
00056     m_Sum = NumericTraits< TOuputPixel >::Zero;
00057     }
00058 
00059   inline TInputPixel operator()( const TInputPixel &input )
00060     {
00061     m_Sum = m_Sum + input;
00062     return m_Sum;
00063     }
00064 
00065   inline TOuputPixel GetValue()
00066     {
00067     return m_Sum;
00068     }
00069 
00070   TOuputPixel m_Sum;
00071 };
00072 } // end namespace Function
00073 
00074 
00075 template <class TInputImage, class TOutputImage>
00076 class ITK_EXPORT SumProjectionImageFilter :
00077     public
00078     ProjectionImageFilter<TInputImage, TOutputImage,
00079       Function::SumAccumulator< 
00080           typename TInputImage::PixelType, typename TOutputImage::PixelType > >
00081 {
00082 public:
00083   typedef SumProjectionImageFilter Self;
00084   typedef ProjectionImageFilter<TInputImage, TOutputImage, 
00085     Function::SumAccumulator< 
00086              typename TInputImage::PixelType, 
00087              typename TOutputImage::PixelType > > Superclass;
00088 
00089   typedef TInputImage                        InputImageType;
00090   typedef typename InputImageType::PixelType InputPixelType; 
00091 
00092   typedef TOutputImage                        OutputImageType;
00093   typedef typename OutputImageType::PixelType OutputPixelType; 
00094 
00095 
00096   typedef SmartPointer<Self>        Pointer;
00097   typedef SmartPointer<const Self>  ConstPointer;
00098 
00100   itkTypeMacro(SumProjectionImageFilter, ProjectionImageFilter);
00101 
00103   itkNewMacro(Self);
00104 
00105 #ifdef ITK_USE_CONCEPT_CHECKING
00106 
00107   itkConceptMacro(InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
00108     (Concept::AdditiveOperators<OutputPixelType,
00109                                 InputPixelType,
00110                                 OutputPixelType>));
00111   itkConceptMacro(InputHasNumericTraitsCheck,
00112     (Concept::HasNumericTraits<InputPixelType>));
00113 
00115 #endif
00116 
00117 protected:
00118   SumProjectionImageFilter() {}
00119   virtual ~SumProjectionImageFilter() {}
00120 
00121 private:
00122   SumProjectionImageFilter(const Self&); //purposely not implemented
00123   void operator=(const Self&); //purposely not implemented
00124 
00125 }; // end SumProjectionImageFilter
00126 
00127 } //end namespace itk
00128 
00129 #endif
00130 

Generated at Mon Jul 12 2010 20:00:04 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000