function [image] = backproject2D(data)
%------------------------------------------------------------------
% Function: backproject2D(data)
%
% Inputs:  data - 2 Dimensional projection data 
%
% Output: image - 2 Dimensional backprojected image
%------------------------------------------------------------------

    %Find the number of projection angles and bins
    [M N] = size(data);
    nangles = M;
    npixels = N;
    
    %data = projfilter(data);

    otemp = zeros(npixels,npixels);              % temporary array
    image = zeros(npixels,npixels);              % reconstructed image
    
    
    % Loop through angles of rotation
    for l = 1:nangles
        
        %fprintf('Backprojecting angle [%g] ... \n',l);
        theta = (l-1)*360/nangles;
        
        % Sum along each ray
        for jj = 1:npixels
            for kk = 1:npixels
                
                otemp(jj,kk) = data(l,kk);
                
            end
        end
                    
        % Rotate backprojected image and sum
        image = image + imrotate(otemp,-theta,'bilinear','crop');

    end
    
    image = image./nangles;