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).
[cc lang="matlab"]
te = [10:10:320]‘;
y = 200 * exp(-te ./ 22 ) + 800 * exp(-te ./ 84) + 2.4;
noise_factor = 5;
e = noise_factor * randn(size(y));
y_e = y + e;
[/cc]
Plot the data
Plot the data..
[cc lang="matlab"]
figure(1),clf;
plot(te, y_e,’rx-’);
title(‘Test Data’);
xlabel(‘TE (ms)’);
ylabel(‘Signal’);
grid on;
[/cc]
Fit with NNLS
Now fit the data using the NNLS algorithm.
[cc lang="matlab"]
% Construct the exponential kernel for NNLS
t2 = 10:10:2000;
A = exp( -kron(te, 1./ t2) );
% Add a baseline component
A = [A ones(size(A,1), 1)];
% Solve it.
x = lsqnonneg(A, y_e);
baseline = x(end);
amplitudes = x(1:end-1);
[/cc]
Plot the T2 Spectrum
Plot the resulting T2 spectrum on a logarithmic scale.
[cc lang="matlab"]
figure(2),clf;
semilogx(t2, amplitudes);
xlabel(‘T2 (ms)’);
ylabel(‘Amplitude (arb)’);
title(‘T_2 Spectrum’);
grid on;
[/cc]
Plot the Noisy Decay Curve and Fitted Line
Now reconstruct the signal intensities and plot back on top of the original data.
[cc lang="matlab"]
y_recon = A * x;
figure(1),clf; hold on;
plot(te, y_e’, ‘rx’);
plot(te, y_recon, ‘b-’);
grid on;
xlabel(‘TE (ms)’);
ylabel(‘Signal (arb)’);
[/cc]
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.



