Fit MRI data pixel by pixel.. anything quiker?

Hi everybody, To those not familiar with MRI: Over time after excitation, the MRI signal decays following a mono-exponential curve (=> T2/T2* time).
Here my problem: I have 3D MRI data (256 x 256 x 256 x4) where: the 2 first dimensions are the images, the third one the nb of slices the 4th dimension represent different echoes time. AND a mask with only the value to fit (1717227 fit to perform /scan..) I want to get the result of the fit on maps representing all the parameter of the fit
How I perform the fit: read the data over time, keep the signal and fit to get the result. I loop only where the mask is positive to reduce the number of fit. Up to now everything is ok.
And I loop over slices and all the pixels... I used parfor on 12 workers to perform the fit part but it still take a lot of time (it s running over 4 days now and it s not done yet)
my question is do you have any method to follow for reduce the time of analysis?
thanks for your help JC
the code:
for leo =1:size(T2map_data,3) %slices
[lrx jcb]=find(Mask(:,:,leo)>1);
parfor joe=1:size(lrx,1)
sig=getsig(T2map_data,lrx(joe),jcb(joe),leo);
[M(joe), T2st(joe), Cste(joe), gof(joe), res] = createFit_T2stmap(time, sig);
end
for joe=1:size(lrx,1) %%I do another loop otherwise parfor don t run extra time >2min/ slice
[M0, T2stmap, Cstes, Goodof] = ResultMatrix (M0,T2stmap, Cstes, Goodof, M(joe), T2st(joe), Cste(joe), gof(joe),lrx(joe),jcb(joe),leo);
end
toc
end

5 Comments

Thanks Amith for your answer yes, all the matrix are already preallocate. This is by the way a good way to avoid the out of memory error on the middle of the fit ;) JC
I am doing the exact same process but haven't incorporated parfor loops yet. Have you come across a faster way to accomplish your problem yet?
Do you have a test data set I can test a couple different methods?
If you can somehow do some transformation to get your data into the form:
[A][x] = [b]
where [A] is rectangular and [x] represents coefficients, than you can use
x = A\b
to solve the least squares problem. I do not use parfor or for and I deal with 15e6 data points on a regular basis. This often translates into an A matrix that is 15e6 x 256 in size. This type of problem solves in minutes on my i7 3.4Ghz quad core with 24GB of ram.

Sign in to comment.

Answers (0)

Categories

Asked:

on 31 May 2013

Edited:

on 17 Jun 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!