Back to the main page.
Bug 820 - cfg.vol should not be required input to ft_sourceanalysis
Status | CLOSED FIXED |
Reported | 2011-07-17 21:26:00 +0200 |
Modified | 2020-09-18 14:09:00 +0200 |
Product: | FieldTrip |
Component: | inverse |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P1 enhancement |
Assigned to: | Johanna |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Johanna - 2011-07-17 21:26:17 +0200
Is cfg.vol needed as input to ft_sourceanalysis, if grid.leadfield, .pos, .inside and .outside, as well as grad, are given? (For example, if leadfield is computed outside of FT and a vol was never generated). Other useful things (e.g. channel selection/matching) do go on in prepare_headmodel and ft_prepare_vol_sens, but if you give a fake vol.o and vol.r, the code is appeased.
Jan-Mathijs Schoffelen - 2011-07-18 09:25:40 +0200
@1: well, only if no additional leadfield computation is required within the function, e.g. for cfg.method='dics' with cfg.refdip = [x y z] @2: ?
Marc Lalancette - 2014-10-27 22:05:41 +0100
I'm wondering if line 291: [vol, sens, cfg] = prepare_headmodel(cfg, data); could be completely bypassed under certain conditions, namely having the lead field and other required info (as Johanna suggested). Otherwise, ft_sourceanalysis does some unnecessary work; it seems to recompute some volume conduction model steps (surface normals, etc.), and gives various errors on number of channel mismatch when supplying "partially cleaned" vol and grad structures, e.g. because 'grad.tra' was emptied. Would it make sense generally to have this bypassed if for example: isfield(cfg.grid, 'leadfield') && isfield(cfg, 'vol') && any( isfield(cfg, {'grad', 'elec'}) ) , or reuse cfg.grid.cfg.vol, cfg.grid.cfg.grad if like I did: cfg.grid = ft_prepare_leadfield? For LCMV at least it seems vol is only needed to get "inside" points, and then vol and sens only if the lead field is not provided. As for "appeasing" the code while avoiding unnecessary computations, it was not obvious with "singleshell" (I didn't want to start "lying" by selecting a different method than really used). I had to do: vol.bnd.pnt = zeros(1, 3); % instead of "emptied by trackconfig" vol.bnd.tri = zeros(0, 3); % instead of "emptied by trackconfig" vol.bnd.nrm = []; % if field absent, recomputed. vol.forwpar = []; % if field absent, recomputed.