function N_features=cp_isotropic(x,FeatureFN,NonlinId,SmoothId,NormId,Decimation)
% CP_ISOTROPIC  Comparative texture measure study: Isotropic features
%	N_f=cp_isotropic(x,FeatureFN,NonlinId,SmoothId,NormId,Decimation)

N_features=0;
[M_x,N_x]=size(x);
N=max(M_x,N_x)/2;
[v,u]=meshgrid(-N:N-1);
u=fftshift(u)*pi/N;
v=fftshift(v)*pi/N;
x=zeropad(x,2*N);
X=fft2(x);

% +-------------------------------
% | Spatial frequency filters
% +-------------------------------
D_uv=sqrt(u.^2+v.^2); 
D_uv(1,1)=exp(1); % 			Avoid log of zero
sigma=0.275;
for k=(1:7)/pi
  % Book keeping etc.
  N_features=N_features+1;
  fprintf(1,'.');
  
  % Filter design and filtering
  mu_k=2^(k-1);
  F=exp(-0.5*(log(D_uv)-log(mu_k)).^2 / sigma^2);
  F(1,1)=0;
  y=real(ifft2(F.*X));
  y=y(1:M_x,1:N_x); % 			Remove response of zero-padded regions

  % Determine the center frequencies
  F_v=F(1:N,1);
  F_h=F(1,1:N);
  f_0_v=mean(0.5*(0:N-1)/N .* F_v'/mean(F_v));
  f_0_h=mean(0.5*(0:N-1)/N .* F_h /mean(F_h));
  f_0=sqrt(f_0_v^2+f_0_h^2);
  f_0=f_0/2; % 				Lower frequency => enhance smoothing
  
  % Local energy function
  z=cp_energy(y,NonlinId,SmoothId,NormId,f_0);

  % Write feature file
  catframe(z,FeatureFN,[],'Interm',Decimation);
end
  
% +-------------------------------
% | Orientation filters
% +-------------------------------
for mu_k=pi/4*(0:3)
  % Book keeping etc.
  N_features=N_features+1;
  fprintf(1,'.');
  
  % Filter design and filtering
  A_k=angle((u+j*v)*exp(j*mu_k));
  A_k=A_k.*(abs(A_k)<=pi/2) + (sign(A_k)*pi-A_k).*(abs(A_k)>pi/2);
  sigma=17.8533*pi/180;
  G=exp(-0.5*A_k.^2/sigma^2);
  G(1,1)=0;
  y=real(ifft2(G.*X));
  y=y(1:M_x,1:N_x); % 			Remove response of zero-padded regions

  % Local energy function
  z=cp_energy(y,NonlinId,SmoothId,NormId,2.^(-4)*sqrt(2));
  
  % Write feature file
  catframe(z,FeatureFN,[],'Interm',Decimation);
end


