ITK  6.0.0
Insight Toolkit
itkSaltAndPepperNoiseImageFilter.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 
19 #ifndef itkSaltAndPepperNoiseImageFilter_h
20 #define itkSaltAndPepperNoiseImageFilter_h
21 
23 
24 namespace itk
25 {
26 
66 template <class TInputImage, class TOutputImage = TInputImage>
67 class ITK_TEMPLATE_EXPORT SaltAndPepperNoiseImageFilter : public NoiseBaseImageFilter<TInputImage, TOutputImage>
68 {
69 public:
70  ITK_DISALLOW_COPY_AND_MOVE(SaltAndPepperNoiseImageFilter);
78 
80  itkNewMacro(Self);
81 
83  itkOverrideGetNameOfClassMacro(SaltAndPepperNoiseImageFilter);
84 
86  using typename Superclass::OutputImageType;
87  using typename Superclass::OutputImagePointer;
88  using typename Superclass::OutputImageRegionType;
89  using typename Superclass::OutputImagePixelType;
90 
92  using InputImageType = TInputImage;
96  using InputImagePixelType = typename InputImageType::PixelType;
97 
100  itkGetConstMacro(Probability, double);
101  itkSetMacro(Probability, double);
106  itkSetMacro(SaltValue, OutputImagePixelType);
107  itkGetConstMacro(SaltValue, OutputImagePixelType);
113  itkSetMacro(PepperValue, OutputImagePixelType);
114  itkGetConstMacro(PepperValue, OutputImagePixelType);
118 #ifdef ITK_USE_CONCEPT_CHECKING
119 
120  itkConceptMacro(InputConvertibleToOutputCheck,
122 
124 #endif
125 
126 protected:
128  ~SaltAndPepperNoiseImageFilter() override = default;
129 
130  void
131  PrintSelf(std::ostream & os, Indent indent) const override;
132 
133  void
134  ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) override;
135 
136 private:
137  double m_Probability{ 0.01 };
138  OutputImagePixelType m_SaltValue{};
139  OutputImagePixelType m_PepperValue{};
140 };
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 # include "itkSaltAndPepperNoiseImageFilter.hxx"
145 #endif
146 
147 #endif
itkNoiseBaseImageFilter.h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::SaltAndPepperNoiseImageFilter
Alter an image with fixed value impulse noise, often called salt and pepper noise.
Definition: itkSaltAndPepperNoiseImageFilter.h:67
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:102
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::NoiseBaseImageFilter
An Abstract Base class for Noise image filters.
Definition: itkNoiseBaseImageFilter.h:39
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131