0

greetings

today I saw on a post on StackOverflow this function for calculating SNR or signal to noise ratio from an input image.

the function code :

def signaltonoise(a, axis=0, ddof=0):
a = np.asanyarray(a)
m = a.mean(axis)
sd = a.std(axis=axis, ddof=ddof)
return np.where(sd == 0, 0, m/sd)

my question is does this SNR function could work for calculating SNR in medical images.

the post link

  • 1
    that function was removed from scipy *because* it's **nonsense** in many situations. people have to know what they're doing, not just call a function. your reproduction of that function doesn't change the fact that you need to *know when* and *which* math applies. -- signal to noise **ratio** requires that you have an estimation of **the signal** as well as the noise. does the mean (average) of the data represent *your signal* accurately? -- medical images are *no different* from any other data gained from *measuring* the world. – Christoph Rackwitz Dec 11 '21 at 13:21
  • reason why scipy removed that function: https://github.com/scipy/scipy/issues/9097 – Christoph Rackwitz Dec 11 '21 at 13:26
  • @ChristophRackwitz oh thanks, bro for your explanation now I understand but am still looking for a way to measure the SNR in my images, or at least find a way to represent an estimation for the signals from the images if you have an idea pls tell me but thanks anyway for your help – Rico domeri Dec 11 '21 at 14:55
  • Medical images are in no way different from others. If you don't have the original noise-free image, you can try denoising it, for example by non-local means. Then compute the noise amplitude and the image mean. –  Dec 11 '21 at 18:03
  • oh oh great, I already researched that, I mean the denoising, there is the noise() function in Wand library, I tried it, but I don't know if it has a non-local or local mean, after denoising how can I compute the noise amplitude, i mean if you look at denoising i find code : https://www.geeksforgeeks.org/python-noise-function-in-wand/ you can see only that I can determine attenuation not amplitude of the noise i add – Rico domeri Dec 11 '21 at 19:56
  • The SNR value for your images is a function of the *scanner* that is generating the images, and varies by scan parameters used to take the images, scanner filters/processing applied etc. The only really true way to determine the SNR in your images is by using Quality Control (QC) images of *known objects*, and measuring the SNR from them, and then using those numbers. – Richard Dec 13 '21 at 17:35

0 Answers0