hipercog / ctap

Computational Testing for Automated Preprocessing - a Matlab toolbox extending EEGLAB functionality for batch processing of EEG
Other
22 stars 10 forks source link

Individual chanlocs files #14

Open zenBen opened 6 years ago

zenBen commented 6 years ago

There may be a separate chanlocs file required for each recording, and we do not have an option to handle this.

Chanlocs can exist in three ways:

  1. chanlocs are one-to-many, stored in a single file for all recordings
  2. chanlocs are one-to-one, stored in a single file for each recording
  3. chanlocs are already embedded in the data (for .set files only?)

For each scenario, there are options for CTAP:

  1. Cfg.eeg.chanlocs = the full file path, this is the (only?) currently supported approach
  2. chanlocs files can be: (a) in the same directory, or (b) different directories 2a. Cfg.eeg.chanlocs = the chanlocs directory. Read that directory in CTAP_load_chanlocs(), and pick the chanlocs file with closest matching filename to the data file

    • this could be a helper function that can also be called from path2measconf().

    2b. list of chanlocs for each recording exists in the measurement config spreadsheet

    • this requires changes to read_measinfo_spreadsheet() to discover chanlocs
  3. chanlocs is already embedded in the data (for .set files only?)

These options imply different required user behaviour:

  1. set Cfg.eeg.chanlocs = the full file path, this is how it currently works
  2. ... 2a. set Cfg.eeg.chanlocs = the chanlocs directory, minimal change but possibly buggy due to file matching 2b. add chanlocs file path to each recording entry in the measurement config spreadsheet, laborious and safe, but makes Cfg.eeg.chanlocs redundant, which requires a different approach to auto checking and documentation
    • If this was ever implemented, solution could be that read_measinfo_spreadsheet() writes a cell string array of filepaths to chanlocs in Cfg.eeg.chanlocs, and CTAP_load_chanlocs() is upgraded to read that
  3. set Cfg.eeg.chanlocs = some dummy value? Or how not to trigger error in ctap_auto_config()? And then don't call CTAP_load_chanlocs() (which won't be needed).

EDIT added feature to support solution 2a. This might easily break if chanlocs files are not named in uniform way, and can only work for chanlocs all in the same directory. Created function find_closest_file(), which could also be used in path2measconf(), but that code is complex enough that I won't mess with it now.

zenBen commented 6 years ago

Have tested this with the HeadIT dataset here

All data was downloaded to the same directory, and files (which are all named eeg_recording_1.bdf) were renamed to the form sNN_eeg_1.bdf (where NN is a two digit number from [01..12]). The same procedure was applied to channel location files.

This worked fine after small changes to CTAP_load_chanlocs.m and ctapeeg_load_chanlocs.m, to handle mismatched numbers of channels in EEG and chanlocs.