ITK  6.0.0
Insight Toolkit
itkNoiseBaseImageFilter.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 itkNoiseBaseImageFilter_h
19#define itkNoiseBaseImageFilter_h
20
22#include <ctime>
23
24namespace itk
25{
26
38template <class TInputImage, class TOutputImage = TInputImage>
39class ITK_TEMPLATE_EXPORT NoiseBaseImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
40{
41public:
42 ITK_DISALLOW_COPY_AND_MOVE(NoiseBaseImageFilter);
43
49
50 using typename Superclass::OutputImagePixelType;
51
53 itkOverrideGetNameOfClassMacro(NoiseBaseImageFilter);
54
56 itkGetConstMacro(Seed, uint32_t);
57 itkSetMacro(Seed, uint32_t);
62 virtual void
64
65protected:
67
68 ~NoiseBaseImageFilter() override = default;
69
70 void
71 PrintSelf(std::ostream & os, Indent indent) const override;
72
73 inline static uint32_t
74 Hash(uint32_t a, uint32_t b)
75 {
76 // Knuth's Multiplicative Method for hashing
77 return (a + b) * 2654435761u;
78 }
79
80 // Clamp and round the input value to the output
81 static OutputImagePixelType
82 ClampCast(const double value);
83
84private:
85 uint32_t m_Seed{ 0 };
86};
87} // end namespace itk
88
89#ifndef ITK_MANUAL_INSTANTIATION
90# include "itkNoiseBaseImageFilter.hxx"
91#endif
92
93#endif
Base class for filters that take an image as input and overwrite that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
An Abstract Base class for Noise image filters.
static OutputImagePixelType ClampCast(const double value)
static uint32_t Hash(uint32_t a, uint32_t b)
~NoiseBaseImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....