00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 size ) {}
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 }
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&);
00123 void operator=(const Self&);
00124
00125 };
00126
00127 }
00128
00129 #endif
00130