July 29, 2003


Electroencephalography (EEG) is a well-established method for studying human brain activity. Based on voltage fluctuations across the scalp, it is a fundamental tool in disciplines such as neurology, psychiatry, psychology and pharmacology. Hans Berger in 1929, using string galvanometers, reported the first human EEG recordings and showed that changes in the fluctuations were related to changes in cognitive state [1]. Two years later, Berger replicated his results using electronic amplifiers and a special oscillograph from the Carl Zeiss Foundation [2]. Since then, EEG has been based on electrodes and electronic amplifiers which require scalp abrasion and use of conductive paste or gel [3].

While tolerable when the recordings are short and infrequent, abrasion and conductive paste become a hindrance when long or frequent recordings are desired. Over time, the conductive paste can dry, requiring reapplication, or skin can regrow, necessitating re-abrasion. Frequent abrasion can cause irritation or even infection. Finally, application and cleanup take time, adding to the cost of frequent sessions. Recently, two groups [4,5] have reported on EEG sensors requiring neither abrasion nor conductive paste. The suitability of such sensors remains controversial. In this dissertation, I propose and evaluate a number of tests to fully characterize such ďdryĒ sensors.

Liverpool surgeon Richard Caton discovered electrical activity in the brain in 1875. Using Lord Kelvinís reflecting galvanometer, he probed the exposed cortex of rabbit and monkeys and reported suppressed fluctuations in response to the interruption of light incident on the animalsí eyes. His discovery was to sit quietly until 1890, when Polish psychologist Adolf Beck independently replicated Catonís work. By 1912, using Willem Einthovenís string galvanometer [6], Russian physiologist Pravdich-Neminski had produced a skull-intact photographic record of electrical activity in dogs which he called an electrocerebrogram. Berger, who had unsuccessfully initiated his research using a capillary electrometer , made the first skull-intact recordings from humans in 1924 using a modified string galvanometer [7]. For these recordings he coined the term elektroenkephalogramm from which we get our more modern electroencephalogram. Ten years later, Adrains and Matthews cemented Bergerís claims by duplicating his results using copper gauze electrodes in saline-soaked lint [2,8,9].
Nearly forty years elapsed between the first electrocardiogram [10] and Bergerís electroencephalogram, and another decade for EEG to be completely accepted. Why? To measure electrical activity from the brain non-invasively, it was necessary to have microvolt sensitivity, while electrocardiography (ECG) required only millivolt sensitivity. This thousand-fold difference meant that Berger had to not only improve the sensitivity of his string galvanometer, but also to consider electrochemical noise and the impedance of his electrodes. Sterilized zinc-plated needles were used for his first human studies. Later, he used thin lead-foil electrodes wrapped in flannel saturated with a 20% sodium-chloride solution [7]. Conventional electrodes today are in principle based on Bergerís original metal-foil electrodes.

To be completely accurate, EEG measures not the electrical activity in the brain, but the resulting fluctuations in electric potential at the scalp. It has been shown that these fluctuations can be used to study brain processes in-vitro, but what exactly causes these fluctuations? Some would argue that it is the net effect of the human brainís 20-100 billion neurons firing at different times. Others have proposed instead that it is the result of ionic currents flowing in the brain. Or, it may be that we are observing in EEG a field which carries information from location-to-location. If it were possible, one potential solution to this question would be to start measuring at the single cell level, working up to the scalp level, to see how the electrical field changes. If the recording instrument had a high enough bandwidth, one would be able to observe and simulate the summation of fields from neurons firing. Deviations from the simulations would indicate if other processes needed to be taken account of. The difficulty in this experiment is that the tools used to measure at the single cell level differ greatly from EEG. In EEG, one typically considers microvolt-level signals between 0.1 and 100 Hz, whereas in single cell recordings, hundreds of millivolts are the norm at thousands of hertz.

The modern brain researcher has at his disposal a wide array of non-invasive instruments including EEG, magnetoencephalography (MEG), functional magnetic resonance imaging (fMRI), positron emission tomography (PET) and computed tomography (CT). It is important to understand how EEG fits in. While fMRI, PET and CT have excellent spatial resolution, they have poor temporal resolution Ė on the order of seconds. Incidentally, PET involves ingesting radioactive compounds and CT entails exposure to harmful radiation, so their suitability for non-clinical research is limited. EEG, and its relative, MEG, have comparatively poorer spatial resolution, but have temporal resolution on the order of milliseconds. MEG has some theoretical advantages, such as improved localization, however, the cost of installation and maintenance can be orders of magnitude greater than EEG. For these reasons, cognitive studies tend to based on either fMRI or EEG, or, more recently, both. EEG is the tool of choice when the aspect of interest is temporal in nature. Two notable examples, both scrutinized by Berger, are brain wave rhythms and the wave patterns associated with epileptic seizures.

Bergerís original intent was to obtain objective brain measurements on psychic phenomena such as telepathy. Though in his lifetime he failed to do so, along the way he revolutionized brain research. After nearly 80 years, EEG remains the primary method for diagnosing epilepsy, analyzing sleep disorder, assessing brain damage after a stroke, monitoring levels of consciousness in response to anesthesia and investigating brain death. Cognitive psychologists continue to use it to study memory, attentional and language processing. There has been a growing movement to treat disorders such as attention deficit disorder and depression using EEG-based biofeedback instead of medication. And, with the reduced cost and increased availability of computing power, and data storage, researchers increasingly interested in brain-computer interfaces based on the recognition of EEG patterns.

Our interest in improving EEG acquisition is an extension of successes we have had in the recognition of the brain wave representations of language [11-15]. A hybrid of cognitive psychology and machine learning, our work has been enabled not just by advances in computer hardware, but in particular by the quantity of data collected. While many in psychology continue to average across subjects, we have focused increasingly on individuals. However, because of waning interest and mental fatigue, it is often infeasible to run subjects beyond several hours. In addition, as discussed earlier, the necessity of scalp abrasion and application of a conductive paste severely limit the number and frequency of recording sessions. In order to continue supporting our analysis with data, it was necessary to consider alternatives to conventional EEG.

[1] H. Berger, "‹ber das elektroenkephalogramm des menschen," Archiv fŁr Psychiatrie und Nervenkrankheiten, vol. 87, pp. 527-570, 1929.
[2] "EEG - ElectroEncephaloGraph," Biocybernaut Institute, [Online document], 2000, [cited 25 July 2003]. Available: http://biocybernaut.com/tutorial/eeg.html.
[3] T. W. Picton, S. Bentin, P. Berg, E. Donchin, S. A. Hillyard, R. Johnson, Jr., G. A. Miller, W. Ritter, D. S. Ruchkin, M. D. Rugg, and M. J. Taylor, "Guidelines for using human event-related potentials to study cognition: recording standards and publication criteria," Psychophysiology, vol. 37, no. 2, pp. 127-152, 2000.
[4] B. Alizadeh-Taheri, R. L. Smith, and R. T. Knight, "An active, microfabricated, scalp electrode array for EEG recording," Sensors and Actuators A, vol. 54, pp. 606-611, 1996.
[5] C. J. Harland, T. D. Clark, and R. J. Prance, "Remote detection of human electroencephalograms using ultrahigh input impedance electric potential sensors," Applied Physics Letters, vol. 81, no. 17, pp. 3284-3286, 2002.
[6] W. Einthoven, "The string galvanometer and the measurement
of the action currents of the heart," Nobel Lecture, [Online document], 1925, [cited 30 July 2003]. Available: http://www.nobel.se/medicine/laureates/1924/einthoven-lecture.pdf.
[7] R. W. Thatcher, Functional neuroimaging : technical foundations. San Diego: Academic Press, 1994.
[8] O. D. Enersen, "Hans Berger," Who Named It?, [Online document], 2001, [cited 30 July 2003]. Available: http://www.whonamedit.com/doctor.cfm/845.html.
[9] J. D. Bronzino, "Principles of Electroencephalography," in The biomedical engineering handbook, J. D. Bronzino, Ed., 2nd ed. Boca Raton, FL: CRC Press, 2000.
[10] A. D. Waller, "A deomnstration on man of electromotive changes accompanying the heart's beat.," J. Physiol. (London), vol. 8, pp. 229-234, 1887.
[11] P. Suppes, Z. L. Lu, and B. Han, "Brain wave recognition of words," Proc Natl Acad Sci U S A, vol. 94, no. 26, pp. 14965-9, 1997.
[12] P. Suppes, B. Han, and Z. L. Lu, "Brain-wave recognition of sentences," Proc Natl Acad Sci U S A, vol. 95, no. 26, pp. 15861-6, 1998.
[13] P. Suppes, B. Han, J. Epelboim, and Z. L. Lu, "Invariance between subjects of brain wave representations of language," Proc Natl Acad Sci U S A, vol. 96, no. 22, pp. 12953-8, 1999.
[14] P. Suppes, B. Han, J. Epelboim, and Z. L. Lu, "Invariance of brain-wave representations of simple visual images and their names," Proc Natl Acad Sci U S A, vol. 96, no. 25, pp. 14658-63, 1999.
[15] P. Suppes and B. Han, "Brain-wave representation of words by superposition of a few sine waves," Proc Natl Acad Sci U S A, vol. 97, no. 15, pp. 8738-43, 2000.

Posted by torque at 3:43 PM | Comments (1) | TrackBack

July 28, 2003

Knowing the Brain

I found an interesting article on information processing in the brain by Vadim Gerasimov. A summary follows.

Posted by torque at 2:03 PM | Comments (0) | TrackBack

July 24, 2003

Installing Apache on Linux

Typical problems:

  • The file index.php does not load on entry - make sure that DirectoryIndex has index.php in it
  • Cannot look at user directory - make sure to chmod 755 /home/user

Posted by torque at 1:06 PM | Comments (0) | TrackBack

July 23, 2003

Why Minimize Interelectrode Impedance?

In conventional electroencephalography (EEG), scalp abrasion and application of a conductive paste are unavoidable for quality recording [1]. These are needed primarily to minimize the electrode-scalp impedance, which, in turn, addresses the finite input impedance of the EEG amplifier. The electrode-scalp impedance is estimated by measuring the interelectrode impedance. This quantity informs the EEG technician whether there has been sufficient abrasion at a particular site. Here, I discuss in detail the theory behind the current methodology and explore alternative means of insuring quality recording.

To measure the interelectrode impedance, a low frequency, limited current source is connected across two electrodes. By recording the voltage across the two electrodes, the impedance between the two points is deduced by Ampere's law. This interelectrode impedance serves as an indirect measurement the electrode-scalp impedance since it includes the contact impedances for two electrode-scalp contacts, two layers of epidermis, and the tissue in-between. Tissue impedance can be ignored, since it is highly conductive and contributes little to the interelectrode impedance.

Experts recommend that (1) the interelectrode impedance be less than the input impedance of the amplifier by at least a factor of 100, (2) the interelectrode impedance be reduced to less than 10 kΩ as measured at the frequencies of interest (e.g., 10 Hz), and (3) when skin potentials are of concern, that is, the frequencies of interest are below 0.1 Hz, the interelectrode impedance be reduced below 2 kΩ by puncturing the skin with a needle or lancet [1]. In this case, the technician is advised to abrade until a drop of blood is seen!

The latter recommendation addresses a secondary concern linked not with the impedance of the electrode-scalp contact but the epidermis itself. Underlying the surface of the skin are ions which distribute themselves in a way that generates a voltage. This voltage can fluctuate when pores open due to heat or arousal, or when varying pressure on the skin causes the ions to redistributed.

Skin Impedance

[1] T. W. Picton, S. Bentin, P. Berg, E. Donchin, S. A. Hillyard, R. Johnson, Jr., G. A. Miller, W. Ritter, D. S. Ruchkin, M. D. Rugg, and M. J. Taylor, "Guidelines for using human event-related potentials to study cognition: recording standards and publication criteria," Psychophysiology, vol. 37, no. 2, pp. 127-52., 2000.

Posted by torque at 5:21 PM | Comments (0) | TrackBack

Google Page Rank

If you are interested in Google PageRank, this is an interesting site. Apparently PageRank files can be requested in text directly from Google. Hmm, actually, it doesn't work. I get

Your client does not have permission to get URL /search?client=navclient-auto&ch=0123456789&features=Rank&q=info:http://www.stanford.edu/ from this server.(Client IP address:

Oh wait, I see, it's because I need to have a right ch=..... This is the checksum. Hmmm. Here's more info.

Posted by torque at 11:35 AM | Comments (0) | TrackBack

Speech Synthesis

I found an interesting page comparing speech synthesis packages this morning. I think the AT&T Natural Voices package sounds the best, but I don't think their API is publically available. Microsoft's is though.

Posted by torque at 10:02 AM | Comments (0) | TrackBack

July 22, 2003

High Impedance Electrode Techniques

This entry summarizes important points from the James Roman article discussing the NASA spray-on electrodes.

James Roman in [1] describes, in particular, the electronic techniques used in NASA's spray-on dry electrode [2]. The last point in the introduction is most important, that the "acceptance of high impedance allows the use of small, or dry, electrodes." These electrodes were designed for electrocardiography and impedance pneumography.

The Requirement
The spray-on electrodes were tested at the USAF Aerospace Research Pilot School at Edwards Air Force Base in California. The requirements for the project were quite stringent, and serve as a good reference for dry EEG. They were as follows:

  1. Neither the electrodes nor the electrode wire should be felt by the subject.
  2. Electrodes must be resistant to motion artifact.
  3. Skin irritation must not result from frequent application of the electrodes.
  4. Shaving must not be a part of the procedure of applyign electrodes.
  5. Application of an electrode should take less than 30 seconds.

The NASA Flight Research Center Electrode
Summarized earlier, the NASA spray-on electrode consists of a layer of conductive glue applied by a spray gun or aerosol package. The site is prepared in 3 seconds using an oscillating toothbrush saturated in electrode paste. A thin, non-shielded wire is captured in the glue during application. Finally, an insulating glue is sprayed over the electrode. The final electrode is approximately twenty-thousandths of an inch thick and three-fourths of an inch in diamater.

Impressively, these sensors were tested for over 700 hours in-flight, and 500 hours on the ground over hundreds of patients with no cases of skin irritation, folliculitis, or contact dermatitis. Roman claims that the tracings obtained were either equal or superior to those obtained with more conventional electrodes but does not provide hard analysis for this.

The electrodes are said the require ampliifiers with input impedance in excess of 2 MΩ. This seems quite low, though at the time it was considered quite high. At lower values of input impedance there was increased attenuation of lower-ferquency components. Roman claims that at 100,000 Ω distorition was "barely detectable without a comparison record". This comparison was made using signal averaging - though the number of signals used was not reported. Why would they have low frequency attenuation with insufficient input impedance? There must be a high-pass filter being implmented. And there is. There must be a capacitor between the electrode and the amplifier which acts as a high-pass filter. At low frequencies, the impedance of this capacitor is very large. If the input impedance is too low, most of the voltage drop occurs through this capacitor so we see that the low-frequencies will be attenuated. This is a good lesson.

Electrical Characteristics of Electrodes
The NASA dry-electrodes were speced to operate between 0.1 to 100 Hz. This is exactly what we are looking for in the dry EEG sensors. The model used for the skin-electrode combination was a parallel RC. Using this, Roman computed the change in gain over frequency for a given input impedance. He found that there were two plateaus. The model has two plateaus for the following reason: at low frequencies, the capacitor is effectively open, so the resistor R forms the voltage divider with the input impedance. At high frequencies, the capacitor acts like a short, and there is no voltage divider, so the gain is 1. These are the two plateaus. As long as the resistor R is small compared with the input impedance, the difference in level for the two plateaus will be minimal. This, in fact, is the traditional approach. One could argue that if you knew a priori what the values would be you could just correct it in software.

"The resistive component of an electrode is a function primarily of skin preparation and only secondarily of electrode size." The electrode paste under the dry electrode cuts the resistive component of the electrode impedance in half whether the thin film is dry or still wet. As the film is drying, resistance for the first hour is higher than right when the spray is applied. After one hour, this difference disappears. Electrodes with different types of conductive paste show similar capacitance but different resistance. With "vigorous preparation", Roman and his collaborators were able to obtain resistive components of less than 1 kΩ with electrodes 1/8 inch or less in diameter. They gave some important caveats. For instance, "variation between subjects for similar electrodes applied by similar techniques can easily be of the order of 500 percent." Also, as we already know, the location also is a factor in resistance.

For the spray electrodes, "parallel capacitance appears to be primarily a function of electrode size... and is liniearly related to electrode area." This is good to know. Skin preparation played a secondary role in determining capacitance.

Partially addressing a concern that I have had, Roman found that the distance between the electrodes had little effect on the parallel RC. He gives typical RC values for the electrodes in Table I, which I replicate below. Unfortunately, no details were given as to the dimensions of the electrodes.

Small Plastic CupConductive Spray
(electrolyte base)
Conductive Spray
(no electrolyte base)
R (Ω)C (μF)R (Ω)C (μF)R (Ω)C (μF)

The last section discusses motion artifacts. Roman admits that "it is not known how the circuit parameters associated with electrodes operate to produce motion artifact." I suspect that this has to do with the skin potential effect. As the skin gets squeezed down, ions flow and there is a momentary disruption and recovery which causes the artifact. They found that electrodes which are more rigid show less artifact. Direct tapping would cause an artifact, however, having a plastic shield avoided this. They did conclude that change in impedance due to skin or electrode distortion was not responsible since using different shunt resistances did not alter the ratio of artifact amplitude to signal amplitude. Thus the artifact must be some sort of low source impedance ac generator.

[1] J. Roman, Flight Research Program III - High-Impedance Electrode Techniques, Nasa Technical Note D-3414 Supplement, National Aeronautics and Space Administration, Washington, D.C., June 1966. Preprint of article published in Aerospace Medicine, August 1966.
[2] C. W. Patten, F. B. Ramme, J. Roman, Dry Electrodes for Physiological Monitoring, Nasa Technical Note NASA TN D-3414, National Aeronautics and Space Administration, Washington, D.C., May 1966.

Posted by torque at 12:52 PM | Comments (4) | TrackBack

July 15, 2003


I'm trying to get Linkpoint working. Having problems that I'm trying to figure out - getting closer. Big clue.

Update: It turned out to be a problem with PHP Curl, which for whatever reason was not supporting authentication based on SSL certificates. When I used the command line version of Curl everything went fine. The Linkpoint PHP module is available and is a good set of code to study if you are interested in how credit card authorization is done from a webmaster perspective. At the end, I simply chose the command line version, which is an option in the module.

Posted by torque at 12:46 AM | Comments (0) | TrackBack

July 12, 2003


Nasty... the other day I ran across a site that automatically sets your home page, without permissions! Naturally it piqued my interest, and after repeated telneting, I finally found the source of the problem... well, almost. It turns out that the source was an 'encoded' Javascript. Thanks to microsoft, there is a handy little command which 'encodes' (not encrypts) your ASP/VBScript/Javascript code. I found a good tutorial here on attempting to break the code. Here's what the code looked like:

[SCRIPT language=JScript.Encode]#@~^RwAAAA==@&9W^!:xYcVK^lDkGxct.n6'J4OYa)zJdn68FyR^Wh&^tG/Ddz1W;UDRw42Ql^m{qyJI@&0hcAAA==^#~@[/SCRIPT]
Nicely, mrbrownstone has done all the work. Behold, the Win32 command line executable: srcdec14.exe and source code (for Unix): srcdec14.c. Hmm, I tried it, but it keeps giving checksum errors. On mrbrownstone's page I found a link to Soya's Java version. Which also doesn't give intelligible answers. Here's another super html decoder page.
Posted by torque at 12:00 PM | Comments (8) | TrackBack

July 8, 2003

Papers papers

We need to publish. My first paper will be on the the dry recordings I made using the CS5532, called "Characterization of Voltage Noise in Dry EEG Sensors". It will be a short paper, first outlining issues with the typical noise measurement (spectrum), and discussing tools that are useful, and issues with the tools. Finally, it will present some results.

Posted by torque at 10:36 AM | Comments (1) | TrackBack

July 3, 2003

WMServer mod



Installing cryptopp-php
There are a few tips besides the ones in the documentation that will help. First of all, because you will be compiling a php library, you'll need to have the php source code headers. You can find the latest stable version here. First, compile the Crypto++ workspace according to the instructions above. Now, open up the cryptopp.dsw. Under Tools->Options->Directories->Include files, add the 'main' directory from the php source code. You need this to access php.h. In the same place, add the directory for Crypto++ containing hex.h. Finally, if you followed the directions above, you would have, under Tools->Options->Directories->Library files, added the Crypto++ RELEASE directory. I should write something to put this all together. Still after that, you need to have php4ts.lib. Fortunately, you don't have to recompile PHP, it can be found in the main directory of your PHP install. Add that to Tools->Options->Directories->Library. Once you do this, you will be able to compile... albeit with a lot of warnings. I got 2343!!

Posted by torque at 12:33 PM | Comments (0) | TrackBack

July 1, 2003


To install Curl with PHP you need to uncomment the curl line in php.ini, make sure the extensions directory is pointed correctly, and copy two files, libeay32.dll and sseay32.dll from the dlls directory in your php directory to the windows/system32 directory. Then it'll work.

Posted by torque at 3:56 PM | Comments (0) | TrackBack