Package org.itk.simple
Class ShotNoiseImageFilter
java.lang.Object
org.itk.simple.ProcessObject
org.itk.simple.ImageFilter
org.itk.simple.ShotNoiseImageFilter
Alter an image with shot noise.
The shot noise follows a Poisson distribution:
$ I = N(I_0) $
where $ N(I_0) $ is a Poisson-distributed random variable of mean $ I_0 $ . The noise is thus dependent on the pixel intensities in the image.
The intensities in the image can be scaled by a user provided value
to map pixel values to the actual number of particles. The scaling can
be seen as the inverse of the gain used during the acquisition. The
noisy signal is then scaled back to its input intensity range:
$ I = \\frac{N(I_0 \\times s)}{s} $
where $ s $ is the scale factor.
The Poisson-distributed variable $ \\lambda $ is computed by using the algorithm:
$ \\begin{array}{l} k \\leftarrow 0 \\\\ p \\leftarrow 1
\\\\ \\textbf{repeat} \\\\ \\left\\{ \\begin{array}{l}
k \\leftarrow k+1 \\\\ p \\leftarrow p \\ast U()
\\end{array} \\right. \\\\ \\textbf{until } p >
e^{\\lambda} \\\\ \\textbf{return} (k) \\end{array} $
where $ U() $ provides a uniformly distributed random variable in the interval $ [0,1] $ .
This algorithm is very inefficient for large values of $ \\lambda $ , though. Fortunately, the Poisson distribution can be accurately
approximated by a Gaussian distribution of mean and variance $ \\lambda $ when $ \\lambda $ is large enough. In this implementation, this value is considered to
be 50. This leads to the faster algorithm:
$ \\lambda + \\sqrt{\\lambda} \\times N()$
where $ N() $ is a normally distributed random variable of mean 0 and variance 1.
Gaetan Lehmann
This code was contributed in the Insight Journal paper "Noise
Simulation". https://www.insight-journal.org/browse/publication/721
See:
itk::simple::ShotNoise for the procedural interface
itk::ShotNoiseImageFilter for the Doxygen on the original ITK class.
C++ includes: sitkShotNoiseImageFilter.h
-
Field Summary
Fields inherited from class org.itk.simple.ProcessObject
swigCMemOwn
-
Constructor Summary
ConstructorsModifierConstructorDescriptionitk::simple::ShotNoiseImageFilter::ShotNoiseImageFilter() Default Constructor that takes no arguments and initializes default parametersprotected
ShotNoiseImageFilter
(long cPtr, boolean cMemoryOwn) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
virtual itk::simple::ShotNoiseImageFilter::~ShotNoiseImageFilter() DestructorImage itk::simple::ShotNoiseImageFilter::Execute(Image &&image1) Execute the filter on the input imageprotected void
finalize()
protected static long
getName()
std::string itk::simple::ShotNoiseImageFilter::GetName() const Name of this classdouble
getScale()
double itk::simple::ShotNoiseImageFilter::GetScale() const Set/Get the value to map the pixel value to the actual particle counting.long
getSeed()
uint32_t itk::simple::ShotNoiseImageFilter::GetSeed() constvoid
setScale
(double Scale) Self& itk::simple::ShotNoiseImageFilter::SetScale(double Scale) Set/Get the value to map the pixel value to the actual particle counting.void
setSeed
(long Seed) Self& itk::simple::ShotNoiseImageFilter::SetSeed(uint32_t Seed)protected static long
toString()
std::string itk::simple::ShotNoiseImageFilter::ToString() const Print ourselves outMethods inherited from class org.itk.simple.ImageFilter
getCPtr, swigRelease
Methods inherited from class org.itk.simple.ProcessObject
abort, addCommand, debugOff, debugOn, getCPtr, getDebug, getGlobalDefaultCoordinateTolerance, getGlobalDefaultDebug, getGlobalDefaultDirectionTolerance, getGlobalDefaultNumberOfThreads, getGlobalDefaultThreader, getGlobalWarningDisplay, getNumberOfThreads, getNumberOfWorkUnits, getProgress, globalDefaultDebugOff, globalDefaultDebugOn, globalWarningDisplayOff, globalWarningDisplayOn, hasCommand, removeAllCommands, setDebug, setGlobalDefaultCoordinateTolerance, setGlobalDefaultDebug, setGlobalDefaultDirectionTolerance, setGlobalDefaultNumberOfThreads, setGlobalDefaultThreader, setGlobalWarningDisplay, setNumberOfThreads, setNumberOfWorkUnits, swigRelease
-
Constructor Details
-
ShotNoiseImageFilter
protected ShotNoiseImageFilter(long cPtr, boolean cMemoryOwn) -
ShotNoiseImageFilter
public ShotNoiseImageFilter()itk::simple::ShotNoiseImageFilter::ShotNoiseImageFilter() Default Constructor that takes no arguments and initializes default parameters
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classImageFilter
-
delete
public void delete()virtual itk::simple::ShotNoiseImageFilter::~ShotNoiseImageFilter() Destructor- Overrides:
delete
in classImageFilter
-
setScale
public void setScale(double Scale) Self& itk::simple::ShotNoiseImageFilter::SetScale(double Scale) Set/Get the value to map the pixel value to the actual particle counting. The scaling can be seen as the inverse of the gain used during the acquisition. The noisy signal is then scaled back to its input intensity range. Defaults to 1.0. -
getScale
public double getScale()double itk::simple::ShotNoiseImageFilter::GetScale() const Set/Get the value to map the pixel value to the actual particle counting. The scaling can be seen as the inverse of the gain used during the acquisition. The noisy signal is then scaled back to its input intensity range. Defaults to 1.0. -
setSeed
public void setSeed(long Seed) Self& itk::simple::ShotNoiseImageFilter::SetSeed(uint32_t Seed) -
getSeed
public long getSeed()uint32_t itk::simple::ShotNoiseImageFilter::GetSeed() const -
getName
std::string itk::simple::ShotNoiseImageFilter::GetName() const Name of this class- Overrides:
getName
in classProcessObject
-
toString
std::string itk::simple::ShotNoiseImageFilter::ToString() const Print ourselves out- Overrides:
toString
in classProcessObject
-
execute
Image itk::simple::ShotNoiseImageFilter::Execute(Image &&image1) Execute the filter on the input image
-