ITK  5.2.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  * http://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 
21 #include "itkInPlaceImageFilter.h"
22 #include <ctime>
23 
24 namespace itk
25 {
26 
38 template <class TInputImage, class TOutputImage = TInputImage>
39 class ITK_TEMPLATE_EXPORT NoiseBaseImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(NoiseBaseImageFilter);
43 
49 
50  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
51 
54 
56  itkGetConstMacro(Seed, uint32_t);
57  itkSetMacro(Seed, uint32_t);
59 
62  virtual void
63  SetSeed();
64 
65 protected:
67 
68  ~NoiseBaseImageFilter() override = default;
69 
70  void
71  PrintSelf(std::ostream & os, Indent indent) const override;
72 
73  inline static uint32_t
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 
84 private:
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
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::NoiseBaseImageFilter::Hash
static uint32_t Hash(uint32_t a, uint32_t b)
Definition: itkNoiseBaseImageFilter.h:74
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::NoiseBaseImageFilter
An Abstract Base class for Noise image filters.
Definition: itkNoiseBaseImageFilter.h:39
itk::uint32_t
::uint32_t uint32_t
Definition: itkIntTypes.h:33