forked from MaxvandenBoom/ieegmovie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roi_corrmats.m
29 lines (25 loc) · 869 Bytes
/
roi_corrmats.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
clear all;
subjects = [14, 16, 18, 22, 27, 41, 45, 46, 55, 60];
for i = 1:length(subjects)
% load processed data
sub = subjects(i);
fcproc_data = ['fcproc_giftis/sub-' num2str(sub) '.func.gii'];
gifti_path = gifti(fcproc_data);
clean_gifti = gifti_path.cdata;
% get the ROIs
roi_file = ['roi_labels/sub-' num2str(sub) '_ALL_5mm-radius.txt'];
t = readtable(roi_file,'ReadVariableNames',false);
t.Properties.VariableNames = ["vertex", "name"];
electrodes = unique(t.name);
% map the ROI
roi = [];
for i = 1:length(electrodes)
idx = find(strcmp(t.name, electrodes{i}));
bold = mean(clean_gifti(idx,:));
roi(i,:) = bold;
end
% save out the file
roi_corr = corr(roi');
save(['corrmats/sub-' num2str(sub) '-fmri.mat'], 'roi_corr', 'electrodes')
imagesc(roi_corr)
end