-
Notifications
You must be signed in to change notification settings - Fork 7
/
bf_group_GALA.m
61 lines (48 loc) · 1.49 KB
/
bf_group_GALA.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
function res = bf_group_GALA(BF, S)
% Computes Minimum Norm projectors
% Copyright (C) 2013 Wellcome Trust Centre for Neuroimaging
% Vladimir Litvak, using the code from Matti Stenroos and Olaf Hauk
% http://imaging.mrc-cbu.cam.ac.uk/meg/AnalyzingData/DeFleCT_SpatialFiltering_Tools
%
% Please cite:
% Hauk O, Stenroos M.
% A framework for the design of flexible cross-talk functions for spatial filtering of EEG/MEG data: DeFleCT.
% Human Brain Mapping 2013
% $Id$
%--------------------------------------------------------------------------
if nargin == 0
iter = cfg_entry;
iter.tag = 'iter';
iter.name = 'Number of iteration';
iter.strtype = 'r';
iter.num = [1 1];
iter.val = {3};
iter.help = {'Number of iteration'};
GALA = cfg_branch;
GALA.tag = 'GALA';
GALA.name = 'GALA';
GALA.val = {iter};
GALA.help = {'bla bla bla'};
res = GALA;
return
elseif nargin < 2
error('Two input arguments are required');
end
S.modality = 'MEGPLANAR'; % temp
Nl = length(BF);
S.Nl = Nl;
[J, St] = GALA_invert(BF,S);
Nd = length(J)/Nl;
res = cell(1, numel(BF));
for p=1:Nl
BFp = load(BF{p});
% extract sunbject's J
Jp = J(1+(p-1)*Nd:Nd+(p-1)*Nd,:);
BFp.inverse.(S.modality).J = Jp;
BFp.inverse.(S.modality).S = St;
BFp.inverse.(S.modality).channels = BFp.sources.channels.MEG; % temp
outdir = spm_file(BF{p}, 'fpath');
bf_save_path(BFp,fullfile(outdir, 'BF.mat'));
res(p) = {fullfile(outdir, 'BF.mat')};
end
end