[FieldTrip] Generating EEG & Source model function

Andreja Kostić andrejakosticln at gmail.com
Mon Aug 1 15:41:17 CEST 2016


Hello Pouneh Baniasad,

I had a similar issue some time ago, and found my solution within
Fieldtrip, so I might be able to offer a bit of advice.

There is a function for in Fieldtrip that will (partially) allow you to
simulate dipoles. It's called ft_dipolesimulation.m.

Unfortunately, in its current state, it only allows you to simulate 1
dipole. It does have quite a bit potential, however, since the function
seems to be originally intended to work with multiple dipoles, but in its
current implementation, it will not actually cycle through multiple dipoles
and will crash if you give it more than 1.

The function will allow you to set frequency, phase, amplitude, sample
rate, orientation vector etc. for the dipoles but I didn't test how that
works for more than one dipole, since I used externally generated data as
my dipole waveforms.

With only a couple of extra lines of code (basically just 1 extra for loop
around the part that does lead-field calculation), it can be edited to go
through a matrix of dipole coordinates and orientations. I'm currently on
vacation, so it might take some time for me to dig up modifications I did
for it to go through multiple dipoles, but it it took me maybe 10 minutes
to fix in total, so it's really easy.

I think that the coordinates that you need to give for each dipole are
voxel positions from the MRI.

There's also a bug near the end of the function, at the place where
ft_senstype is called. It will set to MEG in both cases, so that needs
fixing as well.


Later on, when you get the EEG, you can plot it like this, for example:

%View the EEG
cfg=[];
cfg.viewmode='vertical';
ft_databrowser(cfg,data_from_ft_dipolesimulation);


All the best,
Andreja Kostić



2016-08-01 10:17 GMT+02:00 pooneh baniasad <pooneh.baniasad at gmail.com>:

> Dear FieldTrip community,
>> ​I'm trying to generate EEG signal without using raw datas.
> I used the 'Subject01.mri' as my anatomical model, the BEM method for
> preparing a headmodel and 'standard_1020.elc' for aligning electrodes.
> For a source model I loaded template grid (cortex_20484.surf.gii).
> Now my questions are how can I set dipole's location (in other words, my
> grid's resolution)?
> How can I allocate a source model (sin, cos, ...) to each dipole? Is there
> any function in Fieldtrip doing that? or I have to writing the code by
> myself.
> After having the source model for each dipole and calculating leadfield
> matrix what should I do for plotting the EEG signal?
>
>
> --
> Bests
>
> Pouneh Baniasad
>
> _______________________________________________
> 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/20160801/da0617da/attachment.html>


More information about the fieldtrip mailing list