Assuming that there is no temporal gap between volumes (sparse imaging, prospective slice time correction), that this is a Philips scanner (as Siemens scanners use different interleaving depending on odd vs even number of slices), and that this is not multi-band, the Matlab script:
TRsec = 3;
nSlices = 48;
TA = TRsec/nSlices; %assumes no temporal gap between volumes
bidsSliceTiming=[0:TA:TRsec-TA]; %ascending
if false %descending
bidsSliceTiming = flip(bidsSliceTiming);
end
if true %interleaved
order = [1:2:nSlices 2:2:nSlices]
bidsSliceTiming(order) = bidsSliceTiming;
end
%report results
fprintf(' "SliceTiming": [\n');
for i = 1 : nSlices
fprintf(' %g', bidsSliceTiming(i));
if (i < nSlices)
fprintf(',\n');
else
fprintf(' ],\n');
end
end
Generates
"SliceTiming": [
0,
1.5,
0.0625,
1.5625,
0.125,
1.625,
0.1875,
1.6875,
0.25,
1.75,
0.3125,
1.8125,
0.375,
1.875,
0.4375,
1.9375,
0.5,
2,
0.5625,
2.0625,
0.625,
2.125,
0.6875,
2.1875,
0.75,
2.25,
0.8125,
2.3125,
0.875,
2.375,
0.9375,
2.4375,
1,
2.5,
1.0625,
2.5625,
1.125,
2.625,
1.1875,
2.6875,
1.25,
2.75,
1.3125,
2.8125,
1.375,
2.875,
1.4375,
2.9375 ],