Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkRicianNoiseModel.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #include <vnl/vnl_cross.h>
17 #include <vnl/vnl_quaternion.h>
18 #include <mitkRicianNoiseModel.h>
19 
20 using namespace mitk;
21 
22 template< class ScalarType >
24 {
26  m_RandGen->SetSeed();
27  this->m_NoiseVariance = 0;
28 }
29 
30 template< class ScalarType >
32 {
33 
34 }
35 
36 template< class ScalarType >
38 {
39  if (seed>=0)
40  m_RandGen->SetSeed(seed);
41  else
42  m_RandGen->SetSeed();
43 }
44 
45 template< class ScalarType >
47 {
48  for( unsigned int i=0; i<pixel.Size(); i++)
49  {
50  double signal = pixel[i];
51  pixel[i] = sqrt(pow(signal + m_RandGen->GetNormalVariate(0.0, this->m_NoiseVariance), 2) + pow(m_RandGen->GetNormalVariate(0.0, this->m_NoiseVariance),2));
52  }
53 }
void AddNoise(PixelType &pixel)
DataCollection - Class to facilitate loading/accessing structured data.
void SetSeed(int seed)
Set seed for random number generator.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.