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

Vladimir Litvak litvak.vladimir at gmail.com
Thu Nov 17 11:05:15 CET 2016


Hi Simon,

Then it might be something else. As I said, I checked yesterday in the
latest SPM and it looks OK but there might be some code differences. We
don't update our bemcp version every time we update the core FT. The
approach Robert used and he might still have the script for it is to make a
mesh for a single sphere and compare the bemcp solution for it with the
analytical one.

Vladimir

On Thu, Nov 17, 2016 at 9:34 AM, Simon Van Eyndhoven <
Simon.VanEyndhoven at esat.kuleuven.be> wrote:

> Hello Vladimir,
>
> Thank you for the swift response. I made sure to place the source at
> varying distances from the skull, to preclude any effect because of this.
> More precisely, I tried the following approach:
>
> --
> elec = ft_read_sens('standard_1020.elc')
> chan_name = 'F8';
> chan_index = find(strcmp(elec.label,chan_name));
> chan_pos = elec.elecpos(chan_index,:);
>
> [...]
>
>
> cfg.dip.pos = 0.3*chan_pos;   % I tried distances ranging from
> 0.3*chan_pos to 0.9*chan_pos
> --
>
> For any distance from the skull the model yielded a nonsensical output as
> described earlier. This leads me to believe that this distance is not the
> determining factor here...
>
> Best regards,
>
> --
> Simon Van Eyndhoven
>
> PhD researcher
> Stadius Center for Dynamical Systems, Signal Processing and Data Analytics
> KU Leuven, Dept. Electrical Engineering (ESAT)
>
> email: simon.vaneyndhoven at esat.kuleuven.be
>
> On 2016-11-16 16:14, Vladimir Litvak wrote:
>
> Dear Simon,
>
> I tested this before and now re-tested again using the versions of FT and
> BEMCP which come with SPM and should be quite recent. For SPM cortical mesh
> where we take special measures to make sure that it's far enough from the
> boundary the correlation coefficients between BEMCP and 3-spheres model are
> all above 0.9.  You say you varied the depth but have you varied it enough?
> What 'enough' is depends on the density of your head meshes. For SPM meshes
> it was more than 6mm from the boundary. The difference between different
> BEM methods is how close you can get to the boundary without breaking.
> BEMCP is the simplest method which is not very good in this respect. dipoli
> or OpenMEEG will also break but closer to the surface.
>
> Best,
>
> Vladimir
>
> On Wed, Nov 16, 2016 at 1:07 PM, Simon Van Eyndhoven <
> Simon.VanEyndhoven at esat.kuleuven.be> wrote:
>
>> 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
>> /tmp/tp39371164882184732_2.tri"
>>
>> 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 causes:
>> - 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
>> problem...
>> - 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 Analytics
>> KU Leuven, Dept. Electrical Engineering (ESAT)
>>
>> email: simon.vaneyndhoven at esat.kuleuven.be
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161117/37cf81f5/attachment-0002.html>


More information about the fieldtrip mailing list