ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSaltAndPepperNoiseImageFilter.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 
19 #ifndef itkSaltAndPepperNoiseImageFilter_h
20 #define itkSaltAndPepperNoiseImageFilter_h
21 
23 
24 namespace itk
25 {
26 
65 template <class TInputImage, class TOutputImage=TInputImage>
66 class ITK_TEMPLATE_EXPORT SaltAndPepperNoiseImageFilter :
67  public NoiseBaseImageFilter<TInputImage,TOutputImage >
68 {
69 public:
70  ITK_DISALLOW_COPY_AND_ASSIGN(SaltAndPepperNoiseImageFilter);
71 
77 
79  itkNewMacro(Self);
80 
83 
85  using OutputImageType = typename Superclass::OutputImageType;
86  using OutputImagePointer = typename Superclass::OutputImagePointer;
87  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
89 
91  using InputImageType = TInputImage;
92  using InputImagePointer = typename InputImageType::Pointer;
93  using InputImageConstPointer = typename InputImageType::ConstPointer;
95  using InputImagePixelType = typename InputImageType::PixelType;
96 
99  itkGetConstMacro(Probability, double);
100  itkSetMacro(Probability, double);
102 
105  itkSetMacro(SaltValue, OutputImagePixelType);
106  itkGetConstMacro(SaltValue, OutputImagePixelType);
108 
109 
112  itkSetMacro(PepperValue, OutputImagePixelType);
113  itkGetConstMacro(PepperValue, OutputImagePixelType);
115 
116 
117 #ifdef ITK_USE_CONCEPT_CHECKING
118 
119  itkConceptMacro(InputConvertibleToOutputCheck,
120  (Concept::Convertible<typename TInputImage::PixelType,
121  typename TOutputImage::PixelType>) );
122 
124 #endif
125 
126 protected:
128  ~SaltAndPepperNoiseImageFilter() override = default;
129 
130  void PrintSelf(std::ostream & os, Indent indent) const override;
131 
132  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
133 
134 private:
135  double m_Probability{ 0.01 };
138 
139 };
140 } // end namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkSaltAndPepperNoiseImageFilter.hxx"
144 #endif
145 
146 #endif
typename OutputImageType::Pointer OutputImagePointer
typename Superclass::OutputImagePixelType OutputImagePixelType
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
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
Alter an image with fixed value impulse noise, often called salt and pepper noise.