MATLAB Answers

gaussian and rayleigh distribution MRI Late Enhancement

8 views (last 30 days)
Katarzyna b.
Katarzyna b. on 31 May 2012
Commented: A-J KHAN on 10 Jul 2016
I am stuck with mri images that is why I ask for help.
I want to make Rayleigh and Gaussian distribution of intensities of the image and then fit it to the histogram but it does not work.
Below you can find my example and sample of code:
clc; clear all; close all;
I=dicomread('image.dcm'); 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)));
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)));
figure(3) plot(x,gauss, x,rayl) hold on imhist(I)
THANK YOU for your help in advance

  1 Comment

Ryan on 31 May 2012
Have you looked into using adapthisteq(Image,'Distribution','rayleigh')? There are additional settings and distributions. It is Contrast-Limited Adaptive Histogram Equalization (CLAHE). You can change the tile size that it filters the image at and the number of bins for color choices it can have in addition to some other things. I'm not sure if that will help you or not.

Sign in to comment.

Answers (1)

Stephen on 31 May 2012
[c1, c2] = hist(I(:), 50);
f=fit(c2', c1', 'gauss1');
or for the rayleigh, you'd have to specify it in fittype where 'gauss1' is
f contains a structured variable with the amplitude, mean and std for the gausian, but for the rayleigh it should just be sigma and the amplitude.
you do not need a for loop to create the distribution curves. simply put c2 in place of x(i) and replace 100, 500 with the fit amplitude, and the mean/sigmas with their corresponding fit values. i.e.
gauss=f.a*exp( - (c2-f.b).^2/ (2*f.c^2) );
rayl should be similar. then,
hist(I(:),50),hold on, plot(c2,gauss,c2,rayl)

  1 Comment

A-J KHAN on 10 Jul 2016
Dear i am using the same technique for cardiac MRI can u plz helping me... my ID is waiting for u r responce

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!