T2 Curve Fitting – NNLS
White matter has been shown to consist of multiple exponential components related to different water compartments. A good way to fit signal intensity data for multi-exponential decay curves is to use the non-negative least squares algorithm (NNLS). Click runme_nnls.m for the whole matlab code.
Construct Test Data
First construct some test data with noise (gaussian distributed, not really what MR data is, but all right for now).
1 2 3 4 5 6 7 8 |
Plot the data
Plot the data..
1 2 3 4 5 6 |
Fit with NNLS
Now fit the data using the NNLS algorithm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Plot the T2 Spectrum
Plot the resulting T2 spectrum on a logarithmic scale.
1 2 3 4 5 6 7 8 |
Plot the Noisy Decay Curve and Fitted Line
Now reconstruct the signal intensities and plot back on top of the original data.
1 2 3 4 5 6 7 8 |
Then we can plot the residuals of the fitted curve (blue) and the measured points (red x’s):
There is actually a lot of information in the residuals plot. For one, we can look at the standard deviation of the points to determine the amount of noise. As well, we can see if there are trends in the residuals, for example, is there a trend for the residuals to increase or decrease as a function of TE.
References
1. C. L. Lawson and R. J. Hanson. Solving least square problems. Prentice Hall, Englewood Cliffs NJ, 1974
This is the book in which the algorithm is originally described. Theorems to show NNLS will stop in a finite number of steps and will arrive at the minimum L2 solution.
2. K.P. Whittall and A.L. MacKay. Quantitative interpretation of NMR relaxation data. J. Magn. Reson., 84:134-152, 1989.
One of the first papers in MRI to use the NNLS algorithm. Good discussion of regularization techniques as well.







Dear Craig,
First of all, i would like to appriciate your efforts to provide step by step discription for T2 curve fitting. Actually, I’m new to matlab eventhough i tried to run the above code in matlab and it works fine for sample data.
Now, could you please let me know few things.
Actually, I’ve got a series of MR images (Multi echo- spin echo with fix TR and different TE value). According to our literature to generate color coded map of T2 relaxations. we need to fit the signal intesities pixel by pixel using mono expenential curve fitting.
Since, I’m new to Matlab. Coul du please let me know how to genereate signal intensities from that Image and after that. how to generate color coded map.
i would be very thankful for your kind consideration to my query.
Thanks & regards
Dileep