%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%
% 2 Dimensional Fourier Transform
%
%       [ima_out] = fft2(ima_in,direction)
%
% This function calculates the complex Fourier transform
% of the input image ima_in. If direction is set to 1, the direct fft
% is performed, otherwise, the inverse one performed. 
%
%       ima_in : input image. Can be real or imaginary
%		  direction: optional parameter. By default, direct Fourier transform is assumed
%       imafft : output image
%               
%
% Yvan Petillot, December 2001                                  
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [ima_out] = fft(ima_in,direction)

if nargin == 1
   direction = 1;
end

if (direction == 1)
   [ima_out,mag,phi] = fft2d(ima_in);
else	
   ima_out = ifft2d(ima_in);
end	

  
  