ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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{
44
45namespace Functor
46{
47template <typename TInputPixel, typename TAccumulate>
49{
50public:
52
54 : m_Size(size)
55 {}
56
58
59 inline void
61 {
62 m_Sum = TAccumulate{};
63 }
64
65 inline void
66 operator()(const TInputPixel & input)
67 {
68 m_Sum = m_Sum + input;
69 }
70
71 inline RealType
73 {
74 return ((RealType)m_Sum) / m_Size;
75 }
76
77 TAccumulate m_Sum;
79};
80} // namespace Functor
81
82template <typename TInputImage,
83 typename TOutputImage,
86 : public ProjectionImageFilter<TInputImage,
87 TOutputImage,
88 Functor::MeanAccumulator<typename TInputImage::PixelType, TAccumulate>>
89{
90public:
91 ITK_DISALLOW_COPY_AND_MOVE(MeanProjectionImageFilter);
92
94 using Superclass = ProjectionImageFilter<TInputImage,
95 TOutputImage,
97
100
101 using InputImageType = TInputImage;
102 using InputPixelType = typename InputImageType::PixelType;
103
104 using OutputImageType = TOutputImage;
105 using OutputPixelType = typename OutputImageType::PixelType;
106
108 itkOverrideGetNameOfClassMacro(MeanProjectionImageFilter);
109
111 itkNewMacro(Self);
112
113 itkConceptMacro(InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
115
116 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
117
118protected:
120 ~MeanProjectionImageFilter() override = default;
121}; // end MeanProjectionImageFilter
122} // end namespace itk
123
124#endif
void operator()(const TInputPixel &input)
typename NumericTraits< TInputPixel >::RealType RealType
~MeanProjectionImageFilter() override=default
ProjectionImageFilter< TInputImage, TOutputImage, Functor::MeanAccumulator< typename TInputImage::PixelType, TAccumulate > > Superclass
typename OutputImageType::PixelType OutputPixelType
typename InputImageType::PixelType InputPixelType
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86