ITK  4.4.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 {
46 namespace Functor
47 {
48 template< class TInputPixel, class TAccumulate >
50 {
51 public:
53 
55  {
56  m_Size = size;
57  }
58 
60  {
62  }
63 
64  inline void Initialize()
65  {
67  }
68 
69  inline void operator()(const TInputPixel & input)
70  {
71  m_Sum = m_Sum + input;
72  }
73 
74  inline RealType GetValue()
75  {
76  return ( (RealType)m_Sum ) / m_Size;
77  }
78 
79  TAccumulate m_Sum;
81 };
82 } // end namespace Function
83 
84 template< class TInputImage, class TOutputImage,
85  class TAccumulate =
86  typename NumericTraits<
87  typename TOutputImage::PixelType >::AccumulateType >
88 class ITK_EXPORT MeanProjectionImageFilter:public
89  ProjectionImageFilter< TInputImage, TOutputImage,
90  Functor::MeanAccumulator< typename TInputImage::PixelType, TAccumulate > >
91 {
92 public:
94  typedef ProjectionImageFilter< TInputImage, TOutputImage,
96  typename TInputImage::PixelType, TAccumulate > > Superclass;
97 
100 
101  typedef TInputImage InputImageType;
102  typedef typename InputImageType::PixelType InputPixelType;
103 
104  typedef TOutputImage OutputImageType;
105  typedef typename OutputImageType::PixelType OutputPixelType;
106 
109 
111  itkNewMacro(Self);
112 
113 #ifdef ITK_USE_CONCEPT_CHECKING
114 
115  itkConceptMacro( InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
118  OutputPixelType > ) );
119 
120  itkConceptMacro( InputHasNumericTraitsCheck,
123 #endif
124 
125 protected:
128 
129 private:
130  MeanProjectionImageFilter(const Self &); //purposely not implemented
131  void operator=(const Self &); //purposely not implemented
132 }; // end MeanProjectionImageFilter
133 } //end namespace itk
134 
135 #endif
136