Tools for bi- multiple exponential decay of a MRI pixel

Hello Folk!
I would be really happy if someone could help me to solve this problem. A MRI dataset should be analysed according to the T2 FID and displayed within a bi or multiple exponential decay diagram (time vs. intensity).
My professor says, he does not know where but there should be programs within MATLAB. Therefore I would like to know if there are programs for that or how to construct a new script for that?
Probably you can help me?
Thanks in advance for all useful answers, Chris

回答(2 个)

use fittype to create your fittype object, and pass that to the fit command. Something like this
g = fittype('a0*exp(-x/t2)','coefficients',{'a0','t2'});
f = fit(x,y,g);
You will likely need to set limits on your model. Here is an example where I limit a0 between 0 and +Inf, and t2 between 10 and 50:
opts = fitoptions(g)
opts.Upper = [Inf 50]
opts.Lower = [0 10]

1 个评论

Okay thanks for your answer. :) Your example shows me a mono exponential decay. However I would need at least a bi - exponential decay.
I have this piece of code where I have to implement the values (times and intensities of a selected pixel). Afterwards it should work.
However I stuck at the point to figure out how to implement the pixel information of the individual images.
Do you have an idea how?
Piece of code: function d=myfun(a,x)
I1 = x(1); I2 = x(2);
t1 = x(3); t2 = x(4);
te=a(:,1); I=a=(:,2);
d=[];
for k=1:length(te)
d=[d (I-I1*exp(-te/t1)-I2*exp(-te/t2)) ];
end
end
startingvals=[0.5 0.5 3 4];
f = @(x)myfun(a,x);
options = optimset('lsqnonlin'); options = optimset(options,'Algorithm','levenberg-marquardt','TolFun',1e-9,'TolX',1e-7,'MaxFunEvals',12000,'MaxIter',1000);
[x,resnorm,residual,exitflag] = lsqnonlin(f,startingvals,[],[],options);
%disp(x);
fprintf('I1= %.2f, I2= %.2f \n',x(1),x(2)); fprintf('t1= %.2f, t2= %.2f \n',x(3),x(4));

请先登录,再进行评论。

If you want another model, simply change this line
g = fittype('a0*exp(-x/t2)','coefficients',{'a0','t2'});
to something like this
g = fittype('a0*exp(-x/z1) + a1*exp(-x/z2)','coefficients',{'a0','a1','z1','z2'});
I don't know your exact model so adjust it to what you want to do. I tried running your code but there is an error here:
I=a=(:,2);

8 个评论

Wow it looks simpler. But I think the approach (optimset) to get the correct values for the four unkowns is missing?
I have made a zip file of one image which I should use. How could I get the info out of this image (intensity and time) for the binary equation?
Would be great if you know that?
Thanks in advance
I don't know what you mean with the binary equation, but you get the fitted parameters from f after you applied your fit:
f = fit(x,y,g);
disp(f.a0)
Load the image with dicomread . To read the header, use dicominfo . The image you sent me is a 256-by-256 that contains only one echo, you need more echoes to do this analysis.
Thank you very much for your help.
Okay I know I can get the values one by one of the images with dicomread. It would be a lot of work to do that for all images. How can I get the info a certain pixel with crosshairs to use these values for the binary decay equation (fittype('a0*exp(-x/z1) + a1*exp(-x/z2))?
I think this is quite tricky?
No problem. This is a different question from your original one and you should post it separately next time. Once you've loaded your images in a 3D matrix A:
figure;
imshow(A(:,:,1),[])
h = impoint;
wait(h); % Double-click the ROI to finish
mask = h.createMask;
mask = repmat(mask,1,1,size(A,3)); % Make the mask 3D
y = A(mask);
Okay thanks again. It´s pretty hard to understand. How can I summarize this in a script? Do I have at first to load the file with CD('path')then I have to pass the info to A and how do I transfer the information of the binary decay afterwards to the diagram?
I really try to understand it but it quite complex for me.
Are you asking how you load the images into A?
Sry for the delay in response. It is great to have some help from you. I try to learn and understand.
However I thing I am far away from the solution to couple the output with the binary decay equation? This is the code which I user and I get the following error (watch screenshot in the appendix) clear all close all
clc
loadpath = (pwd);
cd(loadpath)
figure; imshow(loadpath(:,:,1),[]) h = impoint; wait(h); % Double-click the ROI to finish mask = h.createMask; mask = repmat(mask,1,1,size(A,3)); % Make the mask 3D y = A(mask);
The error occurs because you are passing a string to the imshow command. You need to load the image first, using dicomread (for DICOM files) or imread (for jpg, png, ...).
A=imread('fileName.IMA');
figure;
imshow(A,[]);

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by