User:The Lamb of God/sandbox-Singnal to Noise Ratio (SNR)

The Signal to Noise Ratio (SNR) is used in image processing as a physical measure of the sensitivity of an imaging system. Industry standards measure SNR in decibels (dB) and therefore apply the 20 log rule to the "pure" SNR ratio. In turn, yielding the "sensitivity." Industry standards measure and define sensitivity in terms of the ISO film speed equivalent; SNR:32.04 dB = excellent image quality and SNR:20 dB = acceptable image quality.

Definition of SNR
Due to "clamping" in modern imaging sensors and systems the classic definition of SNR has become less meaningful. Traditionally, the definition of SNR has been defined as the ratio of the average signal value to the standard deviation of the signal value.

$$ SNR = \frac{\mu\,Sig}{\sigma\,_{\mu\,Sig}}$$

However, because of clamping, $${\sigma\,_{\mu\,Sig}}$$ approaches zero and thus, SNR approaches infinity; which is physically meaningless in image analysis. Therefore, a new definition of SNR yields a meaningful value. SNR is thus defined as the ratio of the net signal value to the RMS noise. Where the net signal value is the difference between the average signal and background values, and the RMS noise is the standard deviation of the signal value.

$$ SNR = \frac{Signal}{RMS\ Noise}\,$$

Explanation
The line data is gathered from the arbitrarily defined signal and background regions and inputed into an array (refer to image to the right). To calculate the average signal and background values, a second order polynomial is fitted to the array of line data and subtracted from the original array line data. This is done to remove any trends. Finding the mean of this data yields the average signal and background values. The net signal is calculated from the difference of the average signal and background values. The RMS or root mean square noise is defined from the signal region. Finally, SNR is determined as the ratio of the net signal to the RMS noise.

Polynomial and coefficients

 * The second order polynomial is calculated by the follwing double sumation.

$$f_i = \sum_{j=0}^m \sum_{i=1}^n a_j x_i^j$$


 * $$f\,$$ = output sequence
 * $$m\,$$ = the polynomial order
 * $$x\,$$ = the input sequence (array/line values) from the signal region or background region, respectively.
 * $$n\,$$ = the number of lines
 * $$a_j\,$$ = the polynomial fit coefficients


 * The polynomial fit coefficients can thus be calculated by a system of equations.

$$ \begin{bmatrix} 1     &     x_1     &     x_1^2  \\ 1     &     x_2     &     x_2^2  \\ \vdots &    \vdots  &     \vdots \\ 1     &     x_n    &      x_n^2 \end{bmatrix}

\begin{bmatrix} a_2      \\ a_1      \\ a_0      \\ \end{bmatrix} = \begin{bmatrix} f_1      \\ f_2      \\ \vdots   \\ f_n \end{bmatrix} $$


 * Which can be written...

$$ \begin{bmatrix} n            &     \sum x_i       &     \sum x_i^2  \\ \sum x_i     &     \sum x_i^2     &     \sum x_i^3  \\ \sum x_i^2   &     \sum x_i^3     &     \sum x_i^4 \end{bmatrix}

\begin{bmatrix} a_2     \\ a_1     \\ a_0 \end{bmatrix} = \begin{bmatrix} \sum f_i      \\ \sum f_i x_i  \\ \sum f_i x_i^2 \end{bmatrix} $$


 * Computer software or rigourous row operations will solve for the coefficients.

Net signal, signal, and background

 * The second order polynomial is subtracted from the original data to remove any trends and then averaged. This yields the signal and background values.

$$\mu\,Sig = \frac{\sum_{i=1}^n (X_i - f_i)}{n} \qquad \qquad \mu\,Bckrnd = \frac{\sum_{i=1}^n (X_i-f_i)}{n}$$


 * $$\mu\,Sig$$ = average signal value
 * $$\mu\,Bckrnd$$ = average background value
 * $$n\,$$ = number of lines in background or signal region
 * $$X_i\,$$ = value of the ith line in the signal region or background region, respectively.
 * $$f_i\,$$ = value of the ith output of the second order polynomial.


 * Hence, the net signal value is determined.

$$Signal\, = \mu\,Sig - \mu\,Bckrnd$$

RMS noise and SNR

 * The RMS Noise is defined as the square root of the absolute value of the sum of variances from the signal region.

$$RMS\ Noise = \sqrt{\Bigg|\frac{\sum_{i=1}^n (X_i-\frac{\sum_{i=1}^n X_i}{n})^2}{n}\Bigg|}$$


 * The SNR is thus given by the definition.

$$ SNR = \frac{Signal}{RMS\ Noise}\,$$


 * Using the industry standard 20 log rule ...

$$ SNR = 20\ log_{10} \frac{Signal}{RMS\ Noise}\,$$