This code can be used to measure the pre-sampled MTF of an image, which is a quantity that describes the resolution of linear imaging systems. The code is based on measuring the pre-sample MTF using a precision machined edge that is aligned - with respect to the columns or rows of an image - at an angle between 1-5 degrees.
To learn more about the pre-sampled MTF consult the references at the end of this script.
When you run this script your image containing the edge with appear with the cropping tool. Crop your image to the region containing only the edge. Double-click your cropped area for the script to continue.
A Gaussian fitting tool has been used in this code. You can download this tool on the Matlab central website here: http://www.mathworks.com/matlabcentral/fileexchange/11733-gaussian-curve-fit
comments, and suggestions, including areas of improvement may be welcomed.
Lots of issues, code quality insufficient
For repeated value affecting interp1 one can use unique() or find(diff()==0) to remove/locate/manipulate them so that interpolation can go through.
Very sensitive to the input edge images? Always saying the interp1 errors, is it because the interpolation contains too many duplicate values? How to fix it? Thx.
Do you guys have a sample edge image for me to try out? My own image keep getting errors.
Thanks a bunch!
Really helpful. Thank you for sharing.
Does this script work regardless of wether the image data has been linearized to the deposited-energy ?
I used this script on image data that I know is not linearized relative to the deposited energy and I still get seemingly correct MTF results. How is this possible ?
I was trying to estimate the relative edge response of a natural image. This code makes my job much easier.
Is anyone getting the following error
Index exceeds matrix dimensions.
Error in MTFscript (line 230)
array_values_near_edge(ii,:) = (image(i,bound_edge_left_expand:bound_edge_right_expand));
What type of smoothing would marcelo or rachel reccomend?
Having done some tinkering with wiener and Gaussian filtering of the image files, I still seem to hit errors?
Very well written in all other respects!
* Feel free to tinker everyone... perhaps I'll revisit this script and re-write to more common code practices.
Agree with Rachel.This script is not very robust to noise.
I have also found it to crash if the edge is very blurry ie extends over many (50 or so) pixels.
Also, it's always unfortunate and poor practice to name variables the same as built-in functions (e.g "image").
Having said that, with a little tinkering this script is quite nice and will get the job done.
I've been creating my own MTF script, and I wanted to compare my results to yours. However, because my slanted edge must include noise for what I'm testing, I am unable to use your program. The issue happens at line 218, because to find the edge you use interp1, and the variable "strip_cropped" is not monotonic increasing due to the noise in my image. Perhaps you could use a different smoothing method, or use thresholding before finding the subpixel edge. Otherwise, everything else looks like it would work great!
hi there i need the slant wave let for the image and what is the result needed urgently
I have .mat file which containes 200x200 pixels of 50 um size. But the MTFscript does not work!!
I am receiving an error at line 230 about that the index are not integers or logical.
Could you please tell me that what is the problem behind.
thanks a lot. The code worked for me without bug with the exemplary dicom image.
Hi Patrick, I am receiving an error at line 232 about that the index are not integers or logical.
Could you please tell me that what is the problem behind. I am in desperate help need
impossible to download the file ...
I am very new to matlab so my question might be silly, but every time I double click on the cropped area, I get the following error:
Error using interp1 (line 257)
The values of X should be distinct.
Error in SlantEdgeScript (line 218)
edge_position_temp = interp1(strip_cropped,temp_y,threshold,'pchip');
I am stuck at this error and can't proceed. Any advice would be greatly appreciated.
i didn't have any problem with the cropping.
I had to modify the way to estimate the variable level.
and I had to modify many things after because the program worked only when the image is not noisy at all.
(I had to modify the way to find the edge position).
Pierre, I fixed some issues with the cropping of the image and have made it a GUI for more easy of use. Perhaps this might help you.
doesn't work at all.
lot of error to debug in it.
Excellent code! It helps a lot. Appreciate for this.