Fieldtrip: ft_freqstatistics for EEG data (cluster correction)

Hi,
I would like to use the Fieldtrip function ft_freqstatistics to perform cluster statistics at the channel level on frequency-resolved (but not time-resolved) EEG data (64 channels + 66 blank channels). I have 11 participants, and for each participants the data have the following size: 130220 (channels/time/frequency). When I run the process (Process2/Test/Fieldtrip: fq_freqstatistics) I obtain after 2 minutes a Java exception (OutOfMemoryError).
I run the process on a mac book pro 2016 (3,1 GHz Intel Core i7). As the permutations have to be made on 64*20 (channels/frequency), I don't understand why it crashes (the amount of data seems quite small). Might you please help me on this, and maybe suggest a way around this issue ?

thank you,
Benjamin Morillon

ps: the info appearing on the Matlab screen when I run the process:
CHANNEL_TESSELATE> WARNING: Some sensors are not in the Faces list: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 69 106 129 130
the call to "ft_selectdata" took 2 seconds and required the additional allocation of an estimated 10 MB
using "ft_statistics_montecarlo" for the statistical testing
using "ft_statfun_depsamplesT" for the single-sample statistics
constructing randomized design
total number of measurements = 22
total number of variables = 2
number of independent variables = 1
number of unit variables = 1
number of within-cell variables = 0
number of control variables = 0
using a permutation resampling approach
repeated measurement in variable 2 over 11 levels
number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 2
computing a parametric threshold for clustering
computing statistic
estimated time per randomization is 0.01 seconds
computing statistic 1000 from 1000

Assembling the data matrices and setting the options for ft_freqstatistics is a bit complicated, and maybe some cases are not handled correctly. This will require a bit of debugging on your end.

  1. Place a breakpoint in process_ft_freqstatistics at line 265.
    https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_ft_freqstatistics.m#L265
  2. Check that all the options and the data looks like what you would like to send to ft_freqstatistics.
    3a) If the input data is not correctly formatted, tell me what is wrong and I’ll try to fix it.
    3b) If it looks correct: save the statcfg and ftAllFiles matrices in .mat file, and post this as a new issue on the FieldTrip github: https://github.com/fieldtrip/fieldtrip/issues

Thanks for the reply.
Input data seems fine with me. I thus created a post in the Filedtrip github:https://github.com/fieldtrip/fieldtrip/issues/519 (no reply yet).
Benjamin

Hi, I posted my comment on the Fieldtrip github but got no answer so far.
Meanwhile (or alternatively), might you please maybe try to see if my data work on your computer, or tell me if the structure of the data is correct ?
(see here the files and Fieldtrip post: https://github.com/fieldtrip/fieldtrip/issues/519)
thank you,
bn

Hi @Francois,
I'm using the Fieldtrip function ft_freqstatistics to compare the PSD results of 22 participants that performed a task in two different conditions (listen an audio stimulus of different lengths and characteristics). Only one trial for each condition was delivered. I used an EEG EGI NET with 64 channels . When I run the process (Process2/Test/Fieldtrip: fq_freqstatistics) I obtain after 30 sedonds this error:

I'm using the latest version of Brainstorm (12-Mar-2020) and FieldTrip (20200315).

What's wrong? Could you please help me?

Regards,

Francesco

I've seen this error recently, when I had both FieldTrip and SPM in the Matlab path (the problem was due to having multiple versions of fieldtrip functions in the path, because SPM includes parts of FieldTrip)...
Edit your Matlab path: remove everything that is not related with Matlab (remove all FieldTrip, Brainstorm and SPM folders), save and close Matlab. Restart Matlab, do not add any path to Matlab, go to the brainstorm3 folder and run brainstorm.m, then run your test.

Please tell me if it solves your problem, and what you think the conflict was.
I probably need to add additional checks somewhere...

Thank you so much @Francois! I'm pretty sure the conflict was due to the presence of EEGLAB in the toolbox folder of MATLAB. I solved the problem moving the EEGLAB folder in another position and removing it from the MATLAB path. EEGLAB includes an older version of FieldTrip lite that could have caused the conflict.
In EEGLAB tutorial is recommended to insert the EEGLAB folder inside the toolbox folder of MATLAB (https://sccn.ucsd.edu/wiki/I.1:_Loading_Data_in_EEGLAB) but this could raise a conflict when using FieldTrip functions on Brainstorm.
Thanks again,
Francesco