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

itkMeanProjectionImageFilter.h

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

Generated at Mon Jul 12 2010 19:06:52 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000