ITK  6.0.0
Insight Toolkit
itkMeanImageFilter.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 itkMeanImageFilter_h
19 #define itkMeanImageFilter_h
20 
21 #include "itkBoxImageFilter.h"
22 #include "itkImage.h"
23 #include "itkNumericTraits.h"
25 
26 #include <vector>
27 
28 namespace itk
29 {
51 template <typename TInputImage, typename TOutputImage>
52 class ITK_TEMPLATE_EXPORT MeanImageFilter : public BoxImageFilter<TInputImage, TOutputImage>
53 {
54 public:
55  ITK_DISALLOW_COPY_AND_MOVE(MeanImageFilter);
56 
58  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
59  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
60 
62  using InputImageType = TInputImage;
63  using OutputImageType = TOutputImage;
64 
70 
72  itkNewMacro(Self);
73 
75  itkOverrideGetNameOfClassMacro(MeanImageFilter);
76 
78  using InputPixelType = typename InputImageType::PixelType;
79  using OutputPixelType = typename OutputImageType::PixelType;
81 
84 
86 
87 #ifdef ITK_USE_CONCEPT_CHECKING
88  // Begin concept checking
89  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
90  // End concept checking
91 #endif
92 
93 protected:
95  ~MeanImageFilter() override = default;
96 
107  void
108  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
109 
110 private:
111  template <typename TPixelAccessPolicy, typename TPixelType>
112  static void
113  GenerateDataInSubregion(const TInputImage & inputImage,
114  TOutputImage & outputImage,
115  const ImageRegion<InputImageDimension> & imageRegion,
116  const std::vector<Offset<InputImageDimension>> & neighborhoodOffsets,
117  const TPixelType *);
118 
119  template <typename TPixelAccessPolicy, typename TValue>
120  static void
121  GenerateDataInSubregion(const TInputImage & inputImage,
122  TOutputImage & outputImage,
123  const ImageRegion<InputImageDimension> & imageRegion,
124  const std::vector<Offset<InputImageDimension>> & neighborhoodOffsets,
126 };
127 } // end namespace itk
128 
129 #ifndef ITK_MANUAL_INSTANTIATION
130 # include "itkMeanImageFilter.hxx"
131 #endif
132 
133 #endif
itk::MeanImageFilter
Applies an averaging filter to an image.
Definition: itkMeanImageFilter.h:52
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:717
itk::BoxImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkBoxImageFilter.h:67
itkVariableLengthVector.h
itk::ImageRegion
An image region represents a structured region of data.
Definition: itkImageRegion.h:80
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkImage.h
itk::SmartPointer< Self >
itk::BoxImageFilter
A base class for all the filters working on a box neighborhood.
Definition: itkBoxImageFilter.h:40
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BoxImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkBoxImageFilter.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::VariableLengthVector
Represents an array whose length can be defined at run-time.
Definition: itkConstantBoundaryCondition.h:28
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::Offset
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
Definition: itkOffset.h:66
itk::MeanImageFilter::InputRealType
typename NumericTraits< InputPixelType >::RealType InputRealType
Definition: itkMeanImageFilter.h:80
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
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::MeanImageFilter::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkMeanImageFilter.h:85
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itkBoxImageFilter.h
itkNumericTraits.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90