ITK  6.0.0
Insight Toolkit
itkMeanProjectionImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
24namespace itk
25{
46namespace Functor
47{
48template <typename TInputPixel, typename TAccumulate>
50{
51public:
53
55
57
58 inline void
60 {
61 m_Sum = TAccumulate{};
62 }
63
64 inline void
65 operator()(const TInputPixel & input)
66 {
67 m_Sum = m_Sum + input;
68 }
69
70 inline RealType
72 {
73 return ((RealType)m_Sum) / m_Size;
74 }
75
76 TAccumulate m_Sum;
78};
79} // namespace Functor
80
81template <typename TInputImage,
82 typename TOutputImage,
85 : public ProjectionImageFilter<TInputImage,
86 TOutputImage,
87 Functor::MeanAccumulator<typename TInputImage::PixelType, TAccumulate>>
88{
89public:
90 ITK_DISALLOW_COPY_AND_MOVE(MeanProjectionImageFilter);
91
93 using Superclass = ProjectionImageFilter<TInputImage,
94 TOutputImage,
96
99
100 using InputImageType = TInputImage;
101 using InputPixelType = typename InputImageType::PixelType;
102
103 using OutputImageType = TOutputImage;
104 using OutputPixelType = typename OutputImageType::PixelType;
105
107 itkOverrideGetNameOfClassMacro(MeanProjectionImageFilter);
108
110 itkNewMacro(Self);
111
112#ifdef ITK_USE_CONCEPT_CHECKING
113 // Begin concept checking
114 itkConceptMacro(InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
116
117 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
118 // End concept checking
119#endif
120
121protected:
123 ~MeanProjectionImageFilter() override = default;
124}; // end MeanProjectionImageFilter
125} // end namespace itk
126
127#endif
void operator()(const TInputPixel &input)
typename NumericTraits< TInputPixel >::RealType RealType
Base class for all process objects that output image data.
TOutputImage OutputImageType
~MeanProjectionImageFilter() override=default
typename OutputImageType::PixelType OutputPixelType
typename InputImageType::PixelType InputPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements an accumulation of an image along a selected direction.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86