ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkNoiseBaseImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 
37 template <class TInputImage, class TOutputImage=TInputImage>
38 class ITK_TEMPLATE_EXPORT NoiseBaseImageFilter :
39  public InPlaceImageFilter<TInputImage,TOutputImage >
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(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 SetSeed();
63 
64 protected:
66 
67  ~NoiseBaseImageFilter() override = default;
68 
69  void PrintSelf(std::ostream & os, Indent indent) const override;
70 
71  inline static uint32_t Hash(uint32_t a, uint32_t b)
72  {
73  // Knuth's Multiplicative Method for hashing
74  return (a+b)*2654435761u;
75  }
76 
77  // Clamp and round the input value to the output
78  static OutputImagePixelType ClampCast(const double &value);
79 
80 private:
81  uint32_t m_Seed{0};
82 
83 };
84 } // end namespace itk
85 
86 #ifndef ITK_MANUAL_INSTANTIATION
87 #include "itkNoiseBaseImageFilter.hxx"
88 #endif
89 
90 #endif
static uint32_t Hash(uint32_t a, uint32_t b)
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
An Abstract Base class for Noise image filters.
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
::uint32_t uint32_t
Definition: itkIntTypes.h:33
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for filters that take an image as input and overwrite that image as the output...