diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-02-24 12:35:45 +0100 |
---|---|---|
committer | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-02-24 12:35:45 +0100 |
commit | 3cae1d138c53a3fd042de3d2c9d9a07cf0650e0f (patch) | |
tree | 72f1bf197b33cfb64f259089830910a9754e5893 /samples/s007_3d_reconstruction.m | |
parent | e212ab0d4f84adafa0a2fe11f5e16f856504769a (diff) | |
download | astra-3cae1d138c53a3fd042de3d2c9d9a07cf0650e0f.tar.gz astra-3cae1d138c53a3fd042de3d2c9d9a07cf0650e0f.tar.bz2 astra-3cae1d138c53a3fd042de3d2c9d9a07cf0650e0f.tar.xz astra-3cae1d138c53a3fd042de3d2c9d9a07cf0650e0f.zip |
Added Python interface
Diffstat (limited to 'samples/s007_3d_reconstruction.m')
-rw-r--r-- | samples/s007_3d_reconstruction.m | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/samples/s007_3d_reconstruction.m b/samples/s007_3d_reconstruction.m deleted file mode 100644 index fc9aca6..0000000 --- a/samples/s007_3d_reconstruction.m +++ /dev/null @@ -1,53 +0,0 @@ -% ----------------------------------------------------------------------- -% This file is part of the ASTRA Toolbox -% -% Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp -% 2014-2015, CWI, Amsterdam -% License: Open Source under GPLv3 -% Contact: astra@uantwerpen.be -% Website: http://sf.net/projects/astra-toolbox -% ----------------------------------------------------------------------- - -vol_geom = astra_create_vol_geom(128, 128, 128); - -angles = linspace2(0, pi, 180); -proj_geom = astra_create_proj_geom('parallel3d', 1.0, 1.0, 128, 192, angles); - -% Create a simple hollow cube phantom -cube = zeros(128,128,128); -cube(17:112,17:112,17:112) = 1; -cube(33:96,33:96,33:96) = 0; - -% Create projection data from this -[proj_id, proj_data] = astra_create_sino3d_cuda(cube, proj_geom, vol_geom); - -% Display a single projection image -figure, imshow(squeeze(proj_data(:,20,:))',[]) - -% Create a data object for the reconstruction -rec_id = astra_mex_data3d('create', '-vol', vol_geom); - -% Set up the parameters for a reconstruction algorithm using the GPU -cfg = astra_struct('SIRT3D_CUDA'); -cfg.ReconstructionDataId = rec_id; -cfg.ProjectionDataId = proj_id; - - -% Create the algorithm object from the configuration structure -alg_id = astra_mex_algorithm('create', cfg); - -% Run 150 iterations of the algorithm -% Note that this requires about 750MB of GPU memory, and has a runtime -% in the order of 10 seconds. -astra_mex_algorithm('iterate', alg_id, 150); - -% Get the result -rec = astra_mex_data3d('get', rec_id); -figure, imshow(squeeze(rec(:,:,65)),[]); - - -% Clean up. Note that GPU memory is tied up in the algorithm object, -% and main RAM in the data objects. -astra_mex_algorithm('delete', alg_id); -astra_mex_data3d('delete', rec_id); -astra_mex_data3d('delete', proj_id); |