forked from hMRI-group/hMRI-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 5
/
tbx_scfg_hmri_config.m
84 lines (74 loc) · 3.52 KB
/
tbx_scfg_hmri_config.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
82
83
84
function hmri_config = tbx_scfg_hmri_config
% Configuration file for the "histological MRI" (hMRI) toolbox
% Previously named "Voxel-Based Quantification" (VBQ)
% -> Dealing with local defaults ("Configure Toolbox" branch)
%_______________________________________________________________________
% Copyright (C) 2014 Wellcome Trust Centre for Neuroimaging
%--------------------------------------------------------------------------
% Customised defaults
%--------------------------------------------------------------------------
customised = cfg_files;
customised.tag = 'customised';
customised.name = 'Customised';
customised.help = {['Select the [hmri_local_defaults_*.m] file containing ' ...
'the specific defaults to process your data. Note that all other defaults ' ...
'values will be reinitialised to their standard values.']};
customised.filter = 'm';
customised.dir = fullfile(fileparts(mfilename('fullpath')),'config','local');
customised.ufilter = '^hmri_.*\.m$';
customised.num = [1 1];
%customised.def = @(val)hmri_get_defaults('local_defaults', val{:});
% ---------------------------------------------------------------------
% Use standard defaults (no customization)
% ---------------------------------------------------------------------
standard = cfg_entry;
standard.tag = 'standard';
standard.name = 'Standard';
standard.help = {''};
standard.strtype = 's';
standard.num = [1 Inf];
standard.val = {'yes'};
%--------------------------------------------------------------------------
% Set hMRI defaults parameters
%--------------------------------------------------------------------------
hmri_setdef = cfg_choice;
hmri_setdef.tag = 'hmri_setdef';
hmri_setdef.name = 'Defaults parameters';
hmri_setdef.help = {['You can either stick with standard defaults parameters ' ...
'from [hmri_defaults.m] or select your own customised defaults file.']};
hmri_setdef.values = {standard customised};
hmri_setdef.val = {standard};
% ---------------------------------------------------------------------
% Configure the hMRI Toolbox - load local, user-defined defaults file and
% overwrite standard defaults
% ---------------------------------------------------------------------
hmri_config = cfg_exbranch;
hmri_config.tag = 'hmri_config';
hmri_config.name = 'Configure toolbox';
hmri_config.val = { hmri_setdef };
hmri_config.help = {['Customised default parameters can be set here by selecting ' ...
'a customised [hmri_local_defaults_*.m] file. Type [help hmri_local_defaults] for ' ...
'more details.']};
hmri_config.prog = @hmri_run_config;
end
%----------------------------------------------------------------------
% =========================================================================
% (VOUT &) RUN SUBFUNCTION(S)
% =========================================================================
function out = hmri_run_config(job)
%==========================================================================
% PURPOSE
% Load standard defaults and overwrite thme by customised values if
% provided via local defaults file.
%==========================================================================
% reinitialise standard defaults
hmri_defaults;
% overwrite with customised defaults
if isfield(job.hmri_setdef,'customised')
deffnam = job.hmri_setdef.customised;
hmri_get_defaults('local_defaults',deffnam);
spm('Run',deffnam);
end
out = hmri_get_defaults;
end
%_______________________________________________________________________