-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRWithRotAndTrans.m
More file actions
28 lines (21 loc) · 825 Bytes
/
Copy pathRWithRotAndTrans.m
File metadata and controls
28 lines (21 loc) · 825 Bytes
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
function sinogram = RWithRotAndTrans( img, rotations, translations_pix, ...
nDet, R )
% rotations is an N element array specifying the rotation in radians
% corresponding to each sinogram projection
% nDet is the number of detectors
[M,~] = size(R);
nThetas = M / nDet;
sinogram = zeros(nThetas,nDet);
[nTranslations,~] = size(translations_pix);
if nTranslations ~= nThetas, error('Input error'); end;
for i=1:nThetas
thisRot = rotations(i);
rotated = imrotate( img, thisRot, 'bilinear', 'crop' );
thisTrans_pix = translations_pix(i,:);
translated = translateImg( rotated, thisTrans_pix );
%sinogram(i,:) = R(nDet*(i-1)+1:nDet*i,:) * translated(:);
tmpSino = R * translated(:);
tmpSino = reshape( tmpSino, [nThetas nDet] );
sinogram(i,:) = tmpSino(i,:);
end
end