Debian Codegraph @

include/itkVarianceImageFilter.h

raw symbols SCIP
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 itkVarianceImageFilter_h
19 #define itkVarianceImageFilter_h
20
21 #include "itkBoxImageFilter.h"
22 #include "itkImage.h"
23 #include "itkNumericTraits.h"
24
25 namespace itk
26 {
27 /** \class VarianceImageFilter
28 * \brief Applies an averaging filter to an image
29 *
30 * Computes an image where a given pixel is the variance value of the
31 * the pixels in a neighborhood about the corresponding input pixel.
32 *
33 * A variacne filter is one of the family of linear filters.
34 *
35 * \ingroup AdaptiveDenoising
36 */
37 template <typename TInputImage, typename TOutputImage>
38 class ITK_TEMPLATE_EXPORT VarianceImageFilter final : public BoxImageFilter<TInputImage, TOutputImage>
39 {
40 public:
41 ITK_DISALLOW_COPY_AND_MOVE(VarianceImageFilter);
42
43 /** Extract dimension from input and output image. */
44 itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
45 itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
46
47 /** Convenient typedefs for simplifying declarations. */
48 typedef TInputImage InputImageType;
49 typedef TOutputImage OutputImageType;
50
51 /** Standard class typedefs. */
52 typedef VarianceImageFilter Self;
53 typedef BoxImageFilter<InputImageType, OutputImageType> Superclass;
54 typedef SmartPointer<Self> Pointer;
55 typedef SmartPointer<const Self> ConstPointer;
56
57 /** Method for creation through the object factory. */
58 itkNewMacro(Self);
59
60 /** Run-time type information (and related methods). */
61 itkTypeMacro(VarianceImageFilter, BoxImageFilter);
62
63 /** Image typedef support. */
64 typedef typename InputImageType::PixelType InputPixelType;
65 typedef typename OutputImageType::PixelType OutputPixelType;
66 typedef typename NumericTraits<InputPixelType>::RealType InputRealType;
67
68 typedef typename InputImageType::RegionType InputImageRegionType;
69 typedef typename OutputImageType::RegionType OutputImageRegionType;
70
71 typedef typename InputImageType::SizeType InputSizeType;
72
73 #ifdef ITK_USE_CONCEPT_CHECKING
74 // Begin concept checking
75 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
76 // End concept checking
77 #endif
78
79 protected:
80 VarianceImageFilter();
81 ~VarianceImageFilter() override = default;
82
83 /** VarianceImageFilter can be implemented as a multithreaded filter.
84 * Therefore, this implementation provides a ThreadedGenerateData()
85 * routine which is called for each processing thread. The output
86 * image data is allocated automatically by the superclass prior to
87 * calling ThreadedGenerateData(). ThreadedGenerateData can only
88 * write to the portion of the output image specified by the
89 * parameter "outputRegionForThread"
90 *
91 * \sa BoxImageFilter::ThreadedGenerateData(),
92 * BoxImageFilter::GenerateData() */
93 void
94 ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) override;
95 };
96 } // end namespace itk
97
98 #ifndef ITK_MANUAL_INSTANTIATION
99 # include "itkVarianceImageFilter.hxx"
100 #endif
101
102 #endif