[FieldTrip] Unable to reproduce BEM headmodel - possible bug in bemcp

Simon Van Eyndhoven Simon.VanEyndhoven at esat.kuleuven.be
Wed Nov 16 14:07:22 CET 2016

Dear all,

I recently started using FieldTrip in order to simulate pseudo-realistic 
EEG recordings from e.g. a set of dipoles located in the brain.
Therefore, I tried to follow the tutorial on the construction of a BEM 
head model based on an anatomical MRI scan and an electrode set: 
http://www.fieldtriptoolbox.org/tutorial/headmodel_eeg_bem .

The problem is that I don't succeed to reproduce the head model that is 
distributed as a template in the FieldTrip toolbox: 
'/template/headmodel/standard_bem.mat'. I start from the template MRI 
scan in FieldTrip ('standard_mri.mat') and use the following code (taken 
from the tutorial).

% Load MRI data and electrode setup
mri = importdata('standard_mri.mat');
elec = ft_read_sens('standard_1020.elc')

% Segment the MRI volume
cfg = [];
cfg.output = {'brain','skull','scalp'};
segmentedmri  = ft_volumesegment(cfg, mri);

% Create a mesh
cfg = [];
cfg.tissue = {'brain','skull','scalp'};
cfg.numvertices = [1500 1000 500];
bnd = ft_prepare_mesh(cfg,segmentedmri);

% Construct the headmodel
cfg = [];
cfg.conductivity = [0.3300 0.0041 0.3300];
cfg.method = 'dipoli';
vol = ft_prepare_headmodel(cfg, bnd);

The following error is thrown:

"Fatal error in dipoli: during computation of B-matrix;
  vertex 916 of /tmp/tp39371164882184732_1.tri touches triangle 811 of 

I've tried to create meshes with different numbers of vertices (e.g. the 
combination from the website tutorial 'numvertices = [3000 2000 1000]' 
produces the same error): for some combinations this problem does not 
occur, luckily. However, I wonder how the template model (that used the 
aforementioned number of vertices) got created successfully; I want to 
make sure that I work in the correct way and don't forget something.

Can anyone shed some light on this issue, or hint what might be 
wrong/missing in the implementation above, compared to the template 
results that are provided in the FieldTrip distribution?

Moreover, I've tried to create the head model using the 'bemcp' method 
as well. As a test, I placed a dipole close to the scalp surface, near a 
particular electrode. It is hence expected that the recorded amplitudes 
are highest for electrodes in the vicinity of this electrode. This 
effect is correctly reproduced when performing the computation of the 
forward problem using the 'standard_bem.mat' head model mentioned above 
(using the 'dipoli' method). By contrast, the output of the forward 
problem using the bemcp-based head model shows a topographic 
distribution with many positive 'peaks' and negative 'troughs', spread 
kind of randomly over the scalp surface. Since neither the segmentation 
step nor meshing step changed (only the final step, namely the creation 
of the volume conduction model), I have no clue why this problem occurs. 
I've looked around in the discussion list's archives for possible 
- it is reported that the bemcp method does not behave well if the 
dipole is located (very) close to the skull: I ruled this out for my 
problem by varying this distance
- one user (Debora Desideri) reported a problem with the bemcp-method 
that appears to be very similar to mine, but there was no reply to her 
- another user (John Richards) calls for caution when using the 
bemcp-method, stating that it behaves poorly sometimes

Has anyone experienced similar issues when using the 'becmp' method and 
maybe found an explanation for this?

Thanks in advance for any help!

Best regards,

Simon Van Eyndhoven

PhD researcher
Stadius Center for Dynamical Systems, Signal Processing and Data 
KU Leuven, Dept. Electrical Engineering (ESAT)

email: simon.vaneyndhoven at esat.kuleuven.be

More information about the fieldtrip mailing list