36 #ifndef rtkAdditiveGaussianNoiseImageFilter_h 37 #define rtkAdditiveGaussianNoiseImageFilter_h 56 template <
class TPixel>
63 m_StandardDeviation = 1.0;
85 return m_StandardDeviation;
91 m_StandardDeviation = stddev;
97 m_Generator->Initialize(seed);
103 m_OutputMinimum = min;
109 m_OutputMaximum = max;
115 return m_OutputMinimum;
121 return m_OutputMaximum;
128 static const auto min =
static_cast<float>(m_OutputMinimum);
129 static const auto max =
static_cast<float>(m_OutputMaximum);
132 float output =
static_cast<float>(input) + m_Mean + m_StandardDeviation * m_Generator->GetVariate();
135 output = (output < min ? min : output);
136 output = (output > max ? max : output);
138 return static_cast<TPixel
>(output);
170 template <
class TInputImage>
186 #ifdef itkOverrideGetNameOfClassMacro 206 static constexpr
unsigned int InputImageDimension = TInputImage::ImageDimension;
211 GenerateData()
override;
222 m_NoiseFilter->GetFunctor().SetMean(mean);
234 return m_NoiseFilter->GetFunctor().GetMean();
244 m_NoiseFilter->GetFunctor().SetStandardDeviation(stddev);
256 return m_NoiseFilter->GetFunctor().GetStandardDeviation();
268 m_NoiseFilter->GetFunctor().SetSeed(seed);
277 if (min == m_NoiseFilter->GetFunctor().GetOutputMinimum())
281 m_NoiseFilter->GetFunctor().SetOutputMinimum(min);
290 return m_NoiseFilter->GetFunctor().GetOutputMinimum();
297 if (max == m_NoiseFilter->GetFunctor().GetOutputMaximum())
301 m_NoiseFilter->GetFunctor().SetOutputMaximum(max);
310 return m_NoiseFilter->GetFunctor().GetOutputMaximum();
317 PrintSelf(std::ostream & os,
itk::Indent indent)
const override;
330 #ifndef ITK_MANUAL_INSTANTIATION 331 # include "rtkAdditiveGaussianNoiseImageFilter.hxx" void SetOutputMaximum(InputImagePixelType max)
typename OutputImageType::Pointer OutputImagePointer
InputImagePixelType GetOutputMinimum()
NoiseFilterType::Pointer m_NoiseFilter
void SetSeed(unsigned long seed)
InputImagePixelType GetOutputMaximum()
typename InputImageType::ConstPointer InputImageConstPointer
void SetOutputMaximum(TPixel max)
TInputImage InputImageType
NormalVariateNoiseFunctor()
void SetStandardDeviation(float stddev)
void SetOutputMinimum(InputImagePixelType min)
typename InputImageType::RegionType InputImageRegionType
void SetStandardDeviation(float stddev)
Pixel functor that adds Gaussian noise.
typename OutputImageType::RegionType OutputImageRegionType
void SetSeed(unsigned long seed)
TPixel operator()(TPixel input)
typename InputImageType::Pointer InputImagePointer
itk::Statistics::NormalVariateGenerator::Pointer m_Generator
TPixel GetOutputMaximum() const
float GetStandardDeviation() const
void SetOutputMinimum(TPixel min)
float GetStandardDeviation() const
typename InputImageType::PixelType InputPixelType
TPixel GetOutputMinimum() const
float m_StandardDeviation
typename InputImageType::PixelType InputImagePixelType