MATLAB: How to correct this problem :

cosphase image

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);

Best Answer

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?