[FieldTrip] How to adapt a layout file: thanks for the solution

Sprenger, S.A. s.a.sprenger at rug.nl
Thu Jul 6 10:11:05 CEST 2017


Dear Jan-Mathijs,

Thank you very much for your response with respect to the adaption of
layout files. The solution that you suggested works fine and our issue has
been solved. In case someone would like to review the question and
response, please see below.

Kind regards,
  Simone

____________



Message: 9
Date: Wed, 5 Jul 2017 06:51:13 +0000
From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl>
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: [FieldTrip] Fwd:  How to adapt a layout file
Message-ID: <2D579D2D-F542-4FC2-A1A8-C0FCED73CC51 at donders.ru.nl>
Content-Type: text/plain; charset="utf-8"

Hi Simone,

What is the question behind the question?

The reason I ask this is because overcomplete layout files (i.e. files
containing more channels than you need) don?t prevent you from visualizing
your own data.

If you anyhow want to manually remove channels (and the corresponding
information in pos/height etc) your code is not foolproof, most likely
because setdiff may inadvertently alphabetize the labels, causing the
mismatch you report.

you could do:

remove = {?};
sel = ismember(lay.label, remove);

lay.pos = lay.pos(~sel,:);
lay.height = lay.height(~sel);

etc.

Best,
Jan-Mathijs



On 04 Jul 2017, at 16:56, Sprenger, S.A. <s.a.sprenger at rug.nl<mailto:s.
a.sprenger at rug.nl>> wrote:

Dear colleagues,

I was wondering whether someone could give us some advice on how to adapt
an existing layout file.

We would like to adapt easycapM1.mat, as our own layout is highly similar.
Specifically, we would like to remove F1, F2, FT7, FT8, TP7, TP8, CP1 and
CP2. In addition, we would like to add the mastoids (for ICA plotting
purposes).

We tried the following:

% removing F1, F2, FT7, FT8, TP7, TP8, CP1, CP2:
load('/Volumes/DATA/Applications/fieldtrip-20170425/template/layout/
easycapM1.mat');

% this plots the layout with electrodes on the correct positions:
cfg = [];
cfg.layout = lay;
ft_layoutplot(cfg);

for i = {'F1', 'F2', 'FT7', 'FT8', 'TP7', 'TP8', 'CP1', 'CP2'}
    [truefalse, index] = ismember(i, lay.label);
    if truefalse == 1
        lay.label = setdiff(lay.label, lay.label{index});
        lay.width = lay.width([1:(index-1), (index+1):end]);
        lay.height = lay.height([1:(index-1), (index+1):end]);
        lay.pos = lay.pos([1:(index-1), (index+1):end],:);
    end
end

% now suddenly many electrodes are plotted on wrong locations,
% but we just wanted to remove some electrodes:
cfg = [];
cfg.layout = lay;
ft_layoutplot(cfg);

Comments and suggestions will be much appreciated.

Kind regards,
  Simone

_____________________________________________
Dr. S.A. Sprenger
University of Groningen
Faculty of Arts
Center for Language and Cognition

Visiting address:
Oude Kijk in 't Jatstraat 26
Room 1315.420
9712 EK Groningen

Working hours: mo-thur
 050 363 9619
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170706/edbeee5a/attachment-0001.html>


More information about the fieldtrip mailing list