-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_2019.m
81 lines (58 loc) · 2.33 KB
/
demo_2019.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
70
71
72
73
74
75
76
77
78
79
80
81
clc
close
clear variables
tmp = which('ft_defaults');
if isempty(tmp)
% change the below line to wherever your copy of fieldtrip resides
addpath /path/to/fieldtrip/distribution
ft_defaults
end
subject = {'001' ; '002' ; '003' ; '004' ; '005'};
for sub_ind = 1:5
files.base = ['C:\\Users\goneill\data\' subject{sub_ind}];
files.data = [files.base '\' subject{sub_ind} '_tap_600.ds'];
files.mri = [files.base '\' subject{sub_ind} '_crg.mri'];
if ~exist([files.base '/demo.mat'])
% Import data, recut trials to +/- 15 seconds, filter between 4-30 Hz
% the above cutting times are for the self paced data used in the
% related NIMG paper, choose your own trigger and epochs as you see
% fit
cfg = [];
cfg.dataset = files.data;
cfg.trialdef.eventtype = 'ButtonPress';
cfg.trialdef.prestim = 15;
cfg.trialdef.poststim = 15;
cfg = ft_definetrial(cfg);
cfg.continuous = 'yes';
cfg.channel = {'MEG'};
cfg.bpfilter = 'yes';
cfg.bpfreq = [4 30];
data = ft_preprocessing(cfg);
% Generate the beamforming weights based on COM of Gong's AAL.
filters = go_generateAtlasFilters(data,files.mri);
% Generate the connectivity tensor
cfg = [];
cfg.window.size = 3;
cfg.window.step = 0.25;
cfg.bpfreq = [4 30];
cmat = go_generateDynamicConnectome(cfg,filters,data);
save([files.base '/demo.mat'],'cmat');
end
cmat_list{sub_ind} = [files.base '/demo.mat'];
end
%% Decompose the tensor
cfg = [];
cfg.NICs = 10;
cfg.data = cmat_list;
results = go_decomposeConnectome(cfg);
%% Run group significance test
cfg = [];
cfg.p = 0.05;
cfg.test = 'time'; % switch between 'time'/1 or 'flip'/2, defaults to flip test as it more conservative test.
cfg.bonferroni_factor = 160; % 2 tails x 10 ICs x 8 DOFs;
perms = go_testNetworks(cfg,results);
%% View the results!
close all
cfg = [];
cfg.threshold = 0.6;
go_viewNetworkComponents(cfg,results,perms);