-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcrc_USwL_get_defaults.m
50 lines (42 loc) · 1.69 KB
/
crc_USwL_get_defaults.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
function varargout = crc_USwL_get_defaults(defstr, varargin)
% Get/set the defaults values associated with an identifier
% FORMAT uswl_def = crc_USwL_get_defaults
% Return the global "uswl_def" variable defined in crc_USwL_defaults.m.
%
% FORMAT defval = crc_USwL_get_defaults(defstr)
% Return the defaults value associated with identifier "defstr".
% Currently, this is a '.' subscript reference into the global
% "uswl_def" variable defined in crc_USwL_defaults.m.
%
% FORMAT spm_get_defaults(defstr, defval)
% Set the defaults value associated with identifier "defstr" to defval.
% The new defaults value applies immediately to:
% * new modules in batch jobs
% * modules in batch jobs that have not been saved yet
% This value will not be saved for future sessions of SPM/USwLesion.
% To make persistent changes, see help section in crc_USwL_defaults.m.
%__________________________________________________________________________
% Copyright (C) 2008-2014 Wellcome Trust Centre for Neuroimaging
% Copyright (C) 2015 Cyclotron Research Centre
% Volkmar Glauche
% Then modified for use with the USwLesion toolbox by Christophe Phillips
% Cyclotron Research Centre, University of Liege, Belgium
global uswl_def;
if isempty(uswl_def)
crc_USwL_defaults;
end
if nargin == 0
varargout{1} = uswl_def;
return
end
% construct subscript reference struct from dot delimited tag string
tags = textscan(defstr,'%s', 'delimiter','.');
subs = struct('type','.','subs',tags{1}');
if nargin == 1
varargout{1} = subsref(uswl_def, subs);
else
uswl_def = subsasgn(uswl_def, subs, varargin{1});
end
%% NOTICE
% This file is largely inspired from routines available the SPM toolbox:
% http://www.fil.ion.ucl.ac.uk/spm/