function [data] = project2D(obj,nangles)
%------------------------------------------------------------------
% Function: project2D(obj,nanles,dimesion)
%
% Inputs:     obj - 2 Dimensional image 
%         nangles - Number of projection data angles
%
% Output:    data - 2 Dimensional projections from the object input
%------------------------------------------------------------------

    %Find the number of pixels
    [M N] = size(obj);
    npixels = M;

    otemp = zeros(M,N);              % temporary array
    proj = zeros(nangles,N);         % projection data
    
    
    % Loop through angles of rotation
    for l = 1:nangles
        
        %fprintf('Projecting angle [%g] ... \n',l);
        theta = (l-1)*360/nangles;
            
        % Rotate object
        otemp = imrotate(obj,theta,'bilinear','crop');
        
        % Sum along each ray
        for jj = 1:npixels
            for kk = 1:npixels
                proj(l,jj) = proj(l,jj) + otemp(kk,jj);
            end
        end

    end

    %Saves the projections into the data variable
    data = proj;