ITK  5.0.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:
93  ITK_DISALLOW_COPY_AND_ASSIGN(MeanProjectionImageFilter);
94 
96  using Superclass = ProjectionImageFilter< TInputImage, TOutputImage,
98  typename TInputImage::PixelType, TAccumulate > >;
99 
102 
103  using InputImageType = TInputImage;
104  using InputPixelType = typename InputImageType::PixelType;
105 
106  using OutputImageType = TOutputImage;
107  using OutputPixelType = typename OutputImageType::PixelType;
108 
111 
113  itkNewMacro(Self);
114 
115 #ifdef ITK_USE_CONCEPT_CHECKING
116  // Begin concept checking
117  itkConceptMacro( InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
120  OutputPixelType > ) );
121 
122  itkConceptMacro( InputHasNumericTraitsCheck,
124  // End concept checking
125 #endif
126 
127 protected:
128  MeanProjectionImageFilter() = default;
129  ~MeanProjectionImageFilter() override = default;
130 }; // end MeanProjectionImageFilter
131 } //end namespace itk
132 
133 #endif
void operator()(const TInputPixel &input)
Define numeric traits for std::vector.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
Implements an accumulation of an image along a selected direction.
TOutputImage OutputImageType
typename InputImageType::PixelType InputPixelType
~MeanProjectionImageFilter() override=default
typename OutputImageType::PixelType OutputPixelType
#define itkConceptMacro(name, concept)
typename NumericTraits< TInputPixel >::RealType RealType