problems while calculating leadfield

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Dec 15 13:39:22 CET 2008

Hi Nathan

Each MEG channel consists of two coils, one with a weight of +1 and
the other with a weight of -1. For a synthetic 3rd order gradiometer
system, also the reference coils are weighted and part of the signal
picked up at the reference channels is subtracted from the normal MEG
channels. That means that the reference coils also get a weight in the
output of a MEG channel.

For setting up the volume conduction model in case of a multi-sphere
model, for each _coil_ the corresponding sphere has to be determined.
For the bottom and top coil (with the +1 and -1 weight) the two
spheres are the same and correspond to the sphere fitted to the scalp
under that channel. In case of the 3rd order synthetic gradiometer
data, the reference coils also have a (small) weight, which means that
also for those coils a "local" sphere has to be identified. At the
moment assigning local spheres to the reference coils is not yet
supported in the code.

Probably the best would be to use the local spheres for the 2 meg
coils and to use a single sphere that is fitted to the complete
headshape (i.e. the "single sphere") for the reference coils. It
requires some work though to get the bookkeeping of all coils and all
spheres correct.

A better solution (and the one we use here at the FCDC) might be to
use prepare_singleshell instead of prepare_localspheres. The
singleshell volume conduction model also approximates the geometry
with a realistic shape, but is better for the lower part of the brain.
In short, there are no disadvantages(*) in the singleshell model
compared to the localspheres model, but only advantages.

best regards,

*) expect perhaps that it is computationally slightly slower, and that
the localspheres can also be constructed with a polhemus measured head
surface, whereas the singleshell requires a segmented anatomical MRI.

On 13 Dec 2008, at 18:15, Nathan Weisz wrote:

> i have a problem while performing prepare_leadfield.
> the data is some old CTF data i collected ~2 years ago. i calculated
> a multisphere model in fieldtrip using prepare_localspheres. this
> step works (i.e. i get a vol structure that looks ok in my opinion).
> however when continuing with prepare_leadfield the the program
> crashes.
> here's the code:
> cfg=[];
> cfg.grid.xgrid='auto';
> cfg.grid.ygrid='auto';
> cfg.grid.zgrid='auto';
> cfg.vol=vol;
> cfg.grad=dataCLeConI.grad;
> cfg.inwardshift=0;
> cfg.grid.resolution=1;
> cfg.reducerank=2;
> lf=prepare_leadfield(cfg);
> i get this error message:
> ??? Error using ==> prepare_headmodel at 301
> synthetic gradients not supported during volume conductor setup
> Error in ==> prepare_leadfield at 223
> [vol, sens, cfg] = prepare_headmodel(cfg, data);
> Error in ==> newcat_calcgrid at 52
> lf=prepare_leadfield(cfg);
> i messed around with different headmodels just to see how
> prepare_leadfield behaves:
> *when the headmodel is a single sphere (cfg.singlesphere='yes')
> prepare_leadfield works fine
> *when using the nolte headmodel (via prepare_singleshell),
> prepare_leadfield does not crash, but the leadfields contain only
> NaN ... is that perhaps related to the issue above?
> again, any help is greatly appreciated.

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list