genfvect.m 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. function [vec_feature, vec_label] = genfvect(EEG, study_ID, dataset_ID, ICnum)
  2. % check input
  3. if ~exist('EEG', 'var') || isempty(EEG);
  4. study_ID = 1;
  5. dataset_ID = 1;
  6. ICnum = 1;
  7. EEG = gen_eeg;
  8. end
  9. % Getting a couple more features
  10. dip_single = [EEG.dipfit.model(ICnum).posxyz EEG.dipfit.model(ICnum).momxyz];
  11. dip_double1 = [EEG.dipfit2.model(ICnum).posxyz(1, :) EEG.dipfit2.model(ICnum).momxyz(1, :)];
  12. dip_double2 = [EEG.dipfit2.model(ICnum).posxyz(2, :) EEG.dipfit2.model(ICnum).momxyz(2, :)];
  13. vec_feature = [];
  14. vec_label = {};
  15. index = 0;
  16. % book keeping
  17. update_fvec([study_ID, dataset_ID, ICnum], {'Study ID', 'Dataset ID', 'IC#'}, 3)
  18. % scalp topography
  19. update_fvec(EEG.reject.SASICA.topo(ICnum, :), 'topo image', 740)
  20. % SASICA
  21. update_fvec(EEG.reject.SASICA.icaautocorr(ICnum),'SASICA autocorrelation', 1)
  22. update_fvec(EEG.reject.SASICA.icafocalcomp(ICnum),'SASICA focal topo', 1)
  23. update_fvec(EEG.reject.SASICA.icaSNR(ICnum),'SASICA snr', 1)
  24. update_fvec(EEG.reject.SASICA.var(ICnum),'SASICA ic variance', 1)
  25. % ADJUST
  26. update_fvec(EEG.reject.SASICA.icaADJUST.diff_var(ICnum),'ADJUST diff_var', 1)
  27. update_fvec(EEG.reject.SASICA.icaADJUST.meanK(ICnum),'ADJUST Temporal Kurtosis', 1)
  28. update_fvec(EEG.reject.SASICA.icaADJUST.SED(ICnum),'ADJUST Spatial Eye Difference', 1)
  29. update_fvec(EEG.reject.SASICA.icaADJUST.SAD(ICnum),'ADJUST spatial average difference', 1)
  30. update_fvec(EEG.reject.SASICA.icaADJUST.GDSF(ICnum),'ADJUST General Discontinuity Spatial Feature', 1)
  31. update_fvec(EEG.reject.SASICA.icaADJUST.nuovaV(ICnum),'ADJUST maxvar/meanvar', 1) % should remove
  32. % FASTER
  33. % 1 Median gradient value, for high frequency stuff
  34. % 2 (NOT USED) Mean slope around the LPF band (spectral)
  35. % 3 Kurtosis of spatial map
  36. % 4 Hurst exponent
  37. % 5 (NOT USED) Eyeblink correlations
  38. label = {'FASTER Median gradient value','FASTER Kurtosis of spatial map','FASTER Hurst exponent'};
  39. update_fvec(EEG.reject.SASICA.icaFASTER.listprops(ICnum,[1 3 4]),label, 3)
  40. % basic info
  41. update_fvec(EEG.nbchan,'number of channels', 1)
  42. nic = size(EEG.icaact,1);
  43. update_fvec(nic,'number of ICs', 1)
  44. update_fvec(EEG.reject.SASICA.plotrad(ICnum),'topoplot plot radius', 1)
  45. update_fvec(EEG.trials>1,'epoched?', 1)
  46. update_fvec(EEG.srate,'sampling rate', 1)
  47. update_fvec(EEG.pnts,'number of data points', 1)
  48. % dipole info
  49. update_fvec(EEG.dipfit.model(ICnum).rv,'dip1 rv (SASICA)', 1)
  50. label = {'dip1 posx', 'dip1 posy', 'dip1 posz', 'dip1 momx', 'dip1 momy', 'dip1 momz'};
  51. update_fvec(dip_single,label, 6)
  52. update_fvec(EEG.dipfit2.model(ICnum).rv,'dip2 rv', 1)
  53. label = {'dip2_1 posx', 'dip2_1 posy', 'dip2_1 posz', 'dip2_1 momx', 'dip2_1 momy', 'dip2_1 momz'};
  54. update_fvec(dip_double1,label, 6)
  55. label = {'dip2_2 posx', 'dip2_2 posy', 'dip2_2 posz', 'dip2_2 momx', 'dip2_2 momy', 'dip2_2 momz'};
  56. update_fvec(dip_double2,label, 6)
  57. % spectrum info
  58. update_fvec(EEG.reject.SASICA.spec(ICnum, :), 'psd_med', 100)
  59. update_fvec(EEG.reject.SASICA.specvar(ICnum, :), 'psd_var', 100)
  60. update_fvec(EEG.reject.SASICA.speckrt(ICnum, :), 'psd_kurt', 100)
  61. % autocorrelation function
  62. update_fvec(EEG.reject.SASICA.autocorr(ICnum, :), 'autocorr', 100)
  63. function update_fvec(val, label, len)
  64. vec_feature(index + (1:len)) = val;
  65. if iscellstr(label)
  66. vec_label(index + (1:len)) = label;
  67. elseif ischar(label)
  68. [vec_label{index + (1:len)}] = deal(label);
  69. end
  70. index = index + len;
  71. end
  72. end
  73. function EEG = gen_eeg
  74. EEG = eeg_emptyset;
  75. EEG.reject.SASICA.icaresvar = 1;
  76. EEG.reject.SASICA.icaautocorr = 1;
  77. EEG.reject.SASICA.icafocalcomp = 1;
  78. EEG.reject.SASICA.icaSNR = 1;
  79. EEG.reject.SASICA.var = 1;
  80. EEG.reject.SASICA.icaADJUST.diff_var = 1;
  81. EEG.reject.SASICA.icaADJUST.meanK = 1;
  82. EEG.reject.SASICA.icaADJUST.SED = 1;
  83. EEG.reject.SASICA.icaADJUST.SAD = 1;
  84. EEG.reject.SASICA.icaADJUST.GDSF = 1;
  85. EEG.reject.SASICA.icaADJUST.nuovaV = 1;
  86. EEG.dipfit.model.rv = 0;
  87. EEG.dipfit.model.posxyz = zeros(1,3);
  88. EEG.dipfit.model.momxyz = zeros(1,3);
  89. EEG.dipfit2.model.rv = 0;
  90. EEG.dipfit2.model.posxyz(1,:) = zeros(1,3);
  91. EEG.dipfit2.model.momxyz(1,:) = zeros(1,3);
  92. EEG.dipfit2.model.posxyz(2,:) = zeros(1,3);
  93. EEG.dipfit2.model.momxyz(2,:) = zeros(1,3);
  94. EEG.reject.SASICA.topo = zeros(1,740);
  95. EEG.reject.SASICA.spec = zeros(1,100);
  96. EEG.reject.SASICA.specvar = zeros(1,100);
  97. EEG.reject.SASICA.speckrt = zeros(1,100);
  98. EEG.reject.SASICA.autocorr = zeros(1,100);
  99. EEG.reject.SASICA.icaFASTER.listprops = zeros(1,5);
  100. EEG.nbchan = 1;
  101. EEG.icaact = ones(2);
  102. EEG.reject.SASICA.plotrad = 1;
  103. EEG.pnts = 1;
  104. end