-
Notifications
You must be signed in to change notification settings - Fork 7
/
g_slicetiming.m
57 lines (41 loc) · 1.52 KB
/
g_slicetiming.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
46
47
48
49
50
51
52
53
54
55
56
57
function [outfile,folder]=g_slicetiming(infile,Is_slicetiming,TR,slice_order)
%slice timing
disp('Slice timing correction...');
if Is_slicetiming==0
disp(['TR is ',num2str(TR),'...']);
outfile='Slice_Timing_Corrected';
folder='2_Slice_Timing_Corrected';
mkdir('./',folder);
copyfile([infile,'.nii.gz'],['./',folder,'/',outfile,'.nii.gz']);
disp('Done...');
else
TR=num2str(TR);
disp(['TR is ',num2str(TR),'...']);
outfile='Slice_Timing_Corrected';
folder='2_Slice_Timing_Corrected';
mkdir('./',folder);
if slice_order==1
disp('Slice order is bottom-up..')
command=['slicetimer -i ',infile,' -o ',outfile,' -r ',TR];
unix(command);
elseif slice_order==2
disp('Slice order is top-down..')
command=['slicetimer -i ',infile,' -o ',outfile,' --down -r ',TR];
unix(command);
elseif slice_order==3
disp('Slice order is interleaved and bottom up..')
command=['slicetimer -i ',infile,' -o ',outfile,' --odd -r ',TR];
unix(command);
elseif slice_order==4
disp('Slice order is interleaved and top down..')
command=['slicetimer -i ',infile,' -o ',outfile,' --odd --down -r ',TR];
unix(command);
else
disp('Slice order is specified elsewhere..')
command=['slicetimer -i ',infile,' -o ',outfile,' -r ',TR,' --ocustom=',slice_order];
unix(command);
end
movefile([outfile,'.nii.gz'],folder);
disp('Done...');
end
end