[Eeglablist] MEG: EEGlab to Fieldtrip problem
Bar Lehmann
bl710 at georgetown.edu
Fri Sep 6 11:21:06 PDT 2024
Hoping someone can help:
I have Neuromag gradiometer-only MEG .fif files that can easily be imported
into either EEGLab or Fieldtrip, however, if I save an .fif file as a .set
file and then try to open it in Fieldtrip (using all the recommended
EEGLab2Fieldtrip methods
<https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/getting_started/eeglab/__;!!Mih3wA!D2b26IZzqDUjxgj2HMpWIatz3gQehvByFtzQwyQEUpF_fnBsLnrRoMkU4SqkLxTVzYea7Velr04ZWloKD2fcSXgToA$ >), it generates
an error (copied below). The more I have looked into this issue, it appears
that while the XYZ cartesian coordinates have been brought into EEGlab, the
coil-positions, coil-orientations, and other gradiometer fields including
'tra' (which is a matrix of the weight of each of the two coils per
gradiometer, onto each channel) are missing (or at least I cannot find them
in the EEGlab .set or EEG struct file). Obviously, I cannot use
ft_read_header since this generates the same errors when used on the .set
file.
To more clearly understand the problem: I use ft_read_header on the
original .fif file and extract the "hdr.grad" arrays into "ft_data" which
resolves the errors when I try to run ft_preprocessing:
EEG = pop_loadset(filename2);
hdr = ft_read_header(filename1);
ft_data = eeglab2fieldtrip(EEG, 'raw');
ft_data.elec = hdr.grad;
cfg = [];
ft_data2 = ft_preprocessing(cfg, ft_data)
However, while this seems resolved, I will need to run "ft_definetrial"
right afterward of the above preprocessing and this requires specifying the
.set file (which has already undergone certain processing steps that I can
only do in EEGlab), and then the same error is automatically generated
without allowing me to copy over the aforementioned fields within 'hdr.grad'
It seems that one solution is to find where exactly to correctly copy the
hdr.grad fields into the right spot within the EEGlab .set file. I have
tried copying it into the EEG struct without resolution, and since they are
of different sizes, I do not think it would make sense to copy them
directly into EEG.chanlocs. Perhaps there are also other more simple
solutions to this issue.
Thanks very much in advance for any assistance you can provide,
Bar L.
Unrecognized field name "tra".
Error in channelposition (line 287)
meanpnt = [meanpnt;
mean(sens.coilpos(abs(sens.tra(sel1(j),:))>0.5,:), 1)];
Error in ft_datatype_sens (line 471)
[chanpos, chanori, lab] = channelposition(sens);
Error in ft_datatype_sens (line 262)
sens = ft_datatype_sens(sens, new_argin{:});
Error in ft_datatype_sens (line 229)
sens = ft_datatype_sens(sens, new_argin{:});
Error in ft_datatype_sens (line 180)
sens = ft_datatype_sens(sens, new_argin{:});
Error in ft_read_header (line 2852)
hdr.elec = ft_datatype_sens(hdr.elec);
Error in ft_read_sens (line 330)
hdr = ft_read_header(filename, 'coordsys', coordsys, 'coilaccuracy',
coilaccuracy, 'coildeffile', coildeffile);
More information about the eeglablist
mailing list