ANIMA  4.0
animaNoiseGeneratorImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <random>
6 #include <itkImage.h>
7 
8 #include <time.h>
9 
10 namespace anima
11 {
12 
13 template <class ImageType>
15 public anima::NumberedThreadImageToImageFilter <ImageType,itk::Image<double,ImageType::ImageDimension> >
16 {
17 public:
20  typedef ImageType TInputImage;
21  typedef itk::Image<double,ImageType::ImageDimension> TOutputImage;
23  typedef itk::SmartPointer<Self> Pointer;
24  typedef itk::SmartPointer<const Self> ConstPointer;
25 
27  itkNewMacro(Self)
28 
29 
31 
32  typedef typename TOutputImage::PixelType OutputPixelType;
33  typedef typename TInputImage::PixelType InputPixelType;
34 
36  typedef TInputImage InputImageType;
37  typedef TOutputImage OutputImageType;
38  typedef typename InputImageType::Pointer InputImagePointer;
39  typedef typename OutputImageType::Pointer OutputImagePointer;
40 
42  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
43 
44  itkSetMacro(NumberOfReplicates, unsigned int)
45  itkGetConstMacro(NumberOfReplicates, unsigned int)
46 
47  itkSetMacro(NoiseSigma, double)
48  itkGetConstMacro(NoiseSigma, double)
49 
50  itkSetMacro(UseGaussianDistribution, bool)
51  itkGetConstMacro(UseGaussianDistribution, bool)
52 
53 protected:
55  {
56  m_NumberOfReplicates = 1;
57  m_NoiseSigma = 1.0;
58  m_UseGaussianDistribution = false;
59  }
60 
62  {
63  }
64 
65  void GenerateOutputInformation() ITK_OVERRIDE;
66  void BeforeThreadedGenerateData() ITK_OVERRIDE;
67  void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE;
68 
69 private:
70  ITK_DISALLOW_COPY_AND_ASSIGN(NoiseGeneratorImageFilter);
71 
72  unsigned int m_NumberOfReplicates;
73  double m_NoiseSigma;
74  bool m_UseGaussianDistribution;
75  std::vector <std::mt19937> m_Generators;
76 };
77 
78 } // end namespace anima
79 
anima::NumberedThreadImageToImageFilter< TInputImage, TOutputImage > Superclass
Implements a class to handle thread number in a dynamic way for multithreaded methods needing thread ...
Superclass::OutputImageRegionType OutputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
itk::SmartPointer< const Self > ConstPointer
itk::Image< double, ImageType::ImageDimension > TOutputImage