[FieldTrip] Error reading fif file during ft_read_headshape

Alba Xifra Porxas, Ms alba.xifraporxas at mail.mcgill.ca
Mon Jan 30 22:53:38 CET 2017

Dear FieldTrippers,

My name is Alba Xifra Porxas and I am working in the Biosignals and Systems Analysis Lab at McGill University. Currently I am analyzing MEG data from a motor-task paradigm from young and elderly subjects. I am following the tutorial: Source reconstruction of event-related fields using minimum-norm estimate (http://fieldtrip.fcdonders.nl/tutorial/minimumnormestimate).

I am having problems reading the downsampled mesh from MNE suite. When I call FT_READ_HEADSHAPE, I receive the following error message:

>> sourcespace = ft_read_headshape('s003-oct-6-src.fif', 'format', 'mne_source');

Error using fiff_read_tag (line 178)

Only two and three dimensional matrices are supported at this time

Error in mne_read_source_spaces/read_source_space/find_tag (line 288)

                    tag = fiff_read_tag(fid,node.dir(p).pos);

Error in mne_read_source_spaces/read_source_space (line 254)

        tag2 = find_tag(this,FIFF.FIFF_MNE_SOURCE_SPACE_NEAREST_DIST);

Error in mne_read_source_spaces (line 111)

    this = read_source_space(spaces(k));

Error in ft_read_headshape (line 391)

    src = mne_read_source_spaces(filename, 1);

However, I can visualize it correctly in MNE. The command I used to create the source space is:  mne_setup_source_space --ico -6.

Since I have the meshes from FreeSurfer, I tried a workaround. I call FT_READ_HEADSHAPE using lh.orig and rh.orig, which works. I successfully coregister the source space with the sensor-space and compute source reconstruction using minimum-norm estimation. However, when I try to downsample the output of FT_SOURCEANALYSIS calling FT_VOLUMEDOWNSAMPLE before parcellation, I receive the following error:

Reference to non-existent field 'dim'.

Error in ft_volumedownsample (line 100)

xsel = 1:cfg.downsample:source.dim(1);

Even if I manually introduce this missing field 'dim', it seems the number of vertices is too big:

>> source.dim(1) = length(source.pos);source.dim(2) = length(source.pos);source.dim(3) = length(source.pos);

>> cfg = [];cfg.downsample = 4;source_down = ft_volumedownsample(cfg,source);

Error using repmat

Maximum variable size allowed by the program is exceeded.

Error in ndgrid (line 73)

        varargout{i} = repmat(x,s);

Error in pos2transform (line 25)

[X,Y,Z] = ndgrid(x, y, z);

Error in ft_checkdata>source2volume (line 1286)

  data.transform = pos2transform(data.pos, data.dim);

Error in ft_checkdata (line 350)

      data = source2volume(data);

Error in ft_volumedownsample (line 69)

source = ft_checkdata(source, 'datatype', 'volume', 'feedback', 'no');

The source I use is as follows:

>> display(source)

source =

      time: [1x3900 double]

    inside: [255462x1 logical]

       pos: [255462x3 double]

    method: 'average'

       avg: [1x1 struct]

       cfg: [1x1 struct]

       dim: [255462 255462 255462]

Therefore, I am back to where I started. I need to read the fif file from MNE suite.

I uploaded my fif file in Dropbox. Here is the link: https://www.dropbox.com/sh/uq181l76353hd8q/AACjTu8KI_rGaXlaDMyw-Diba?dl=0

Could someone tell me if there is something wrong with the file or with my workaround? Any help would be really appreciated. I am using Fieldtrip version 20170118.

Alba Xifra Porxas
PhD student, Biosignals and Systems Analysis Lab
McGill University, Montréal, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170130/6816e71f/attachment-0001.html>

More information about the fieldtrip mailing list