[FieldTrip] manually adding channel info and reference

Julian Keil julian.keil at gmail.com
Mon Jun 7 11:15:42 CEST 2021

Hi Roy,

without going into details, and from the top of my head some thoughts:

@1: Why do you need the other channel types in the topo? Would it make more sense to plot them separately? In that case, you can use a selection with cfg.channel for the desired channels in the plot function (or any other function).

@2: I guess there aren’t any restrictions. There are some conventions for the MEG gradiometers and magenetometers (see e.g. here: https://www.fieldtriptoolbox.org/reference/ft_chantype/ <https://www.fieldtriptoolbox.org/reference/ft_chantype/>).

@3: As before, I think you can specify the reference channel array. For example, if you want to re-reference channels 1:256 to the average reference, you could set cfg.refchannel = 1:256 in ft_preprocessing. Although in that case all channels will be referenced to the average of 1:256. For more refined referencing choices, ft_apply_montage might be more appropriate: https://www.fieldtriptoolbox.org/reference/ft_apply_montage/ <https://www.fieldtriptoolbox.org/reference/ft_apply_montage/> , or keeping the two datasets apart until the referencing is done might be easier.



> Am 01.06.2021 um 13:47 schrieb Roy Cox via fieldtrip <fieldtrip at science.ru.nl>:
> hello,
> I'm having some trouble specifying several kinds of EEG recording details/metadata required for further processing. From looking at tutorials, functions, and the mailing list, it appears that Fieldtrip usually determines these things cleverly from the input data, but in my case this information needs to be manually added.
> My data are 8-h continuous 265-channel signals in Brainvision format (256 "active" EEG channels, the implicit EEG reference [Cz, flatline], and 8 bipolar physiological signals). Data were originally recorded in EGI's mff format, but have since been downsampled and converted to Brainvision (no doubt resulting in some loss of metadata).
> After reading data into Fieldtrip, I'm left with this bare-bones structure:
> data_ft =
>   struct with fields:
>     fsample: 250
>       trial: {[265×7671535 single]}
>        time: {[1×7671535 double]}
>       label: {1×265 cell}
>         cfg: [1×1 struct]
> Basically the data and channel labels (as present in the Brainvision file), nothing more.
> I get my EEG electrode coordinates from reading the header of one of the original mffs:
> hdr_mff = ft_read_header(mff_file)
> elec_eeg=hdr_mff.elec
> elec_eeg =
>   struct with fields:
>      chanpos: [257×3 double]
>     chantype: {257×1 cell}
>     chanunit: {257×1 cell}
>      elecpos: [257×3 double]
>        label: {257×1 cell}
>         type: 'egi256'
>         unit: 'cm'
> So this reflects the 256+1 EEG electrodes, but not the physiological signals (presumably because the mff file doesn't - and couldn't - hold this information). I can turn these EEG coordinates into an EEG layout that looks accurate (and very similar to the EGI template layout provided in Fieldtrip):
> cfg = [];
> cfg.elec = elec_eeg;
> mff_layout = ft_prepare_layout(cfg);
> figure
> ft_plot_layout(mff_layout);
> So far so good.
> Q1: how do I add (mock) location information for the bipolar phys signals? I imagine I'll run into trouble if channel/electrode counts don't match between ft_data and elec_eeg. It would also be nice to be able to create a layout that includes the phys signals (which means they should be present in the elec_eeg struct). Do I manually expand the elec_eeg fields from 257 to 265? Suggestions for mock values that work well with ft_prepare_layout?
> Q2: how/where do I specify that the 8 phys channels are not EEG? Can elec_eeg.chantype be set to "non-eeg" or even more specific types (e.g., we have ecg, emg, etc..)? I can't find an overview of allowed channel types. And is it only the elec_eeg structure that needs this info, or do I need to specify it elsewhere too? (Ultimately, I'd like to be able to use ft_selectdata to select specific channel types etc.)
> Q3: how/where do I indicate that the first 256 channels are referenced to channel 257 (Cz, which is flatline), and that channels 258-265 are bipolar channels, such that later re-referencing works as intended? (I know having the EEG refence channel explicitly in the data is uncommon, so perhaps it needs to be deleted?)
> Thanks for any input!
> Best,
> Roy
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210607/8bdc9668/attachment.htm>

More information about the fieldtrip mailing list