-
Notifications
You must be signed in to change notification settings - Fork 0
/
TRWeightingOrNAveFloor.m
executable file
·46 lines (34 loc) · 1.61 KB
/
TRWeightingOrNAveFloor.m
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
39
40
41
42
43
44
45
function [TRWeight,TotalTR] = TRWeightingOrNAveFloor(param,scanTime,tDim,slice,slicedt)
% TRWeight is the number of averages
if nargin < 5
slicedt = 0.053125;
warning(['TRWeightingOrNAveFloor.m: No slicedt specified. Using default slicedt = ' ns(slicedt)])
if nargin < 4
slice = 1;
warning(['TRWeightingOrNAveFloor.m: No slice specified. Using default slice = ' ns(slice)])
if nargin < 3
tDim = 1;
warning(['TRWeightingOrNAveFloor.m: No tDim specified. Using default tDim = ' ns(tDim)])
end
end
end
tReadout = 0.58293 + 0.05472; % TGSE 20 slices, 47 EPI factor, with bandwidth = 2298 Hz + presat
% TR is rounded to avoid floating point errors
switch param.filename
case 'var_te_pCASL'
[~,TEInd] = max(param.t(1:param.num_enc,1,1,1,1),[],1);
TR = squeeze(param.t(TEInd,:,:,:,:)) + tReadout - ((slice-1)*slicedt);
TotalTR = round(TR.*(param.num_enc+1),5); % Multiply by the number of images that have to be acquired
case 'var_te_pCASL_nPLD'
[~,TEInd] = max(param.t(1:param.num_enc,1,1,1,1),[],1);
TR = 0;
for ii = 1:param.multiPLD
ind = TEInd + (ii-1)*param.num_enc;
TR = TR + squeeze(param.t(ind,:,:,:,:)) + tReadout - ((slice-1)*slicedt);
end
TotalTR = round(TR.*(param.num_enc+1),5); % Multiply by the number of images that have to be acquired
case 'var_multi_pCASL'
TR = param.t + tReadout - ((slice-1)*slicedt);
TotalTR = round((2*(sum(TR,tDim))),5);
end
TRWeight = floor(round(squeeze(scanTime./TotalTR),5));