ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkMeanProjectionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkMeanProjectionImageFilter_h
19 #define __itkMeanProjectionImageFilter_h
20 
22 #include "itkConceptChecking.h"
23 
24 namespace itk
25 {
47 namespace Functor
48 {
49 template< class TInputPixel, class TAccumulate >
51 {
52 public:
54 
56  {
57  m_Size = size;
58  }
59 
61  {
63  }
64 
65  inline void Initialize()
66  {
68  }
69 
70  inline void operator()(const TInputPixel & input)
71  {
72  m_Sum = m_Sum + input;
73  }
74 
75  inline RealType GetValue()
76  {
77  return ( (RealType)m_Sum ) / m_Size;
78  }
79 
80  TAccumulate m_Sum;
82 };
83 } // end namespace Function
84 
85 template< class TInputImage, class TOutputImage,
86  class TAccumulate =
87  typename NumericTraits<
88  typename TOutputImage::PixelType >::AccumulateType >
89 class ITK_EXPORT MeanProjectionImageFilter:public
90  ProjectionImageFilter< TInputImage, TOutputImage,
91  Functor::MeanAccumulator< typename TInputImage::PixelType, TAccumulate > >
92 {
93 public:
95  typedef ProjectionImageFilter< TInputImage, TOutputImage,
97  typename TInputImage::PixelType, TAccumulate > > Superclass;
98 
101 
102  typedef TInputImage InputImageType;
103  typedef typename InputImageType::PixelType InputPixelType;
104 
105  typedef TOutputImage OutputImageType;
106  typedef typename OutputImageType::PixelType OutputPixelType;
107 
110 
112  itkNewMacro(Self);
113 
114 #ifdef ITK_USE_CONCEPT_CHECKING
115 
116  itkConceptMacro( InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
119  OutputPixelType > ) );
120 
121  itkConceptMacro( InputHasNumericTraitsCheck,
124 #endif
125 
126 protected:
129 
130 private:
131  MeanProjectionImageFilter(const Self &); //purposely not implemented
132  void operator=(const Self &); //purposely not implemented
133 }; // end MeanProjectionImageFilter
134 } //end namespace itk
135 
136 #endif
137