Ultrasound image processing: how to evaluate the SNR of every circular test object in an ecographic image?test

Hi guys, I’m new on ImageJ. I’m dealing with an issue related to an ecographic image:_032.tif (1.4 MB)

It represent scatter lesions of test objects. The specifications of the gray scale ultrasound phantom are the following:
-values of nominal contrast:-9, -6, -3, +3, +6, +9 dB (with respect to background).
I had to evaluate the contrast using the SNR formula
image
where: “the numerator shows the difference of the mean echo levels of a circular area of surrounding (background) tissue (B) and of lesion (L) and the denominator the the sum of the svariances of the mean linear gray levels of background disk (B) and of lesion disk (L), respectively.”

In order to do that I used this matlab code:
Image = im2double(imread(’_032.tif’));
grayImage=rgb2gray(Image);
subplot(2, 2, 1);
imshow(grayImage);
g = gcf;
g.WindowState = ‘maximized’;
fontSize = 14;
title(‘Gray Scale Image’, ‘FontSize’, fontSize);
uiwait(helpdlg(‘Click and drag to draw the inner circular region.’));
roi = drawcircle(‘Color’, ‘red’);
innerMask = roi.createMask;
innerXY = roi.Vertices;
uiwait(helpdlg(‘Click and drag to draw the outer circular region.’));
roi = drawcircle(‘Color’, ‘green’);
outerMask = roi.createMask;
outerXY = roi.Vertices;
% Exclude the inner mask from the outer mask.
outerMask = xor(outerMask, innerMask);
% Get the mean in the circles.
innerMeanGL = mean(grayImage(innerMask));
outerMeanGL = mean(grayImage(outerMask));

innerVarianceGL=var(grayImage(innerMask));
outerVarianceGL=var(grayImage(outerMask));
stdard=std(grayImage(innerMask));
CSR =(outerMeanGL-innerMeanGL)/(outerMeanGL+innerMeanGL);
dB=20*log(CSR);

subplot(2, 2, 2);
imshow(innerMask);
title(‘Inner Mask Image’, ‘FontSize’, fontSize);
subplot(2, 2, 3);
imshow(outerMask);
title(‘Outer Mask Image’, ‘FontSize’, fontSize);
subplot(2, 2, 4);
imshow(grayImage);
hold on;
% Draw the circles.
plot(innerXY(:, 1), innerXY(:, 2), ‘r-’, ‘LineWidth’, 2);
plot(outerXY(:, 1), outerXY(:, 2), ‘g-’, ‘LineWidth’, 2);
caption = sprintf(‘Inner mean GL = %.3f, Outer mean GL = %.3f,Outer var GL = %.3f,inner var GL = %.3f, CSR = %.3f’, innerMeanGL, outerMeanGL, innerVarianceGL, outerVarianceGL, CSR);
title(caption, ‘FontSize’, fontSize);

However, the resulting SNR I found for every cyst seems to differ too much with respect to the nominal value that I should obtain instead (-9, -6, -3, +3, +6, +9 dB). So my question is: should I apply some kind of image processing here on ImageJ before running the code? I’m sorry, but I am not familiar to image processing.
Thanks a lot!

Hi Anita,
I am not totally sure what you want to compare. It would be easier if you show some examples of areas which you want to analyse for snr and highlight expected and obtained values.
From the technical point of view the code is rather ok.
You load images, convert them to grayscale and select two areas. As I understand, the first area is one of the bright spots, while the second its environment:

after that you are calculating snr.
I am not sure about the formula you are using, for example, you take numerator as difference: outerMeanGL-innerMeanGL, shell it be other way around: innerMeanGL-outerMeanGL

also your definitions says:

the denominator the the sum of the svariances of the mean linear gray levels of background disk

does it mean that you should use innerVarianceGL and outerVarianceGL there?

I suggest you to check matlab documentation of snr function:
https://se.mathworks.com/help/signal/ref/snr.html
they have an example on how those things are calculated.

Hopefully this may help!

Best regards,
Ilya