-
Notifications
You must be signed in to change notification settings - Fork 2
/
erf_osc_preprocessing_mri.m
executable file
·73 lines (50 loc) · 1.88 KB
/
erf_osc_preprocessing_mri.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
58
59
60
61
62
63
64
65
66
67
68
69
% load structural MRI and polhemus headshape. Realign the structural scan
% to CTF coordinate system and segment.
if ~exist('subj'); subj = 1; end
if ~exist('isPilot'); isPilot = false; end
erf_osc_datainfo;
if isPilot
cfg.subjects = pilotsubjects;
else
cfg.subjects = subjects;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CORTICAL SHEET, FREESURFER, PREPROCESSING %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% converting dicoms to mgz format
anatomy_dicom2mgz(subj, cfg);
% reslicing to freesufer-friendly 256x256x256
anatomy_mgz2mni(subj, cfg);
anatomy_mgz2ctf(subj, cfg);
% Skullstriping
anatomy_skullstrip(subj, cfg);
%% Freesurfer scripts (creates subject-specific subdirectory in the directory where previous files are stored)
if ~ft_hastoolbox('qsub',1)
addpath /project/3011085.02/scripts/fieldtrip/qsub;
end
qsubfeval(@qsub_anatomy_freesurfer, cfg, subj, 1,...
'memreq', 1024^3 * 6, 'timreq', 720*60, 'batchid', sprintf('erfosc_freesurfer1_%d', subj))
%% Check-up and white matter segmentation cleaning if needed
anatomy_volumetricQC(subj, cfg)
anatomy_wmclean(subj, cfg)
%% Freesurfer qsub2
if ~ft_hastoolbox('qsub',1)
addpath /project/3011085.02/scripts/fieldtrip/qsub;
end
qsubfeval(@qsub_anatomy_freesurfer, cfg, subj, 2,...
'memreq', 1024^3 * 7, 'timreq', 720*60, 'batchid', sprintf('erfosc_freesurfer2_%d', subj));
%% Post-processing Freesurfer script: workbench HCP tool
if ~ft_hastoolbox('qsub',1)
addpath /project/3011085.02/scripts/fieldtrip/qsub;
end
qsubfeval(@qsub_anatomy_freesurfer, cfg, subj, 3,...
'memreq', 1024^3 * 6, 'timreq', 480*60, 'batchid', sprintf('erfosc_workbench_%d', subj));
%%
% Sourcemodel
anatomy_sourcemodel2d(subj, cfg);
anatomy_sourcemodel3d(subj, cfg); % specify resolution in cfg.resolution (in mm)
% Headmodel
anatomy_headmodel(subj, cfg);
% Coregistration check
anatomy_coregistration_qc(subj, cfg);