diff --git a/readme.m b/readme.m index b18cd01..e7dd046 100644 --- a/readme.m +++ b/readme.m @@ -1,4 +1,4 @@ -[signal, states, params] = load_bcidat('/home/jph/Uni/Masterarbeit/Block1_ReachingMovements/AO/AO_B1001/AO_B1S001R01.dat'); +[signal, states, params] = load_bcidat('/home/jph/Uni/masterarbeit/origData/AO/AO_B1001/AO_B1S001R01.dat'); params.SamplingRate.NumericValue plot(states.StimulusCode) diff --git a/text/TODO.txt b/text/TODO.txt index e2c0b2a..4dfbae3 100644 --- a/text/TODO.txt +++ b/text/TODO.txt @@ -96,3 +96,9 @@ ---------- experimental design - more data needed (sex, age, ...); slight differences in the experimental design of Shiman and Sarasola paper + +2016-11-02 +---------- +BCI2000 - what does the signal values (int) mean? +via... +"our work" - better idea? diff --git a/text/thesis/02MaterialsAndMethods.tex b/text/thesis/02MaterialsAndMethods.tex index 7dbb32a..17a7bde 100644 --- a/text/thesis/02MaterialsAndMethods.tex +++ b/text/thesis/02MaterialsAndMethods.tex @@ -7,7 +7,7 @@ First approaches used invasive BCIs earlier in Animals (rodents and monkeys) later also in humans. Invasive BCIs in humans were mostly implanted when the human was under brain surgery for another reason like therapy of epilepsy. Problems of invasive BCIs are the need to cut through skull and dura mater. This can lead to infections and severe brain damage.\\ An improvement were less invasive BCIs with e.g. ECoG which is placed inside the skull but outside the dura which decreased the risk for infections massively.\\ Measuring outside the skull entails even less risk, the dura and skull however lower the quality of the signal massively. With some improvements EEG has a spatial resolution of 2-3 cm (cf. \cite{Babiloni01}). This is quite bad compared to the single neuron one can observe with invasive methods. However we are more interested in the activity of areas then single cells for our task, so EEG meets our requirements here.\\ - In addition EEG is much cheaper and easier to use than other techniques. There is no need for surgery (like for invasive methods) and the hardware can be bought for less than 100\euro{} while FMRI hardware costs far above 100,000\euro{}. This is one of the reasons EEG is far more available than other techniques. There are some inventions of younger date but not as much work has been done with them why they aren't as well known and as far distributed as EEG.\\ + In addition EEG is much cheaper and easier to use than other techniques. There is no need for surgery (like for invasive methods) and the hardware can be bought for less than 100\euro{} while FMRI hardware costs far above 100,000\euro{}. This is one of the reasons EEG is far more available than other techniques. There are some inventions of younger date but not as much work has been done with them why they are not as well known and as far distributed as EEG.\\ Another pro of EEG is that the device is head mounted. That means the user may move while measuring without high impact on the tracking of activity. This is highly necessary for any BCI used in daily life. \subsection{EEG} When using Electroencephalography (EEG) one measures the electrical fields on the scalp that are generated by activity of neurons in the brain. These measurements allow some interpretation about what is happening inside the skull. In our application we use the recorded currents directly to train a SVM or as predictor for regression. @@ -15,7 +15,7 @@ The foundation stone for EEG was laid in 1875 when Richard Caton found electrical activity around the brain of monkeys. After testing the methods on animals in 1924 the first human EEG was recorded by Hans Berger in Jena. He also coined the term Electroencephalography and is seen as the inventor of EEG. The frequencies typically used for movement prediction in EEG are about 8-24 Hz (\cite{Blokland15},\cite{Ahmadian13},\cite{Wang09}). - EEG is often used for non-invasive BCIs because it's cheap and easier to use than e.g. fMRI. The electrodes have to be spread over the scalp. To allow for comparability there are standardized methods for this. These methods also bring a naming convention with them. + EEG is often used for non-invasive BCIs because it is cheap and easier to use than e.g. fMRI. The electrodes have to be spread over the scalp. To allow for comparability there are standardized methods for this. These methods also bring a naming convention with them. \subsubsection{10-20 system} In this standard adjacent electrodes are placed either 10\% or 20\% of the total front-back or left-right distance apart. This standardization also makes it possible to name each electrode or rather here place. This is done with capital letters for lobes (Frontal, \qq{Central}, Parietal, Occipital and Temporal) and numbers for the specific place on the lobe. Even numbers are on the right side of the head, odd on the left; larger numbers are closer to the ears, lower numbers closer to the other hemisphere. The exact number now refers to the exact distance from center: $$\left\lceil\frac{x}{2}\right\rceil\cdot \frac{d}{10}$$ where $x$ is the number and $d$ the diameter of the scalp. Electrodes in the centre are named with a lower case $z$ e.g. $Cz$.\\ Electrodes between two lobes (10\% instead of 20\% distance) are named with the both adjacent lobes (anterior first) e.g. $FCz$ (between frontal and central lobe). @@ -59,7 +59,7 @@ \subsection{Filtering} Filtering of the recorded EEG signal is necessary for different reasons. First there are current relics from 50Hz current. These can be filtered out with bandstop filters.\\ Secondly we need to concentrate on the interesting frequencies (for classical EEG 1-50Hz). This is done by applying lowpass or highpass filters respectively. This is necessary because the PSD of lower frequency is a lot higher than that of higher frequencies. The relation $$PSD(f)=\frac{c}{f^\gamma}$$ holds for constants $c$ and $\gamma$ (\cite{Demanuele07}).\\ - The Butterworth filter (\cite{Butterworth30}) was invented by Stephen Butterworth in 1930. It's advantage was uniform sensitivity to all wanted frequencies. In comparison to other filters Butterworth's is smoother because it is flat in the pass band and monotonic over all frequencies. This however leads to decreased steepness meaning a higher portion of frequencies beyond cutoff. + The Butterworth filter (\cite{Butterworth30}) was invented by Stephen Butterworth in 1930. Its advantage was uniform sensitivity to all wanted frequencies. In comparison to other filters Butterworth's is smoother because it is flat in the pass band and monotonic over all frequencies. This however leads to decreased steepness meaning a higher portion of frequencies beyond cutoff. \subsection{EMG} When using muscles they are contracted after an signal via an efferent nerve activates them. Contraction of muscles also releases measurable energy which is used for Electromyography (EMG). There are intramuscular applications of EMG but we only used surface EMG.\\ From surface EMG activity of muscles can be estimated however not very precisely without repetition. Since the muscles used for arm movements are quite large in our setting EMG allows relatively precise estimations of underlying muscle activity. @@ -110,7 +110,7 @@ ALS usually converges faster and with an better result than multiplicative update algorithms which would be the alternative in \matlab{}. \subsection{Autoencoders} \label{mat:autoenc} - Autoencoders are a specific type of artificial neural networks (ANN). They work like typical ANNs by adjusting weights between the layers however they don't predict an unknown output but they predict their own input. What is interesting now is manipulating the size of the hidden layer where the size of the hidden layer has to be smaller than the input size. Now in the hidden layer the information of the input can be found in a condensed form (e.g. synergies instead of single muscle activity).\\ + Autoencoders are a specific type of artificial neural networks (ANN). They work like typical ANNs by adjusting weights between the layers however they do not predict an unknown output but they predict their own input. What is interesting now is manipulating the size of the hidden layer where the size of the hidden layer has to be smaller than the input size. Now in the hidden layer the information of the input can be found in a condensed form (e.g. synergies instead of single muscle activity).\\ Autoencoders have been successfully used by Spüler et al. to extract synergies from EMG (\cite{Spueler16}). Especially with a lower number of synergies autoencoders should perform better than PCA or NMF because linear models fail to discover the agonist-antagonist relations that are typical for muscle movements. These however can be detected by autoencoders which allows for good estimations with half the synergies.\\ An autoencoder's input layer has as many neurons as there are input dimensions (e.g. one for each EMG channel). The number of hidden layer neurons may be varied. We mostly used 3. The output layer is of the same size as the input layer. This autoencoder is shown in Figure~\ref{fig:autoenc}. \begin{figure} @@ -173,3 +173,75 @@ One session consists of 5 runs with 40 trials each. The trials were separated by resting phases of varying length (2-3s, randomly assigned). Each trial began with an auditory cue specifying the random but equally distributed target for this trial. This leads to 50 reaches to the same target each session. After the cue the participants should \qq{perform the movement and return to the starting position at a comfortable pace but within 4 seconds}\footnote{\cite{Shiman15}}\\ For each subject there were 4 to 6 sessions, each recorded on a different day. All in all there were 255 runs in 51 sessions. Each session was analyzed independently as one continuous trial. +\section{Our work} + \subsection{Loading of data} + The data recorded with BCI2000 (\cite{Schalk04}) can be loaded into \matlab{} with a specific \texttt{.mex} file. The according \texttt{.mex}-Files for some platforms (Windows, MAC, Linux) are available from BCI2000 precompiled.\\ + We loaded the signal plus the according status data and the parameters (see Algorithm~\ref{alg:load_bcidat}). + \begin{algorithm} + \begin{algorithmic} + \State [signal, states, params] = load\_bcidat('dataFile.dat'); + \end{algorithmic} + \caption{Usage of \texttt{load\_bcidat}} + \label{alg:load_bcidat} + \end{algorithm} + \subsubsection{Signal} + The signal is loaded as matrix of 41 channels (see Table~\ref{tab:channelNames}). All the values are integers %TODO: representing what? + and also can be loaded as floating point values representing microvolts. Since the representation should not make any difference when analyzing the spectrum we used the smaller representation %TODO: check + \begin{table} + \centering + \begin{tabular}{r|c|l} + Number & Name & Meaning\\\hline + 1 & Fp1&cf. Figure~\ref{fig:10-20}\\ + 2&Fp2&cf. Figure~\ref{fig:10-20}\\ + 3&F7&cf. Figure~\ref{fig:10-20}\\ + 4&F3&cf. Figure~\ref{fig:10-20}\\ + 5&Fz&cf. Figure~\ref{fig:10-20}\\ + 6&F4&cf. Figure~\ref{fig:10-20}\\ + 7&F8&cf. Figure~\ref{fig:10-20}\\ + 8&FC5&cf. Figure~\ref{fig:10-20}\\ + 9&FC1&cf. Figure~\ref{fig:10-20}\\ + 10&FC2&cf. Figure~\ref{fig:10-20}\\ + 11&FC6&cf. Figure~\ref{fig:10-20}\\ + 12&T7&cf. Figure~\ref{fig:10-20}\\ + 13&C3&cf. Figure~\ref{fig:10-20}\\ + 14&Cz&cf. Figure~\ref{fig:10-20}\\ + 15&C4&cf. Figure~\ref{fig:10-20}\\ + 16&T8&cf. Figure~\ref{fig:10-20}\\ + 17&TP9&cf. Figure~\ref{fig:10-20}\\ + 18&CP5&cf. Figure~\ref{fig:10-20}\\ + 19&CP1&cf. Figure~\ref{fig:10-20}\\ + 20&CP2&cf. Figure~\ref{fig:10-20}\\ + 21&CP6&cf. Figure~\ref{fig:10-20}\\ + 22&TP10&cf. Figure~\ref{fig:10-20}\\ + 23&P7&cf. Figure~\ref{fig:10-20}\\ + 24&P3&cf. Figure~\ref{fig:10-20}\\ + 25&Pz&cf. Figure~\ref{fig:10-20}\\ + 26&P4&cf. Figure~\ref{fig:10-20}\\ + 27&P8&cf. Figure~\ref{fig:10-20}\\ + 28&PO9&cf. Figure~\ref{fig:10-20}\\ + 29&O1&cf. Figure~\ref{fig:10-20}\\ + 30&Oz&cf. Figure~\ref{fig:10-20}\\ + 31&O2&cf. Figure~\ref{fig:10-20}\\ + 32&PO10&cf. Figure~\ref{fig:10-20}\\ + 33&AbdPolLo& abductor pollicis longis\\ + 34&Biceps& long head of the biceps\\ + 35&Triceps& the external head of triceps\\ + 36&FrontDelt& anterior portion of deltoid\\ + 37&MidDelt& lateral portion of deltoid\\ + 38&BackDelt& posterior portion of deltoid,\\ + && teres minor and infraespinatusmuscles\\ + 39&HEOG&\textit{not used}\\ + 40&Synchro& Synchronization trigger for kinematic recording\\ + 41&Zero& Zero reference\\ + \end{tabular} + \caption{Channelnumbers and -names} + \label{tab:channelNames} + \end{table} + \subsubsection{States} + The main information contained by the \texttt{states} \matlab{}\texttt{-struct} is the currently presented stimulus. The \texttt{struct} has same length as the signal so that for every entry in the signal there is corresponding state information.\\ + There were some adjustments necessary since it did not match the movements (cf. Section~\ref{sec:newClass}). + \subsubsection{Parameters} + All the settings from the BCI2000 recording are saved in and loaded from the \texttt{parameters}.\\ + Examples are the names of the channels, the random seed for BCI2000 and the sounds, meaning and duration for different stimuli. + \subsection{Cut Data} + diff --git a/text/thesis/mylit.bib b/text/thesis/mylit.bib index 653cf17..95ff6bc 100755 --- a/text/thesis/mylit.bib +++ b/text/thesis/mylit.bib @@ -202,6 +202,14 @@ journal = "Philosophical Magazine", volume = "2" } +@article{Schalk04, + author = "Gerwin Schalk and Dennis J. McFarland and Thilo Hinterberger and Niels Birbaumer and Jonathan R. Wolpaw", + title = "BCI2000: A General-Purpose Brain-Computer Interface (BCI) System", + year = "2004", + journal = "IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING", + volume = "51", + pages = "1034-1043" +} %not cited @article{Morasso92,