Rayleigh and Gaussian gaussian and rayleigh distribution MRI Late Enhancement for cardiac images

2 views (last 30 days)
Hello
i found this code on Mathworks.com, when i run this code for my cardiac LV image then i face withe this type of problem. plz i need help here
my id:amjadkhan_cs@yahoo.com
Error using .*
Integers can only be combined with integers of the same class, or scalar doubles.
Error in linspace (line 30)
y = d1 + (0:n1).*(d2 - d1)/n1;
Error in hist (line 94)
edges = linspace(miny,maxy,x+1);
Error in dd (line 13)
[c1,c2]=hist(I(:)',50);"
clear;clear all;close all;
I=dicomread('IM_0001.dcm');
I=uint8(round(double (I)));
I=I(:)',[muhat, sigmahat]=normfit(I);
mean_value=round(muhat);
sigma_value=round(sigmahat);
gauss(i)=100*exp( - (x(i)-mean_value)^2/(2*sigma_value^2)/(sigma_value*sqrt(2*pi)));
%5end
%%x=0:1:29952; for i=1:size(x')
rayl(i)=500*exp( - (x(i)^2/(2*sigma_value^2)*(x(i)/sigma_value^2)));
%%end
%%figure(3),plot(x,gauss, x,rayl),hold on imhist(I)
[c1,c2]=hist(I(:)',50);
f=fit(c2', c1', 'gauss1');
gauss=f.a*exp( - (c2-f.b).^2/ (2*f.c^2) );
hist(I(:),50),hold on, plot(c2,gauss,c2,rayl)

Accepted Answer

Walter Roberson
Walter Roberson on 13 Jul 2016
Change the
hist(I(:),50)
to
hist(double(I(:)),50)
  7 Comments
Walter Roberson
Walter Roberson on 15 Jul 2016
I cannot proceed on this until you post max(I(:)) and min(I(:)) right after reading the .dcm file. .jpg files are not the same as .dcm files.
By the way: you need a comma before the imhist(I) .
I also firmly recommend that you use semi-colon instead of comma after I=I(:)'
A-J KHAN
A-J KHAN on 16 Jul 2016
Edited: Walter Roberson on 16 Jul 2016
Dear sir Walter Roberson, i say thanks to u and plz send me u r email id i say personal thanks to you, its running already....i posted the code for other student if some one need.
clear;clear all;close all;
I=dicomread('IM_0001.dcm');
max(I(:),0);
min(I(:),1);
hist(double(I(:)),50);
I=uint8(round(double (I)));
I=I(:)',[muhat, sigmahat]=normfit(I); mean_value=round(muhat); sigma_value=round(sigmahat);
x=0:1:29952; for i=1:size(x')
gauss(i)=100*exp( - (x(i)-mean_value)^2/(2*sigma_value^2)/(sigma_value*sqrt(2*pi)));
end
x=0:1:29952; for i=1:size(x')
rayl(i)=500*exp( - (x(i)^2/(2*sigma_value^2)*(x(i)/sigma_value^2)));
end
figure(3),plot(x,gauss,x,rayl),hold on,imhist(I)

Sign in to comment.

More Answers (1)

A-J KHAN
A-J KHAN on 14 Jul 2016
Dear sir i still in trouble because i am new in matlab

Community Treasure Hunt

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

Start Hunting!