forked from JoramSoch/MACS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatch_MS_PPs_group_auto.m
80 lines (67 loc) · 2.75 KB
/
batch_MS_PPs_group_auto.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
function module = batch_MS_PPs_group_auto
% _
% Configure MATLAB Batch for "MS: calculate PPs (automatic)"
%
% Author: Joram Soch, BCCN Berlin
% E-Mail: joram.soch@bccn-berlin.de
%
% First edit: 04/05/2018, 16:50 (V1.2/V18)
% Last edit: 04/05/2018, 16:50 (V1.2/V18)
%=========================================================================%
% F I E L D S %
%=========================================================================%
% Select MS.mat
%-------------------------------------------------------------------------%
MS_mat = cfg_files;
MS_mat.tag = 'MS_mat';
MS_mat.name = 'Select MS.mat';
MS_mat.help = {'Select the MS.mat file describing a model space of GLMs.'};
MS_mat.filter = 'mat';
MS_mat.ufilter = '^MS\.mat$';
MS_mat.num = [1 1];
% Enter LME map
%-------------------------------------------------------------------------%
LME_map = cfg_entry;
LME_map.tag = 'LME_map';
LME_map.name = 'Enter LME map';
LME_map.help = {'Enter the name of the log model evidence map that you want to use.'
'In the SPM.mat, LME maps will then be accessed via "SPM.MACS.[input].fname".'
'If you are unsure what this means, just leave this variable at its default value.'};
LME_map.strtype = 's';
LME_map.num = [1 Inf];
LME_map.val = {'cvLME'};
%=========================================================================%
% M O D U L E %
%=========================================================================%
% MA: LFE group (auto)
%-------------------------------------------------------------------------%
module = cfg_exbranch;
module.tag = 'MS_PPs_group_auto';
module.name = 'MS: calculate PPs (automatic)';
module.val = {MS_mat LME_map};
module.help = {'Posterior Probabilities within Model Space of General Linear Models'
'Type "help MS_PPs_uniform" for help on this module.'};
module.prog = @run_module;
%=========================================================================%
% F U N C T I O N S %
%=========================================================================%
% Run batch
%-------------------------------------------------------------------------%
function out = run_module(job)
% get input variables
load(job.MS_mat{1});
mods = MS.GLMs;
% execute operation
[N,M] = size(MS.SPMs);
for i = 1:N
LMEs = cell(M,1);
for j = 1:M
load(MS.SPMs{i,j});
eval(strcat('H = SPM.MACS.',job.LME_map,';'));
LMEs{j} = strcat(SPM.swd,'/',H.fname);
end;
folder = strcat(fileparts(LMEs{1}),'/','..');
MS_PPs_uniform(LMEs, mods, folder);
end;
% set output files
out = [];