[FieldTrip] EEG connectivity analysis - error with ft_sourceparcellate in whole brain connectivity tutorial

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Sep 16 09:19:50 CEST 2020


Hi Rebecca,

Just some pointers below. One cannot ‘just’ interpolate one object to another one without considering (and validating) whether,

1) the coordinate system in which the objects are expressed are the same
2) the objects’ coordinates are expressed in the same metric units (although FT usually tries to check this, and fix it, if possible)
3) both objects are of a similar ’nature’, i.e. both defined as a 3D volume, or as a point cloud, or as a mesh. (although FT can toggle back and forth, it’s often not desirable)
4) the atlas you aim to use is appropriate for your data (particularly in light of point 3).

Furthermore, the error you paste is pretty low level and not informative without any additional context. The only thing that I can derive from it, is that the variable ’ sel’ is most likely empty (i.e. contains 0 elements, which causes the error. What ’sel’ means in this context, and why it is empty in your case is can not be derived. Additional detective work is best done with you, by using the matlab debugger, which allows you to step through the code line-by-line to investigate the variables in the function’s workspace.

Good luck,

Jan-Mathijs





On 16 Sep 2020, at 01:08, Rebecca Kenny <beckenny at student.ubc.ca<mailto:beckenny at student.ubc.ca>> wrote:

Hello Michael,

Thank you for your quick response! It seems I am still getting errors.

Index exceeds the number of array elements (0).

Error in ft_sourceinterpolate>my_interpn (line 726)
  ft_progress(sel(1)/num, 'interpolating %.1f%%\n', 100*sel(1)/num);

Error in ft_sourceinterpolate (line 631)
            av( sel) = my_interpn(fv, ax(sel), ay(sel), az(sel), cfg.interpmethod, cfg.feedback);

There should not be anything wrong with my data and I have followed the tutorial to a T. I am not sure what I am missing. I appreciate the help.

Rebecca

On Tue, Sep 15, 2020 at 3:36 PM Michael Glassen - Biomedical Engineer <MGlassen at kesslerfoundation.org<mailto:MGlassen at kesslerfoundation.org>> wrote:
Hi Rebecca,

I have run into similar issues, I may be wrong but I believe interpolating the atlas onto your source model will solve this issue. I grabbed some code from one of the tutorials and pasted below, try it out and see if it fixes your error, replacing the atlas and sourcemodel variables with whatever you’ve named them in your script.

Best,
Michael Glassen

%%
cfg = [];
cfg.interpmethod = 'nearest';
cfg.parameter = 'tissue';
newAtlas = ft_sourceinterpolate(cfg, atlas, sourcemodel);

________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of Rebecca Kenny <beckenny at student.ubc.ca<mailto:beckenny at student.ubc.ca>>
Sent: Tuesday, September 15, 2020 5:54:12 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] EEG connectivity analysis - error with ft_sourceparcellate in whole brain connectivity tutorial

Hello Jan-Mathijs,

Thank you very much for your reply! It seems to have worked and I am really appreciative.  I now have a new error that maybe you can help with.  Would this be because of the atlas I chose?

cfg = [];
    cfg.parcellation = 'tissue';
    cfg.parameter    = 'cohspctrm';
    parc_conn = ft_sourceparcellate(cfg, source_conn, atlas);

there are in total 4050 positions, 2015 positions are inside the brain, 701027 positions have a label
0 of the positions inside the brain have a label
The logical indices contain a true value outside of the array bounds.

Error in ft_sourceparcellate (line 172)
  fprintf('%d of the labeled positions are inside the brain\n',         sum(source.inside(seg(:)~=0)));

Thank you,
Rebecca


On Mon, Sep 14, 2020 at 10:50 PM Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>> wrote:
Hi Rebecca,

The atlas needs to be represented as a proper atlas, also known as a ‘parcellation’. Unless you know what you’re doing, this can only be achieved if the specified atlas is either in a well defined mat-file, or if the atlas is created (i.e. read from file + some additional wizardry applied to those data) by ft_read_atlas. I suspect that you did not do atlas = ft_read_atlas(‘AllAreas_v17_MPM.mat’); in order to create the atlas variable.

Also, note that ft_sourceparcellate will try and make the parcellation according to the information in the named <cfg.parcellation> field. After calling ft_read_atlas for the AllAreas_v17_MPM file, this parcellation is defined in the (confusingly) ’tissue’ field, so cfg.parcellation should be ’tissue’.

Best wishes,
Jan-Mathijs



On 14 Sep 2020, at 20:41, Rebecca Kenny <beckenny at student.ubc.ca<mailto:beckenny at student.ubc.ca>> wrote:

Hello,

I am attempting to run connectivity analysis on resting-state EEG data.  My goal of source space analysis is to run ft_networkanalysis and extract graph theory variables. I am following the "whole-brain connectivity and network analysis" tutorial.  I believe I have successfully navigated the tutorial (after importing my cleaned data from EEGlab) until I experience errors when I get to the 'connectivity analysis and parcellation'.

I can't find the atlas_MMP1.0_4k.mat file so I tried to use AllAreas_v17.mat.

  % compute connectivity
    cfg         = [];
    cfg.method  ='coh';
    cfg.complex = 'absimag';
    source_conn = ft_connectivityanalysis(cfg, source);

    load AllAreas_v17.mat;
    atlas.pos = source_conn.pos;

    cfg = [];
    cfg.parcellation = 'parcellation';
    cfg.parameter    = 'cohspctrm';
    parc_conn = ft_sourceparcellate(cfg, source_conn, atlas);

    figure;imagesc(parc_conn.cohspctrm);


Error using ft_checkdata (line 528)
This function requires parcellation data as input, see ft_datatype_parcellation.

Error in ft_sourceparcellate (line 97)
parcellation = ft_checkdata(parcellation, 'datatype', 'parcellation', 'parcellationstyle', 'indexed');

If there is an email thread already, please direct me to the proper post.

I appreciate any help.  I have been stuck at this part for a while and would love to move through my analysis.

Thank you,
Rebecca

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202




Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.

_______________________________________________
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/20200916/d7bcbde2/attachment.htm>


More information about the fieldtrip mailing list