Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AFRICA for EEG not working #58

Open
ghost opened this issue Jan 21, 2020 · 3 comments
Open

AFRICA for EEG not working #58

ghost opened this issue Jan 21, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 21, 2020

Hi,

I'm trying to do ICA denoising on my EEG data using OSL's AFRICA. I'm following the preprocessing commands from the online practical:
https://ohba-analysis.github.io/osl-docs/matlab/osl_example_preprocessing_manual.html#39
The relevant command from this practical is:
D = osl_africa(D,'used_maxfilter',1,'do_ident','manual');
The equivalent command that I'm using for my data is:
D = osl_africa(D,'modality','EEG','do_ident','manual');

When I run this, the script gets as far as "Precomputing sensor topographies for modality EEG", then gives the following error messages:
Warning: EEG not currently supported, using development EEG layout

In component_topoplot (line 40)
In osl_africa (line 59)
Error using ft_read_sens (line 68)
file '/Users/lukebaxter/Documents/MATLAB/osl/layouts/EEG60.mat' does not exist

Error in ft_prepare_layout (line 409)
layout = sens2lay(ft_read_sens(cfg.layout), cfg.rotate, cfg.projection, cfg.style, cfg.overlap);

Error in ft_prepare_layout (line 402)
layout = ft_prepare_layout(cfg);

Error in ft_topoplotIC (line 137)
cfg.layout = ft_prepare_layout(cfg, comp);

Error in component_topoplot (line 64)
[~] = evalc('ft_topoplotIC(cfg,data);');

Error in osl_africa (line 59)
topos = [topos component_topoplot(D,D.ica.sm,D.ica.modalities(m))];

It appears to be looking for a layout file (EEG60.mat) that didn't come with the OSL download. Is it possible to get this file? Or alternatively, can I make a bespoke layout file for my data? I would need info on how exactly to make one though. I'm working nearby OHBA, so can call in with data and laptop if necessary.

Thanks,
Luke.

@AJQuinn
Copy link
Member

AJQuinn commented Jan 21, 2020

Hello - as implied by the warning, we don't have so much experience using this code with EEG. That said, this is something we need for some of our upcoming analyses and were planning to look into anyway.

The good news is that this is likely just a visualisation error. If the code made it this far then the ICA itself ran and converged, it just doesn't know how to arrange the channels to make a topo-plot. We can look into a way to pass in a specified layout file for EEG data and hopefully the rest of the code will work as is.

The bad news is that EEG caps can be very variable so we can't provide a layout file for you (the EEG60,mat is an example we've used for testing in the past). We use fieldtrip format channel layouts, so have a look here: http://www.fieldtriptoolbox.org/tutorial/layout/ and see if you can create a layout for your data.

I'll update once there is some progress on passing the layout into africa.m

Cheers,
Andrew

@ghost
Copy link
Author

ghost commented Jan 21, 2020 via email

@AJQuinn
Copy link
Member

AJQuinn commented Feb 26, 2020

Hello - apologies for the slow progress. I've finally managed to test out a few options for this. If you update to the latest version of osl_africa there are now some built-in options for EEG layouts.

The default is now to compute a layout from the sensor info in the D object (contained in D.sensors('EEG') ), you can also pass an option to specify a layout if you want to be sure that you're using the same one across runs.

It would be great if you can update and try these out. Let me know how it goes.

Cheers,
Andrew

`
%% eeg africa generating layout from sensor info
modality = {'EEG'};
Deeg = osl_africa(Deeg,'used_maxfilter',true,...
'auto_artefact_chans_corr_thresh',.35,...
'artefact_channels',artefact_channels,...
'modality',modality);
Deeg = osl_africa(Deeg,'do_ident','manual');

%% eeg africa loading layout from file
% useful if you want to be sure that you're using the same layout across participants

% compute an EEG sensor layout.
cfg = [];
cfg.output = 'test_layout.lay';
cfg.elec = Deeg.sensors('EEG');
layout_m10 = ft_prepare_layout(cfg);

modality = {'EEG'};
Deeg = osl_africa(Deeg,'used_maxfilter',true,...
'auto_artefact_chans_corr_thresh',.35,...
'artefact_channels',artefact_channels,...
'modality',modality,...
'eeg_layout','test_layout.lay');
Deeg = osl_africa(Deeg,'do_ident','manual');
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant