TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
EEG_feat_extr.m
Go to the documentation of this file.
1 %This file is part of TEAP.
2 %
3 %TEAP is free software: you can redistribute it and/or modify
4 %it under the terms of the GNU General Public License as published by
5 %the Free Software Foundation, either version 3 of the License, or
6 %(at your option) any later version.
7 %
8 %TEAP is distributed in the hope that it will be useful,
9 %but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License for more details.
12 %
13 %You should have received a copy of the GNU General Public License
14 %along with TEAP. If not, see <http://www.gnu.org/licenses/>.
15 %
16 %> @file EEG_feat_extr.m
17 %> @brief Computes Skin respiration features
18 %> @param EEGsignal: the respiration signal.
19 %> @param varargin: you can choose which features to extract (see featureSelector)
20 %> the list of available features is:
21 %> - SP_delta:power spectral power for delta band <4Hz
22 %> - SP_theta: power spectral power for theta band [4,8[ Hz
23 %> - SP_slowAlpha: power spectral power for slow alpha band [8,[10 Hz
24 %> - SP_alpha: power spectral power for alpha band [8,12[ Hz
25 %> - SP_beta: power spectral power for beta band [12,30[ Hz
26 %> - SP_gamma: power spectral power for gamma band >30Hz
27 %
28 %> @retval EEG_feats: list of features values
29 %> @retval EEG_feats_names: names of the computed features (it is good pratice to
30 %> check this vector since the order of requested features
31 %> can be different than the requested one)
32 %> the features are per electode and therefore 1xN (N= number of electrodes)
33 %> and the final output is a 2dimensional array whose size is N_features x N_electrodes
34 %
35 %> @author Copyright Mohammad Soleymani, Guillaume Chanel, Frank Villaro-Dixon, 2015
36 function [EEG_feats, EEG_feats_names] = EEG_feat_extr(EEGsignal,varargin)
37 
38 % Check inputs and define unknown values
39 narginchk(1, Inf);
40 
41 %Make sure we have a EEG signal
42 EEGsignal = EEG__assert_type(EEGsignal);
43 
44 
45 if(Signal__get_absolute(EEGsignal) ~= true)
46  warning('The signal was baselined/relative, are you sure you want that ?');
47 end
48 
49 
50 % Define full feature list and get features selected by user
51 featuresNames = {'SP_delta', 'SP_theta', 'SP_slowAlpha','SP_alpha','SP_beta','SP_gamma'};
52 EEG_feats_names = featuresSelector(featuresNames,varargin{:});
53 config_file;
54 
55 %If some features are selected
56 if(~isempty(EEG_feats_names))
57  if any(strncmp('SP',EEG_feats_names,2))
58  %calculating spectral power features in different bands
59  [SP_delta, SP_theta, SP_slowAlpha, SP_alpha, SP_beta, SP_gamma] = EEG_feat_bandENR(EEGsignal);
60  end
61  %final vector output
62  for (i = 1:length(EEG_feats_names))
63  eval(['EEG_feats(i,:) = ' EEG_feats_names{i} ''';']);
64  end
65 
66 else %no features selected
67  EEG_feats = [];
68 end
69 
70 
71 
Signal__get_absolute
function Signal__get_absolute(in Signal)
EEG__assert_type
function EEG__assert_type(in Signal)
EEG_feat_bandENR
function EEG_feat_bandENR(in EEGSignal)
EEG_feat_extr
function EEG_feat_extr(in EEGsignal, in varargin)
featuresSelector
function featuresSelector(in featuresNames, in varargin)
If no Include/exclude statement is specifed all features are returned.