ITK  6.0.0
Insight Toolkit
itkSumProjectionImageFilter.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 itkSumProjectionImageFilter_h
19#define itkSumProjectionImageFilter_h
20
22#include "itkConceptChecking.h"
23
24namespace itk
25{
47namespace Functor
48{
49template <typename TInputPixel, typename TOutputPixel>
51{
52public:
54 ~SumAccumulator() = default;
55
56 inline void
58 {
59 m_Sum = TOutputPixel{};
60 }
61
62 inline void
63 operator()(const TInputPixel & input)
64 {
65 m_Sum = m_Sum + input;
66 }
67
68 inline TOutputPixel
70 {
71 return m_Sum;
72 }
73
74 TOutputPixel m_Sum;
75};
76} // namespace Functor
77
78template <typename TInputImage, typename TOutputImage>
80 : public ProjectionImageFilter<
81 TInputImage,
82 TOutputImage,
83 Functor::SumAccumulator<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
84{
85public:
86 ITK_DISALLOW_COPY_AND_MOVE(SumProjectionImageFilter);
87
89 using Superclass =
90 ProjectionImageFilter<TInputImage,
91 TOutputImage,
93
94 using InputImageType = TInputImage;
95 using InputPixelType = typename InputImageType::PixelType;
96
97 using OutputImageType = TOutputImage;
98 using OutputPixelType = typename OutputImageType::PixelType;
99
102
104 itkOverrideGetNameOfClassMacro(SumProjectionImageFilter);
105
107 itkNewMacro(Self);
108
109#ifdef ITK_USE_CONCEPT_CHECKING
110 // Begin concept checking
111 itkConceptMacro(InputPixelToOutputPixelTypeGreaterAdditiveOperatorCheck,
113 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
114 // End concept checking
115#endif
116
117protected:
119 ~SumProjectionImageFilter() override = default;
120}; // end SumProjectionImageFilter
121} // end namespace itk
122
123#endif
void operator()(const TInputPixel &input)
Base class for all process objects that output image data.
TOutputImage OutputImageType
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.
typename InputImageType::PixelType InputPixelType
typename OutputImageType::PixelType OutputPixelType
~SumProjectionImageFilter() override=default
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86