SIESTA-eu / wp15

work package 15, use case 2
0 stars 1 forks source link

use case 2.4 - automated EEG processing using MATLAB #5

Open robertoostenveld opened 5 months ago

robertoostenveld commented 5 months ago

ERPcore

The data set includes a small tabular entry characterising human participants and EEG data.

The results to be produced are of the vector and matrices reflecting the different type of types of analyses, based on user requirements.

The brain data analyses are fully automated, but different outputs are produced based on user requirements—the testing principle of minimisation applied to medical data analysis.

Relies on matlab/EEGLAB - the dataset includes 40 subjects (24,1GB)

robertoostenveld commented 4 months ago

I suggest to move the MATLAB-specific commands for installation of the toolboxes and for setting up the path into a MATLAB script and/or function.

CPernet commented 4 months ago

oh I see -- I went overkill, check-in every plugins even the ones that comes by default, what do you think https://github.com/SIESTA-eu/wp15/commit/26f881267eb58e3a699b30f40b0d0e0e26fec43e

robertoostenveld commented 4 months ago

I think this is getting better. I don't like the savepath though, on shared systems you cannot write to the default /usr/local/matlab/pathdef.m so that will give an error. I think it is bad practice anyway to enforce a system-wide path for all users and all MATLAB sessions that you will start. The path should be project-specific.

robertoostenveld commented 4 months ago

It does not seem to work though, I get

Error using ERP_Core_WB_install
1 or more of the necessary plugins is not found
CPernet commented 4 months ago

I cannot explain why it fails ?? but i have removed the save and return more explict message

robertoostenveld commented 4 months ago

I do not understand why it is working for you. Have you started with a clean path, i.e. restoredefaultpath?

You are adding on line 12 the path /Volumes/SamsungT3/SIESTA/wp15/usecase-2.4/eeglab2024.0/plugins/bids-matlab-tools8.0 whereas that only contains a directory with the name bids-matlab-tools and not the pop_importbids function that you are aiming for.

CPernet commented 4 months ago

yes clean -- but i cannot fully test the code because as soon as i call eeglab to install the plugin it works

CPernet commented 4 months ago

my paths are generated clean -- no subfolders

robertoostenveld commented 4 months ago

how about this for ERP_Core_WB_install.m ??

% add EEGLAB
addpath('eeglab2024.0');

% the rest runs automatically
eeglab('nogui')

plugin_askinstall('bids-matlab-tools','pop_importbids',1);
plugin_askinstall('zapline-plus','pop_zapline_plus',1);
plugin_askinstall('clean_rawdata','pop_clean_rawdata',1);
plugin_askinstall('picard','picard',1);
plugin_askinstall('ICLabel','pop_iclabel',1);
plugin_askinstall('Fieldtrip-lite','ft_prepare_neighbours',1);

addpath(fullfile('eeglab2024.0', 'plugins'));
robertoostenveld commented 4 months ago

how about this for ERP_Core_WB_install.m ??

nope, also does not work.

And with addpath(genpath(fullfile('eeglab2024.0', 'plugins'))); it also does not work.

CPernet commented 4 months ago

the issue is it is not recursive (an eeglab problem really, but we got to address it) -- is that on your mac that it fails?

CPernet commented 4 months ago

what about a 1 layer recursivity?

plugin_askinstall('bids-matlab-tools',[],1);
if ~exist('pop_importbids','file')
    try        
        folder2add = dir(fullfile(pluginfolder,"bids-matlab-tools*"));
        if ~exist(fullfile(pluginfolder,[folder2add.name filesep 'pop_importbids']),'file')
            folder2add = dir(fullfile(pluginfolder,[folder2add.name filesep "bids-matlab-tools*"]));
        end
        addpath(fullfile(pluginfolder,folder2add.name)); 
    catch plerr
        missing{index} = ['bids-matlab-tools: ' plerr.message]; index = index +1;
    end
end

we may want to turn that script into a function, and we can make the recursive a sub-function, because it's getting uglier by the minute

robertoostenveld commented 4 months ago

Rather than fixing it in our script, we can use plugin_askinstall() better. I just did a commit that for me seems to work, starting from a completely fresh install.

I now get stuck on the following, which does not seem to be a plugin error:

Error using std_limo
std_limo subject sub-001: Measures must be computed first
Error in pop_limo (line 183)
[STUDY,limofiles] = std_limo(STUDY, ALLEEG, options{:});
Error in ERP_Core_WB (line 278)
    [STUDY, ~, files] = pop_limo(STUDY, EEG, 'method','WLS','measure','daterp',... 
CPernet commented 4 months ago

this is computed line 260 - no errors for me or @schoffelen before ?? what eeglab does here is augmenting data .. do you have space in /Volumes/SamsungT3/ (just checking on possible error)

CPernet commented 4 months ago

PS: thx fixing the plugin install

robertoostenveld commented 4 months ago

no, there are no spaces in the path to the data.

I will check what happens on line 260.

CPernet commented 4 months ago

lol i meant disk space

arnodelorme commented 3 months ago

Yes, "plugin_askinstall" is the way to go. The only thing I would change in Robert's short script is

plugin_askinstall('Fieldtrip','ft_prepare_neighbours',1);

A good reference for that is this page

https://eeglab.org/others/Compiled_EEGLAB.html#can-i-compile-eeglab-myself

CPernet commented 3 months ago

@arnodelorme I made the changes following the page you indicated. 'zapline-plus' is not in the list, but it would be great if you could update the webpage and tell us here what the correct argument is.

thx

PS: one issue we have is for plugins with a version, this unpacks inside the current folder plugins/fieldtrip becomes plugins/fieldtrip/filedtipXXX and all files in that subdirectory