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/s009_projection_matrix.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/s009_projection_matrix.m')
-rw-r--r-- | samples/s009_projection_matrix.m | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/samples/s009_projection_matrix.m b/samples/s009_projection_matrix.m deleted file mode 100644 index efda0d2..0000000 --- a/samples/s009_projection_matrix.m +++ /dev/null @@ -1,45 +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(256, 256); -proj_geom = astra_create_proj_geom('parallel', 1.0, 384, linspace2(0,pi,180)); - -% For CPU-based algorithms, a "projector" object specifies the projection -% model used. In this case, we use the "strip" model. -proj_id = astra_create_projector('strip', proj_geom, vol_geom); - -% Generate the projection matrix for this projection model. -% This creates a matrix W where entry w_{i,j} corresponds to the -% contribution of volume element j to detector element i. -matrix_id = astra_mex_projector('matrix', proj_id); - -% Get the projection matrix as a Matlab sparse matrix. -W = astra_mex_matrix('get', matrix_id); - - -% Manually use this projection matrix to do a projection: -P = phantom(256)'; -s = W * P(:); -s = reshape(s, [proj_geom.DetectorCount size(proj_geom.ProjectionAngles, 2)])'; -figure(1), imshow(s,[]); - -% Because Matlab's matrices are stored transposed in memory compared to C++, -% reshaping them to a vector doesn't give the right ordering for multiplication -% with W. We have to take the transpose of the input and output to get the same -% results (up to numerical noise) as using the toolbox directly. - -% Each row of the projection matrix corresponds to a detector element. -% Detector t for angle p is for row 1 + t + p*proj_geom.DetectorCount. -% Each column corresponds to a volume pixel. -% Pixel (x,y) corresponds to column 1 + x + y*vol_geom.GridColCount. - - -astra_mex_projector('delete', proj_id); -astra_mex_matrix('delete', matrix_id); |