-
Notifications
You must be signed in to change notification settings - Fork 27
Channel Neighbourhood
To compute clusters in space, one needs to know the spatial relationship between channels. While in MRI it is obvious which voxels are neighbours with which, in MEEG it is less obvious which channels should be considered neighbours. With a dense array (say 256 electrodes), you may want to associate more channels together than with a sparse array (32 electrodes).
LIMO EEG, therefore, is using a neighbourhood matrix (a binary matrix that state which channel go together) to sum/integrate values of declared neighbours - reusing here function made in fieldtrip
expected_chanlocs (also called neighbours in fieldtrip and internally)
This file is created on your drive when using the EEGLAB study or building the neighbourhood matrix using the LIMO EEG interface (limo eeg --> limo tools --> create or edit an expected chanloc file).
When you load this file, it itself contains 2 variables: expected_chanlocs and channeighbstructmat.
This is a structure which lists each channel, and for each channel gives the name and location through the fields 'labels', 'X', 'Y' and 'Z'. Example:
Fields | labels | X | Y | Z |
---|---|---|---|---|
1 | 'Fp1' | 6,60688 | 6,3023 | -2,94229 |
2 | 'AF7' | 4,41106 | 8,71481 | 3,50199 |
3 | 'AF3' | 3,2749 | 8,15713 | 5,6958 |
4 | 'F1' | 0 | 4,34559 | 9,00826 |
5 | 'F3' | 3,07692 | 10,1424 | 1,24235 |
6 | 'F5' | 0 | 9,0897 | 5,75876 |
7 | 'F7' | -2,78065 | 3,71493 | 8,68573 |
8 | 'FT7' | 0 | 10,3612 | 3,54499 |
9 | 'FC5' | -3,2749 | 8,15713 | 5,6958 |
10 | 'FC3' | -3,07692 | 10,1424 | 1,24235 |
This is the binary matrix (1 and 0) use for the clustering. For a 64 electrodes set-up, channeighbstructmat will be a 64x64 matrix with 1 if 2 electrodes are neighbours, 0 otherwise. The default neighbours can be found in fieldtrip and the conversion to channeighbstructmat can be done using the function template2neighbmat in this github.
There is a single function for both subject and group analyses: limo_expected_chanlocs
If you want to create the expected_chanlocs structure from the average channel positions, use: limo_avg_expected_chanlocs(PATH_TO_DERIVATIVES, model.defaults);
[expected_chanlocs, channeighbstructmat] = limo_expected_chanlocs('my_merged_subject_data.set')
If you want to perform single subject analyses, you will need to bootstrap the data and possibly using spatial-temporal clustering or TFCE. In those cases, you need to define the subject-specific neighbourhood matrix. This is specific to each subject because more often than not, some channels are 'bad' and these differ for each subject. The result is (or should be) stored in the subject LIMO.mat file.
low level function
[neighbours,channeighbstructmat] = limo_get_channeighbstructmat(EEG,neighbourdist)
cd(mysubject);
load LIMO;
[~,LIMO.data.neighbouring_matrix]=limo_expected_chanlocs('my_merged_subject_data.set');
save LIMO LIMO;
[expected_chanlocs, channeighbstructmat] = limo_expected_chanlocs('my_list_of_subjects_LIMO_files.txt')
alternatively, EEGLAB STUDY to LIMO also generates such matrix using the following command line
[\~\,\~\,neighbors] = std_prepare_neighbors(STUDY, ALLEEG, 'force', 'on')
For group-level analysis, we need to define a minimal dataset of electrodes. The limo_expected_chanlocs function allows creating this minimal cap (hardcoded with a minimum of 3 subjects line 35) by loading all LIMO.mat from all the subjects in a study. Note that the function itself only creates those variables that still need to be saved on the drive. You may also want to visualize and edit the channeighbstructmat. This is done using the LIMO Tools interface --> create or edit an expected chanloc file.
[expected_chanlocs, channeighbstructmat] = limo_expected_chanlocs('my_list_of_subjects_LIMO_files.txt')
save('my_gp_level_chanlocs.mat','expected_chanlocs','channeighbstructmat')
You can find some examples from FieldTrip
Somehow win8 and Matlab interact in a strange way, and editing the neighbourhood matrix fails when clicking outside the window to finish to edit ??
you can edit this matrix using LIMO Tools see Editing-group-level-neighbourhood-matrix
Downsampling or not before analyzing
Defining conditions defining
~ categorical.txt ~continuous.txt
EEGLAB-STUDY: run, session, condition and group
Basic Stats: LIMO tests and CI
Repeated measures ANOVA
Results in the workspace
Results in LIMO.cache
Checking data under the plots
Reordering plots
Compute & Plot conditions
Compute & Plot differences
Channel neighbourhood
Editing a neighbourhood matrix
Scripting 1st level
Debugging 1st level errors
Skip 1st level
Scripting 2nd level
Getting stats results with a script