image thumbnail
from PET reconstruction system matrix by Munir Ahmad
DLL to generate a PET system matrix for image reconstruction

sys_mat.m
sys = struct('hpixels', uint16(32),...
             'vpixels', uint16(32),...
             'trays',   uint16(32),...
             'nangles', uint16(32),...
             'dx',      double(1.0),...
             'dy',      double(1.0),...
             'drho',    double(1.0),...
             'drad',    double(96.0));

mat = zeros(1024, 1024);

for i=1:1024
         
    out = sys_ele(int16(i-1), sys); % call routine for one LOR path
    
    y = out(:, 1);  % x indices of intersected pixels
    x = out(:, 2);  % y indices of intersected pixels
    l = out(:, 3);  % intersected lengths
    
    mat(i, ((x ) .* 32 + (y + 1))) = l;     % fill system matrix elements
    
end

colormap('gray');
imagesc(mat');

Contact us at files@mathworks.com