forked from mmagnuski/braintools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_dipfit_settings.m
56 lines (45 loc) · 1.46 KB
/
my_dipfit_settings.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
function EEG = my_dipfit_settings(EEG)
% NOHELPINFO
% get path to eeglab
eegpth = fileparts(which('eeglab'));
% check dipfit version
bgpth = [eegpth, '\plugins\'];
lst = dir(bgpth);
lst = lst([lst.isdir]);
where = regexpWhere({lst.name}, 'dipfit');
dipver = lst(where).name(7:end);
% add path
addpath([eegpth, '\plugins\dipfit', dipver, '\']);
% transform vector
transf = [0.092784, -13.3654, -1.9004, 0.10575, 0.003062,...
-1.5708, 10.0078, 10.0077, 10.1331];
hdmf = [eegpth, '\plugins\dipfit', dipver, '\',...
'standard_BEM\standard_vol.mat'];
mrif = [eegpth, '\plugins\dipfit', dipver, '\',...
'standard_BEM\standard_mri.mat'];
chanf = [eegpth, '\plugins\dipfit', dipver, '\',...
'standard_BEM\elec\standard_1005.elc'];
% check channels
allchn = 1:length(EEG.chanlocs);
% % remove E62 and E63
% remind = zeros(1, length(remel));
% elstep = 0;
% for el = 1:length(remel)
% elind = strcmp(remel{el}, {EEG.chanlocs.labels});
% if sum(elind) == 1
% elstep = elstep + 1;
% remind(elstep) = find(elind);
% end
% end
% % trim if some were not found:
% remind = remind(1:elstep);
% clear elstep el elind
% % remove these channels and badchannels:
% allchn(union(ICAw(r).chan.bad, remind)) = [];
goodchan = allchn;
clear allchn % remind
%% DIPfit
% dipfit options
EEG = pop_dipfit_settings( EEG, 'hdmfile', hdmf, 'coordformat', 'MNI',...
'mrifile', mrif, 'chanfile', chanf, 'coord_transform', transf,...
'chansel', goodchan);