Back to the main page.

Bug 3442 - Repeated calls to ft_prepare_vol_sens/sb_transfer by functions in the simbio FEM-model pipeline

Status CLOSED FIXED
Reported 2018-08-21 15:24:00 +0200
Modified 2019-04-01 08:57:42 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Arnfinn Aamodt - 2018-08-21 15:24:06 +0200

Hi, We are doing source reconstruction, and for the forward modelling we use a SimBio FEM-model with the recommended pipeline from Vorwerk et al 2018 (https://doi.org/10.1186/s12938-018-0463-y). The problem is that in our pipeline we successively call ft_prepare_vol_sens, ft_prepare_headmodel, ft_prepare_leadfield and ft_sourceanalysis. The latter two of these functions calls prepare_headmodel (not the same as ft_prepare_headmodel!), which in line 112 again calls ft_prepare_vol_sens. So in summary, we end up calling ft_prepare_vol_sens three times in our pipeline, which is problematic, because ft_prepare_vol_sens is very slow for our FEM model. So far, our fix is to change prepare_headmodel to implement a test to see if it is necessary to run ft_prepare_vol_sens again, as follows (ft_prepare_vol_sens populates the headmodel.transfer field by calling sb_transfer): if ~isfield(headmodel,'transfer') [headmodel, sens] = ft_prepare_vol_sens(headmodel, sens, 'channel', cfg.channel, 'order', cfg.order); end Even though this problem is probably less significant for other types of models, because ft_prepare_vol_sens might be quicker, I still think the problem should be fixed. Best regards, Arnfinn Aamodt


Arnfinn Aamodt - 2018-08-21 15:56:37 +0200

Sorry, there is a small error in the bug-report. Where it says: "The problem is that in our pipeline we successively call ft_prepare_vol_sens, ft_prepare_headmodel, ft_prepare_leadfield and ft_sourceanalysis.", it should really say "The problem is that in our pipeline we successively call ft_prepare_vol_sens, ft_prepare_leadfield and ft_sourceanalysis." That is, ft_prepare_headmodel (not the same as prepare_headmodel!) is not part of the problem.


Jan-Mathijs Schoffelen - 2018-12-30 18:14:51 +0100

Sorry for not catching up on this, but would the following address the issue? https://github.com/fieldtrip/fieldtrip/pull/517 If so, I think that this can be closed, right?


Jan-Mathijs Schoffelen - 2019-01-08 12:35:35 +0100

Closing for now. Feel free to reopen