-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckStatsOnSourceDB.m
More file actions
84 lines (72 loc) · 3.52 KB
/
Copy pathcheckStatsOnSourceDB.m
File metadata and controls
84 lines (72 loc) · 3.52 KB
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
82
83
%% Run statistics on existing source reconstructio files - NOT NORMALIZED TO MNI
sourceCondition1 = load('C:\Users\roeysc\Desktop\PNES\sourceDB\8-13\pLT1997_R_C_ConditionFilter.mat');
sourceCondition1 = sourceCondition1.sourceCondition1;
sourceCondition2 = load('C:\Users\roeysc\Desktop\PNES\sourceDB\8-13\pLT1997_R_O_ConditionFilter.mat');
sourceCondition2 = sourceCondition2.sourceCondition1;
mriFile = load('C:\Users\roeysc\Desktop\PNES\MRI\realigned\pLT1997.mat');
mriFile = mriFile.mriReal;
design = [ ones(1,length(sourceCondition1.trial)), 2*ones(1,length(sourceCondition2.trial)) ];
cfg = [];
cfg.dim = sourceCondition1.dim;
cfg.method = 'montecarlo';
cfg.statistic = 'indepsamplesT';
cfg.parameter = 'pow';
cfg.correctm = 'cluster';
cfg.numrandomization = 1000;
cfg.alpha = 0.01;
cfg.tail = 0; % OR FIX THE TAIL?
cfg.design(1,:) = design;
cfg.ivar = 1; % row of design matrix that contains independent variable (the conditions)
stat = ft_sourcestatistics(cfg, sourceCondition1, sourceCondition2);
% stat = ft_sourcestatistics(cfg, sourceCombined); % THIS WAS USED WHEN ANALYSIS WAS PERFORMED USING A COMMON FILTER
probNoNAN = stat.prob(~isnan(stat.prob)); % check if there is a place where ~p=1
find(probNoNAN~=1)
if ~isempty(ans)
%% Plot Probability Statistics
% mriFile = ft_read_mri(mriFile); % MARKED WITH % SINCE THIS WAS DONE ABOVE
mriFile = ft_volumereslice([ ],mriFile );
cfg = [];
cfg.parameter = 'prob';
statplot = ft_sourceinterpolate(cfg, stat, mriFile);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% plot the probability values on the MRI - SLICE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cfg = [];
cfg.method = 'slice';
cfg.funparameter = 'prob'; % DO WE WANT TO PLOT THE AVERAGE POWER INSTEAD?. Then we would have to do ft_sourceinterpolate in line 47 on sourceCondition1 and not on stat
cfg.maskparameter = 'mask';
% cfg.colormap = ; % see Matlab function COLORMAP
ft_sourceplot(cfg, statplot);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % plot the probability values on the MRI - ORTHO
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cfg = [];
cfg.method = 'ortho';
cfg.funparameter = 'prob';
cfg.maskparameter = 'mask';
cfg.opacitymap = 'rampup';
ft_sourceplot(cfg, statplot);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% plot the probability values on the MRI - SURFACE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % normalize coordinates
% cfg = [];
% cfg.coordsys = 'ctf'; %WE HAVE TO CHECK THAT
% cfg.nonlinear = 'no';
% statplotNorm = ft_volumenormalise(cfg, statplot);
%
% cfg = [];
% cfg.method = 'surface';
% cfg.surffile = 'C:\Users\roeysc\Desktop\PNES\MRI\surface_l4_both.mat'; % ###### THIS COULD BEWRONG AND A REAL MRI FILE SHOULD BE USED ######
% cfg.funparameter = 'prob';
% cfg.maskparameter = cfg.funparameter;
% cfg.funcolormap = 'jet';
% cfg.opacitymap = 'rampdown';
% cfg.projmethod = 'nearest';
% cfg.opacitylim = [0 1];
% cfg.surfdownsample = 10;
% ft_sourceplot(cfg, statplotNorm);
%
% % cfg.colormap = ; % see Matlab function COLORMAP
% % ft_sourceplot(cfg, statplot);
end