Closed pbellec closed 6 years ago
the psom_struct_defaults function could be simplified.
psom_struct_defaults
Defining the default options would look like
def.warp.fwhm = 2; def.warp.nb_iter = 4; def.verbose = true; def.write = NaN;
And now the user would specify
opt.warp.fwhm = 5; opt.write = true;
You would apply the defaults like this
opt = psom_defaults(def,opt);
which should output in that case: opt.warp.fwhm = 5; opt.warp.nb_iter = 4; opt.verbose = true; opt.write = true;
this behaviour would work recursively on any structure depth.
if opt.write is not specfied, psom_defaults return an error (because of the NaN default).
feedback by @poquirion: if a field is present in opt but not in def, keep it and issue a warning. Have a second argument to turn off the warnings.
opt
def
the
psom_struct_defaults
function could be simplified.Defining the default options would look like
def.warp.fwhm = 2; def.warp.nb_iter = 4; def.verbose = true; def.write = NaN;
And now the user would specify
opt.warp.fwhm = 5; opt.write = true;
You would apply the defaults like this
opt = psom_defaults(def,opt);
which should output in that case: opt.warp.fwhm = 5; opt.warp.nb_iter = 4; opt.verbose = true; opt.write = true;
this behaviour would work recursively on any structure depth.
if opt.write is not specfied, psom_defaults return an error (because of the NaN default).