Help with dipole-fitting simultaneous MEG/EEG data

David Kim todavidkim at GMAIL.COM
Fri Apr 10 22:59:08 CEST 2009

Dear Fieldtrip users,

I have been working on solving dipole-fitting problem of a simultaneous
MEG/EEG data with Fieldtrip.

The MEG and EEG sensor definitions (275, 64) is generated to conform
to Fieldtrip standard.
A 4 shell volume conduction model for EEG and 1 shell model for MEG
have been generated to conform to Fieldtrip standard.

Given the stimulus, I'm assuming that a single dipole drives the
signal in both EEG and MEG. Therefore, I would like to use Fieldtrip
to find a dipole that best describes the simultaneously acquired
MEG/EEG data in the following sense:

A single dipole fit with 9 characteristic values consisting of:
dipole position. 3 values, (x,y,z)
dipole moment (given the dipole position) that best fits MEG data. 3
dipole moment (given the dipole position) that best fits EEG data. 3

Currently, Fieldtrip has compute_leadfield.m function which can take a
cell of multiple volume and sensor definitions as described in line 22 and 23 of
the code.
%   sens = {senseeg, sensmeg}
%   vol  = {voleeg, volmeg}

With compute_leadfield.m, I can perform the dipole-fitting, but this
requires custom scripts outside of Fieldtrip which can get messy and
vary from data to data. I would much rather have the process be done
within the Fieldtrip environment where the process is more robust and
It would be ideal to have the data pass through to dipfit_error()
subroutine defined in dipole_fit.m function, where the modifications
to dipfit_error() definition would determine the outcome of the fit.

It appears to me, however, both dipolefitting.m and dipole_fit.m are
not made to process multiple sensor definitions. For example, line 166
of dipole_fit.m reads, "error('simultaneous EEG and MEG not

Is simultaneous EEG/MEG processing of data already implemented in
Fieldtrip that I'm not aware of? If not what steps could we take to
implement such a feature?

Thank you.

David Kim

UCSF/UC Berkeley Bioengineering Graduate Group
todavidkim at
(510) 643-7571

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