summaryrefslogtreecommitdiffstats
path: root/matlab/tools/astra_create_backprojection_cuda.m
blob: 08ef8a57ba9b481b685748f7334b15587c170a8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function backProj = astra_create_backprojection_cuda(sinogramData, proj_geom, vol_geom)
    %--------------------------------------------------------------------------
    % backProj = astra_create_backprojection_cuda(sinogramData, proj_geom, vol_geom)
    % 
    % Creates a CUDA-based simple backprojection
    %
    % sinogramData: 2D matrix with projections stored row-based
    % theta: projection angles, length should be equal to the number of rows in
    % sinogramData
    % reconstructionSize: vector with length 2 with the row and column count of
    % the reconstruction image
    % backProj: 2D back projection from sinogram data
    %--------------------------------------------------------------------------
    %--------------------------------------------------------------------------
    % This file is part of the ASTRA Toolbox
    % 
    % Copyright: 2010-2021, imec Vision Lab, University of Antwerp
    %            2014-2021, CWI, Amsterdam
    % License: Open Source under GPLv3
    % Contact: astra@astra-toolbox.com
    % Website: http://www.astra-toolbox.com/
    %--------------------------------------------------------------------------

    recon_id = astra_mex_data2d('create', '-vol', vol_geom, 0);
    sinogram_id = astra_mex_data2d('create', '-sino', proj_geom, sinogramData);

    cfg = astra_struct('BP_CUDA');
    cfg.ProjectionDataId = sinogram_id;
    cfg.ReconstructionDataId = recon_id;

    alg_id = astra_mex_algorithm('create', cfg);
    astra_mex_algorithm('run', alg_id);
    backProj = astra_mex_data2d('get', recon_id);

    astra_mex_data2d('delete', sinogram_id);
    astra_mex_data2d('delete', recon_id);
    astra_mex_algorithm('delete', alg_id);
end