-
Notifications
You must be signed in to change notification settings - Fork 0
/
motion_correct_batch.m
38 lines (37 loc) · 1.67 KB
/
motion_correct_batch.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
%-----------------------------------------------------------------------
% Job saved on 17-Sep-2024 19:42:56 by cfg_util (rev $Rev: 7345 $)
% spm SPM - SPM12 (7771)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
clear;
cd '/nd_disk4/qinbolin/Bolin/Data/MT_EPI/20241031/QBL_MAXIAO_MT20241031/Func';
fileID=fopen(['NT.txt'],'r');
nTRs=fscanf(fileID,'%f');
files=[dir(['MT_ON.nii']),dir(['MT_OFF.nii'])];
for runs=1:length(files)
allFiles=[];
nTR=nTRs(runs);
base=files(runs).name;
for TR=1:nTR
instant={[base ',' num2str(TR)]};
allFiles=[allFiles;instant];
end
allFiles={allFiles};
matlabbatch{runs}.spm.spatial.realign.estwrite.data = allFiles;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.quality = 1;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.sep = 1.2;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.fwhm = 1;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.rtm = 0;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.interp = 4;
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.wrap = [0 0 0];
matlabbatch{runs}.spm.spatial.realign.estwrite.eoptions.weight = '';
matlabbatch{runs}.spm.spatial.realign.estwrite.roptions.which = [2 1];
matlabbatch{runs}.spm.spatial.realign.estwrite.roptions.interp = 4;
matlabbatch{runs}.spm.spatial.realign.estwrite.roptions.wrap = [0 0 0];
matlabbatch{runs}.spm.spatial.realign.estwrite.roptions.mask = 1;
matlabbatch{runs}.spm.spatial.realign.estwrite.roptions.prefix = 'r';
end
spm('defaults','FMRI');
spm_jobman('initcfg');
spm_jobman('run',matlabbatch);
exit