Back to the main page.

Bug 2945 - ft_prepare_sourcemodel described in old way (?) in warping tutorial

Status CLOSED WORKSFORME
Reported 2015-08-17 15:13:00 +0200
Modified 2019-08-10 12:30:51 +0200
Product: FieldTrip
Component: documentation
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Stephen Whitmarsh - 2015-08-17 15:13:03 +0200

Hi, Am I right to conclude that in: http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space the use of ft_prepare_sourcemodel is described inproperly? It uses a single cfg input, while the function expects (cfg,headmodel,grad): Tutorial: cfg = []; cfg.grid.xgrid = -20:1:20; cfg.grid.ygrid = -20:1:20; cfg.grid.zgrid = -20:1:20; cfg.grid.unit = 'cm'; cfg.grid.tight = 'yes'; cfg.inwardshift = -1.5; cfg.vol = template_vol; template_grid = ft_prepare_sourcemodel(cfg); Function: function [grid, cfg] = ft_prepare_sourcemodel(cfg, vol, sens) I understand that the headmodel is now an extra argument, but I don't understand where the grad structure used to be.


Robert Oostenveld - 2015-08-17 15:25:07 +0200

the 2nd and 3rd input arguments are there only for historical reasons, you should not use them like this. The code actually does this around line 150: if ~isfield(cfg, 'headmodel') && nargin>1 % put it in the configuration structure % this is for backward compatibility, 13 Januari 2011 cfg.headmodel = headmodel; end if ~isfield(cfg, 'grad') && ~isfield(cfg, 'elec') && nargin>2 % put it in the configuration structure % this is for backward compatibility, 13 Januari 2011 cfg.grad = sens; end


Robert Oostenveld - 2019-08-10 12:30:51 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.