How can I correct this problem :

3 次查看(过去 30 天)
i want to create the parametric image ,img : image ,T;total number of image sequence,t number of image
[fn,pn,fi]=uigetfile({'*.cf'})
ffn=horzcat(pn,fn);
global I;
global ffn;
%global rx;
I=dicomread(ffn);
T=size(I,16);%16
% Filtre median pour tout les slices
med=[];
for t=1:T
img(:,:,t)=F_Median(I(:,:,1,t));
end
aux1=img(:,:,t);
for i=1:size(aux1)
for j=1:size(aux1)
somme=0;
for t=1:T
aux=cos((2*pi/T) *(t-1))* aux1;
Icos(i,j)=somme+aux(i,j);
end
end
end
for i=1:size(aux1)
for j=1:size(aux1)
somme=0;
for t=1:T
aux=sin((2*pi/T)*(t-1))*med(i,j,t);
Isin(i,j)=somme+aux(i,j);
end
end
end
% Calcul de l'image d 'amplitude
for i=1:size(aux1)
for j=1:size(aux1)
I_amp(i,j)=sgrt((Icos(i,j))^(2)+(Isin(i,j))^(2) );
end
end
figure();imagesc( I_amp(i,j));
title('Image I_amp');
colorbar;
colormap('jet');
% Calcul de l'image de phase
for i=1:size(aux1)
for j=1:size(aux1)
I_phase(i,j)=arctan(I_sin(i,j)/I_cos(i,j) ) ;
end
end
figure();imagesc( I_phase(i,j));
Index exceeds matrix dimensions
Error in fourier (line 63)
Icos(i,j)=somme+aux(i,j);

采纳的回答

Image Analyst
Image Analyst 2019-1-19
aux is never defined in your program. Only aux1 is. Maybe you meant aux1?
Also, what is the purpose of somme? It is always zero and never changes, so why have it in the loops?
  3 个评论
dziri halima
dziri halima 2019-1-20
Thanks Image Analyst ,Star Strider
Thank you for your comment, I modified my algorithm but I have another error
The phase image is given by ( Iphase=arctan(Icos(i,j)/Isin(i,j)) )
I_phase=atan2((Isin )/(Icos ))
Error using atan2
Not enough input arguments.
Error in parametric (line 107)
I_phase=atan2(Isin/Icos )
Image Analyst
Image Analyst 2019-1-20
When it says that you're using a function improperly, it's always good to look in the help. If you had, you'd have seen that it expected two arguments: a Y and an Y. So it should be
I_phase = atan2(Isin, Icos) ;
Your next error will be when you find out they're null since med is null. You need to think about this whole thing some more.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by