function [slice]=unpack_slice(res, dim)
    shifted = fftshift(res);
    rec=ifft2(shifted, 'symmetric');

    x=size(rec,1);
    y=size(rec,2);
    n=dim/2;

    mod_slice = [rec(x-(n-1):x,y-(n-1):y) rec(x-(n-1):x,1:n); rec(1:n,y-(n-1):y) rec(1:n,1:n)];

    %Instead of fftshift we can fix the image with this operation
    %slice_filter=repmat([1 -1; -1 1], n, n);
    %slice = slice_filter .* mod_slice;

    slice = mod_slice;
end
