Specifying the channel layout for plotting

Introduction to layout files (*.lay files)

FieldTrip can use layout files that gives you exact control of the 2-D position of the sensors for topoplotting, and of the per-channel local coordinate axes for the multiplotting. These layout files are ascii file with the extention *.lay, or MATLAB files containing a variable with the name “lay”. In general, FieldTrip prefers .mat-files because of more flexible outlines of the headshape. For .lay files a standard headshape is drawn around the normalized channel positions. Here is a small snippet of an ascii layout file:

Standard layout files included in FieldTrip

The standard layout files included in FieldTrip are based on the sensor specifications as obtained from the manufacturer website or manual. If an image of the sensor positions is available on the manufacturer website, a copy of it is located in the fieldtrip/template/layout directory. For standard layout files that are included in FieldTrip, please check the corresponding getting started section corresponding of your system.

Using the ft_prepare_layout function to make a layout

The ft_prepare_layout function can be used to make a custom layout. This can be especially convenient if you have a nice bitmap image for the channel arrangement, like this

You can specify cfg.image in ft_prepare_layout and subsequently click on the location of each electrode. After specifying each electrode location, you'll be asked to specify the outlines of the head (i.e. the circle around the head, the nose and ears and optionally some lines representing other important landmarks) and to specify the mask for the topographic interpolation.

cfg = [];
cfg.image = 'dalal_ecog.png';
lay = ft_prepare_layout(cfg);

After creating the layout, you should manually assign the correct name of the channel labels in the lay.label cell-array. Furthermore, you probably should place the SCALE and COMNT locations at a convenient place in the figure and modify the width and height of the boxes used for multiplotting. You can use ft_layoutplot for a visual inspection of the complete layout

cfg = [];
cfg.layout = lay; % this is the layout structure that you created with ft_prepare_layout
ft_layoutplot(cfg);

or including the original image as black-and-white background like this

cfg = [];
cfg.image = 'dalal_ecog.png'; % use the photo as background
cfg.layout = lay; % this is the layout structure that you created with ft_prepare_layout
ft_layoutplot(cfg);

Once you are happy with the result, you can save it to a MATLAB file:

save dalal_ecog.mat lay % save the layout in the variable "lay" to a MATLAB file

The MATLAB file can subsequently be specified as cfg.layout='dalal_ecog.mat' whenever you need a layout for plotting. Alternatively, you can specify the layout like cfg.layout=lay.

The advantage of the MATLAB file over the ascii file, is that the MATLAB file can also contain a user-specified outline of the head and user-specified mask, whereas for the ascii layout file always the same circle with nose and ears will be used.

Functions that require a layout configuration

Layouts are an essential element in FieldTrip, and many FieldTrip functions rely that the user specifies a layout in his configuration (cfg.layout). See below for an overview of such functions: