ITK  4.13.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< typename TInputPixel, typename 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< typename TInputImage, typename TOutputImage,
85  typename TAccumulate =
86  typename NumericTraits<
87  typename TOutputImage::PixelType >::AccumulateType >
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  // Begin concept checking
115  itkConceptMacro( InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
118  OutputPixelType > ) );
119 
120  itkConceptMacro( InputHasNumericTraitsCheck,
122  // End concept checking
123 #endif
124 
125 protected:
127  virtual ~MeanProjectionImageFilter() ITK_OVERRIDE {}
128 
129 private:
130  ITK_DISALLOW_COPY_AND_ASSIGN(MeanProjectionImageFilter);
131 }; // end MeanProjectionImageFilter
132 } //end namespace itk
133 
134 #endif
NumericTraits< TInputPixel >::RealType RealType
void operator()(const TInputPixel &input)
ProjectionImageFilter< TInputImage, TOutputImage, Functor::MeanAccumulator< typename TInputImage::PixelType, TAccumulate > > Superclass
OutputImageType::PixelType OutputPixelType
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Implements an accumulation of an image along a selected direction.
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)