Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

04_ica_labeling.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. %% D_ICA_labeling_resting_20141217
  2. % The central idea here is to take the full data and label the ICA based on
  3. % the data across runs. The labeled components will then be allocated to
  4. % the individual runs, such that ICA exclusion can be performed on the run
  5. % data.
  6. % required functions:
  7. % - cm_label_ica_gui_20180116
  8. restoredefaultpath;
  9. clear all; close all; pack; clc;
  10. %% pathdef
  11. pn.eeg_root = '/Volumes/LNDG/Projects/StateSwitch/dynamic/data/eeg/task/A_preproc/SA_preproc_study/';
  12. pn.EEG = [pn.eeg_root, 'B_data/C_EEG_FT/'];
  13. pn.History = [pn.eeg_root, 'B_data/D_History/'];
  14. % add ConMemEEG tools
  15. pn.MWBtools = [pn.eeg_root, 'T_tools/fnct_MWB/']; addpath(genpath(pn.MWBtools));
  16. pn.THGtools = [pn.eeg_root, 'T_tools/fnct_THG/']; addpath(genpath(pn.THGtools));
  17. pn.commontools = [pn.eeg_root, 'T_tools/fnct_common/']; addpath(genpath(pn.commontools));
  18. pn.fnct_JQK = [pn.eeg_root, 'T_tools/fnct_JQK/']; addpath(genpath(pn.fnct_JQK));
  19. pn.FT = [pn.eeg_root, 'T_tools/fieldtrip-20170904/']; addpath(pn.FT); ft_defaults;
  20. %% define Condition & IDs for preprocessing
  21. condEEG = 'dynamic';
  22. %% define IDs for visual screening
  23. ID = 1124;
  24. %% load data & start GUI
  25. % load data (full data)
  26. load([pn.EEG, num2str(ID), '_', condEEG, '_EEG_Rlm_Fhl_Ica.mat'],'data')
  27. if ~isfield(data.iclabels,'emg')
  28. data.iclabels.emg = [];
  29. end
  30. % load config (ICA version)
  31. load([pn.History, num2str(ID), '_', condEEG, '_config.mat'],'config')
  32. % settings for ICA
  33. % ica config
  34. cfg.method = 'runica';
  35. %cfg.channel = {'all','-ECG','-A2'};
  36. cfg.trials = 'all';
  37. cfg.numcomponent = 'all';
  38. cfg.demean = 'no';
  39. cfg.runica.extended = 1;
  40. % ICA solution for segments
  41. cfg.unmixing = data.unmixing;
  42. cfg.topolabel = data.topolabel;
  43. % ICA (from weights)
  44. % components
  45. comp = ft_componentanalysis(cfg,data);
  46. % include electrode information
  47. comp.elec = data.elec;
  48. % include ICA labeling
  49. comp.iclabels = data.iclabels;
  50. % clear cfg
  51. clear cfg
  52. % label ICs
  53. % settings
  54. cfg.topoall = 'yes';
  55. cfg.chanlocs = data.chanlocs;
  56. % label electrodes
  57. data.iclabels = cm_label_ica_gui_20180116(cfg,comp);
  58. % keep labels in config
  59. config.ica1.iclabels.manual = data.iclabels;
  60. % clear variables
  61. clear cfg
  62. % save data
  63. % save data (full data)
  64. save([pn.EEG, num2str(ID), '_', condEEG, '_EEG_Rlm_Fhl_Ica.mat'],'data')
  65. % save config (ICA version)
  66. save([pn.History, num2str(ID), '_', condEEG, '_config.mat'],'config')
  67. % clear variables
  68. clear BLOCK ID comp config data