% Example computations related to X-ray tomography.
% Here we apply the classical filtered back-projection method to the
% tomographic data created in routine XRsparseA_NoCrimeData_comp.m
%
% Jennifer Mueller and Samuli Siltanen, March 2014

% Load noisy measurements from disc. The measurements have been simulated
% (avoiding inverse crime) in routine XRsparseA_NoCrimeData_comp.m
load XRsparse_NoCrime N mnc mncn measang target

% Reconstruct using Matlab's inverse Radon transform routine
tic
recn = iradon(mncn,measang,'Hann');
recn = recn(2:end-1,2:end-1);
comptime = toc;

% Compute relative errors
err_squ = norm(target(:)-recn(:))/norm(target(:));

% Take a look at the reconstruction
figure(1)
clf
imagesc([target,recn],[0,1])
colormap gray
axis equal
axis off
title(['FBP: error ', num2str(round(err_squ*100)), '%'])

