ITK  4.13.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 #if !defined( ITK_LEGACY_FUTURE_REMOVE )
23 # include <vcl_ctime.h>
24 #endif
25 #include <ctime>
26 
27 namespace itk
28 {
29 
40 template <class TInputImage, class TOutputImage=TInputImage>
41 class ITK_TEMPLATE_EXPORT NoiseBaseImageFilter :
42  public InPlaceImageFilter<TInputImage,TOutputImage >
43 {
44 public:
50 
51  typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
52 
55 
57  itkGetConstMacro(Seed, uint32_t);
58  itkSetMacro(Seed, uint32_t);
60 
63  virtual void SetSeed();
64 
65 protected:
67 
68  virtual ~NoiseBaseImageFilter() ITK_OVERRIDE = 0;
69 
70  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
71 
72  inline static uint32_t Hash(uint32_t a, uint32_t b)
73  {
74  // Knuth's Multiplicative Method for hashing
75  return (a+b)*2654435761u;
76  }
77 
78  // Clamp and round the input value to the output
79  static OutputImagePixelType ClampCast(const double &value);
80 
81 private:
82  ITK_DISALLOW_COPY_AND_ASSIGN(NoiseBaseImageFilter);
83 
85 
86 };
87 } // end namespace itk
88 
89 #ifndef ITK_MANUAL_INSTANTIATION
90 #include "itkNoiseBaseImageFilter.hxx"
91 #endif
92 
93 #endif
SmartPointer< const Self > ConstPointer
KWIML_INT_uint32_t uint32_t
Definition: itkIntTypes.h:87
An Abstract Base class for Noise image filters.
Superclass::OutputImagePixelType OutputImagePixelType
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...
InPlaceImageFilter< TInputImage, TOutputImage > Superclass