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 
24 namespace itk
25 {
46 namespace Functor
47 {
48 template <typename TInputPixel, typename TAccumulate>
50 {
51 public:
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 
81 template <typename TInputImage,
82  typename TOutputImage,
85  : public ProjectionImageFilter<TInputImage,
86  TOutputImage,
87  Functor::MeanAccumulator<typename TInputImage::PixelType, TAccumulate>>
88 {
89 public:
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 
121 protected:
122  MeanProjectionImageFilter() = default;
123  ~MeanProjectionImageFilter() override = default;
124 }; // end MeanProjectionImageFilter
125 } // end namespace itk
126 
127 #endif
itkProjectionImageFilter.h
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:716
itk::Functor::MeanAccumulator
Definition: itkMeanProjectionImageFilter.h:49
itk::Functor::MeanAccumulator::operator()
void operator()(const TInputPixel &input)
Definition: itkMeanProjectionImageFilter.h:65
itk::MeanProjectionImageFilter::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkMeanProjectionImageFilter.h:101
itk::MeanProjectionImageFilter::MeanProjectionImageFilter
MeanProjectionImageFilter()=default
itkConceptChecking.h
itk::NumericTraits::AccumulateType
double AccumulateType
Definition: itkNumericTraits.h:76
itk::Functor::MeanAccumulator::m_Size
SizeValueType m_Size
Definition: itkMeanProjectionImageFilter.h:77
itk::SmartPointer< Self >
itk::MeanProjectionImageFilter::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkMeanProjectionImageFilter.h:104
itk::ProjectionImageFilter
Implements an accumulation of an image along a selected direction.
Definition: itkProjectionImageFilter.h:57
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::MeanAccumulator::~MeanAccumulator
~MeanAccumulator()
Definition: itkMeanProjectionImageFilter.h:56
itk::Functor::MeanAccumulator::GetValue
RealType GetValue()
Definition: itkMeanProjectionImageFilter.h:71
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::MeanProjectionImageFilter
Mean projection.
Definition: itkMeanProjectionImageFilter.h:84
itk::Functor::MeanAccumulator::m_Sum
TAccumulate m_Sum
Definition: itkMeanProjectionImageFilter.h:76
itk::Concept::AdditiveOperators
Definition: itkConceptChecking.h:360
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Functor::MeanAccumulator::RealType
typename NumericTraits< TInputPixel >::RealType RealType
Definition: itkMeanProjectionImageFilter.h:52
itk::Functor::MeanAccumulator::MeanAccumulator
MeanAccumulator(SizeValueType size)
Definition: itkMeanProjectionImageFilter.h:54
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
itk::Functor::MeanAccumulator::Initialize
void Initialize()
Definition: itkMeanProjectionImageFilter.h:59
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::MeanProjectionImageFilter::~MeanProjectionImageFilter
~MeanProjectionImageFilter() override=default