function recon = inverse_dft_block(input,blocksize);

% function recon = inverse_dft_block(input,blocksize);
%
% INVERSE_DFT_BLOCK  -- This performs the inverse of DFT_BLOCK, reconstructing
%                       the original image from a set of band images.
%
% Input Parameters:
%  input     -- The 3-dimensional matrix of band images to be decoded
%  blocksize -- Blocks are 1 row x "blocksize" columns.  (Optional: defaults to 8)
%
% Output Parameters:
%  recon     -- The reconstructed image
%
%  MB, DN, 10/4/01


if ~exist('blocksize','var') | isempty(blocksize)
    blocksize = 8;
end

sz = [size(input,1), size(input,2)*size(input,3)];


% Reconstruct FFT coefficients from real and imaginary coefficients

recon = input*blocksize;
recon(:,:,2:blocksize/2) = recon(:,:,2:blocksize/2)/sqrt(2) + j*recon(:,:,(blocksize/2+2:blocksize))/sqrt(2);
recon(:,:,(blocksize/2+2:blocksize)) = flipdim(conj(recon(:,:,2:blocksize/2)),3);

recon = ifft(recon,[],3);
recon = permute(recon,[1 3 2]);
recon = reshape(recon,[sz(1),sz(2)]);



