[FieldTrip] Layout rotated by 90 deg

Zito Giuseppe Angelo giuseppeangelo.zito at hest.ethz.ch
Fri Aug 19 08:39:17 CEST 2022


Hi Jan-Mathijs,

Thank you for your kind reply.
I could not actually figure it out myself, but I forced the template to rotate by modifying elec.chanpos.
Here is the code I used, and I also attach the files from one subject:

fileName = [folderPath participants{i} '\' participants{i} '_' conditions{j} '.set'];

cfg = [];
cfg.dataset = fileName;
% Load the data from EEGlab to FieldTrip
data{i,j} = ft_preprocessing(cfg);

% Set parameters
cfg.method      = 'mtmfft';
cfg.output      = 'pow';
cfg.channel     = 'all';
cfg.trials      = 'all';
cfg.keeptrials  = 'yes';     % no=compute the average power across the trials, otherwise 'yes'
cfg.pad         = 'nextpow2';
cfg.taper       = 'dpss';
cfg.tapsmofrq   = 2;
cfg.foi         = 4:35; % frequency band of interest with stepsize

% Extract the frequencies
freq{i,j} = ft_freqanalysis(cfg, data{i,j});

% Invert X and Y electrode position due to a mismatch between fieldtrip and EEGlab
newCoordinates = [2 1 3];
freq{i,j}.elec.chanpos = freq{i,j}.elec.chanpos(:,newCoordinates);
freq{i,j}.elec.chanpos(:,1) = -freq{i,j}.elec.chanpos(:,1);
freq{i,j}.elec.elecpos = freq{i,j}.elec.elecpos(:,newCoordinates);
freq{i,j}.elec.elecpos(:,1) = -freq{i,j}.elec.elecpos(:,1);

If you know a more elegant way to make it work, I would be happy to use it.

Thank you once again for the help,
Giuseppe

________________________________
Dr. Giuseppe Angelo Zito
Principal Investigator, Swiss National Science Foundation

Decision Neuroscience Lab
Department of Health Sciences and Technology (D-HEST)
ETH – Swiss Federal Institute of Technology Zurich

Winterthurerstrasse 190
8057 Zürich
Switzerland

Tel: +41 44 633 05 17
mailto: giuseppeangelo.zito at hest.ethz.ch


From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Schoffelen, J.M. (Jan Mathijs) via fieldtrip
Sent: 15 August 2022 08:55
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Layout rotated by 90 deg

Hi Giuseppe,

At first sight it looks as if something is not going right with the specified rotation of the electrode positions. Have you tried to set a breakpoint in the code and go through it step by step to see what is happening in detail? This should give you some more clues about what is not going entirely right. It’s hard from a distance to diagnose this.

If you have difficulties in diagnosing it yourself, you may want to share some relevant data with us (at minimum your data.elec) so that an adventurous colleague - who is reading along - can have a go at it.

Best wishes,
Jan-Mathijs




On 9 Aug 2022, at 18:51, Zito Giuseppe Angelo via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear Fieldtrip experts,

I have a problem with the EEG layout, which appears to be rotated by 90 degrees.

I import data from EEGlab (power spectra), and run the stats in fieldtrip (ft_freqstatistics).
I have my own layout with 118 electrodes, which I created with ft_prepare_layout.

While calling ft_clusterplot or ft_topoplotER, Matlab sends the following warning:

the input is freq data with 118 channels, 4 frequencybins and no timebins
creating layout from data.elec
creating layout for ext1020 system
Warning: use cfg.rotate to specify the correct rotation of the sensors
 In ft_prepare_layout>sens2lay at line 1300
In ft_prepare_layout at line 596
In ft_clusterplot at line 123

The resulting topoplot is indeed tilted (see picture attached).

I tried to add cfg.rotate = -90 and run again ft_prepare_layout, but the problem was unsolved.

Could you please help to solve this issue?
In case I have to modify the layout with ft_prepare_layout,could you please give me a sample code to fix that?

Thank you very much,
Giuseppe Zito

________________________________
Dr. Giuseppe Angelo Zito
Principal Investigator, Swiss National Science Foundation

Decision Neuroscience Lab
Department of Health Sciences and Technology (D-HEST)
ETH – Swiss Federal Institute of Technology Zurich

Winterthurerstrasse 190
8057 Zürich
Switzerland

Tel: +41 44 633 05 17
mailto: giuseppeangelo.zito at hest.ethz.ch<mailto:giuseppeangelo.zito at hest.ethz.ch>


<Untitled.png>_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_Yw6qS8Z5niJVPKpRGNnGlL7pmqC9sbtd8zsEvVYoivZqCt0pPdamcl6IWl_kpYELPkMcqTeMrU8sw6NzkN140T2g1iK5gvA0jr9mQ$<https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_Yw6qS8Z5niJVPKpRGNnGlL7pmqC9sbtd8zsEvVYoivZqCt0pPdamcl6IWl_kpYELPkMcqTeMrU8sw6NzkN140T2g1iK5gvA0jr9mQ$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220819/4cb873ee/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExampleEEG.zip
Type: application/x-zip-compressed
Size: 237658 bytes
Desc: ExampleEEG.zip
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220819/4cb873ee/attachment-0001.bin>


More information about the fieldtrip mailing list