|
|
function list_properties = component_properties(EEG,blink_chans,lpf_band)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list_properties = [];
|
|
|
|
|
|
if isempty(EEG.icaweights)
|
|
|
fprintf('No ICA data.\n');
|
|
|
return;
|
|
|
end
|
|
|
|
|
|
if ~exist('lpf_band','var') || length(lpf_band)~=2 || ~any(lpf_band)
|
|
|
ignore_lpf=1;
|
|
|
else
|
|
|
ignore_lpf=0;
|
|
|
end
|
|
|
|
|
|
delete_activations_after=0;
|
|
|
if ~isfield(EEG,'icaact') || isempty(EEG.icaact)
|
|
|
delete_activations_after=1;
|
|
|
EEG.icaact = eeg_getica(EEG);
|
|
|
end
|
|
|
|
|
|
for u = 1:size(EEG.icaact,1)
|
|
|
[spectra(u,:) freqs] = pwelch(EEG.icaact(u,:),[],[],(EEG.srate),EEG.srate);
|
|
|
end
|
|
|
|
|
|
list_properties = zeros(size(EEG.icaact,1),5);
|
|
|
|
|
|
for u=1:size(EEG.icaact,1)
|
|
|
measure = 1;
|
|
|
|
|
|
|
|
|
|
|
|
list_properties(u,measure) = median(diff(EEG.icaact(u,:)));
|
|
|
measure = measure + 1;
|
|
|
|
|
|
|
|
|
if ignore_lpf
|
|
|
list_properties(u,measure) = 0;
|
|
|
else
|
|
|
list_properties(u,measure) = mean(diff(10*log10(spectra(u,find(freqs>=lpf_band(1),1):find(freqs<=lpf_band(2),1,'last')))));
|
|
|
end
|
|
|
measure = measure + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list_properties(u,measure) = kurt(EEG.icawinv(:,u));
|
|
|
measure = measure + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list_properties(u,measure) = hurst_exponent(EEG.icaact(u,:));
|
|
|
measure = measure + 1;
|
|
|
|
|
|
|
|
|
if (exist('blink_chans','var') && ~isempty(blink_chans))
|
|
|
for v = 1:length(blink_chans)
|
|
|
if ~(max(EEG.data(blink_chans(v),:))==0 && min(EEG.data(blink_chans(v),:))==0);
|
|
|
f = corrcoef(EEG.icaact(u,:),EEG.data(blink_chans(v),:));
|
|
|
x(v) = abs(f(1,2));
|
|
|
else
|
|
|
x(v) = v;
|
|
|
end
|
|
|
end
|
|
|
list_properties(u,measure) = max(x);
|
|
|
measure = measure + 1;
|
|
|
end
|
|
|
end
|
|
|
|
|
|
for u = 1:size(list_properties,2)
|
|
|
list_properties(isnan(list_properties(:,u)),u)=nanmean(list_properties(:,u));
|
|
|
list_properties(:,u) = list_properties(:,u) - median(list_properties(:,u));
|
|
|
end
|
|
|
|
|
|
if delete_activations_after
|
|
|
EEG.icaact=[];
|
|
|
end |