This VI, created for undergraduate teaching-research at Lake Forest College, illustrates uses of LabVIEW functions for a cognitive neuroscience experiment. It includes parallel loops, visual stimulus presentation, uses of arrays to control stimulus presentation and collect behavioral data, and automatic fill-in of data filepaths and filenames (made unique and preventing accidental overwrite by incorporating date and time).
The main VI filename is Two doors risky choice & EEG DAQ SfN 2011.vi The additional file is a subvi, which calculates winnings after the main VI is finished, Array Value Associator.vi
The data acquisition loop, for two channels of EEG, is surrounded by a diagram disable structure, to allow the user to try out the cognitive/behavioral functions first. Be sure you understand good electrical safety practices before attempting to connect a human subject! I have used only low-voltage battery operated EEG amplifiers communicating via an NIDAQ USB device, with a laptop computer operating on battery power. (This also greatly reduces problems with 60 Hz interference.) We also take special care with cleanliness, and use sterile disposable electrodes to connect to subjects.
The abstract for this 2011 Society for Neuroscience presentation is published online:
on the annual meeting page. In previous years' poster presentations I have additionally explained our approach, and described other LabVIEW programs for cognitive neuroscience research. These are also available at the SfN website. For more information, please email me at:
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hi RBG,
This is a really interesting application and I'd love to try it out. I had been thinking about trying to create a similar VI but I have been a little scared off by the development of the precision external circuitry that's required in order to read the signals correctly. Would you be able to provide me with any of the resources that you used in development of the signal interface so that I could try to develop it for myself?
Also, you're probably the best person to ask; would you be able to recommend any textbooks which discuss the processing algorithms commonly used in EEG? It's a subject I've been really fascinated with for a while but really I've struggled to find a good place to get started.
- Alex.
Hi Alex,
It looks like I have to learn how to use this Community system well. I tried replying to you directly by email on Nov 10, but it seems not to have gone through. Copied below is my Nov 10 email and, following that, the first part of the paper I'd attached. I'd be happy to email the whole paper if you, or another community member, would like to see it. Regards, Bob (glassman@lakeforest.edu).
Thanks for the response, and please forgive this hurried reply.
Attached is a draft of a paper, which later became a PowerPoint presentation at a meeting in Dalian, China this past May. It gives more of an idea what we’ve been up to here. Most of the references are to my own stuff here, which may mainly be a distraction, but there are a few general EEG references. In addition, I just copied the following two from the Lippincott, Williams & Wilkins website. They’re not inexpensive(!), but I think worthwhile
Niedermeyer's Electroencephalography: Basic Principles, Clinical Applications, and Related Fields by Donald L. Schomer and Fernando Lopes da Silva (Dec 22, 2010)
Reading EEGs: A Practical Approach
Reading EEGs: A Practical Approach focuses on pattern recognition and pattern comparison. The concepts of pattern recognition are developed in a logical fashion based on appearance rather ... Author(s): L. John Greenfield Jr., MD, PhD,James D Geyer MD,Paul R Carney MD Publication Date: 2009
Our data analysis VI remains a work in progress, which keeps getting bigger and bigger – best I’ve been able to do so far, notwithstanding the good style advice that NI gives about how to keep things manageable. The basic idea is to use the time stamps from the behavioral events (e.g. of a person clicking on a Boolean, or when a stimulus appears) to “snip out” sections of the continuous EEG file recorded while the person carried out the task. A few years ago, Chris Hartley and I published an earlier version on the NI Community website, which I see is still listed, now alongside my new, neuroeconomics contribution. It uses an earlier version of LabVIEW (maybe 8.2), and I think we failed to mention it requires the Sound and Vibration toolkit. All this is limited by the timing precision of Windows – at best 1 ms, just about adequate for EEG if there’s not too much jitter. If I find time and money, and feel smart, one of these days I will try to learn to use an NI Real Time system.
We’ve been mainly doing things here on a very small budget, and much simpler than in most big EEG labs, with only two channels at a time so far. Recently, some companies have come out with what seem to be nice wireless systems. You might check out Cleveland Medical Devices (whose Bob Schmidt gave me helpful advice some years ago, as we tried out their BioRadio) and Astromed/Grass Instruments, but you’re then up in the range of about 10 or 20 kilobucks. As the attached draft paper suggests, I have hopes, nevertheless, that some of what we do here on a modest scale may be able to tap into important mind/brain properties.
Again, I apologize for being able to give only a hurried response now.
I’ll just sign off repeating the strong caution about electrical safety. If you’re a biomedical engineer, I apologize again for saying what’s obvious.
Let me know whether you have other questions, and how it goes.
FIRST PART OF THE PAPER I'D ATTACHED:
Portable system records and analyzes two EEG channels during choices: Technology at a small college
Robert Glassman, Boni Cui, Ryann Freeman, Alyssa Parr, & Alec Renner
Department of Psychology and Neuroscience Program
Lake Forest College
Lake Forest, Illinois 60045
USA
Brain waves: from 18th century conjectures to 21st century technologies
Rapid biomedical technological advances are deeply changing our understanding of mind and brain. What is conscious thought? How can brain matter possibly be its ground? Human beings have always had a rough grasp of mind-body relations - your heart rate accelerates with emotion, or you feel your face flushing. But today anyone can monitor brain activity – even your own. If we are thoughtful with this new power, we will reach better human understanding while solving important biomedical problems.
Electricity of the brain, and waves, are fascinating. In my own “faith commitment,” they concern something fundamental about the mind/brain relationship. Indeed, three centuries ago, Isaac Newton guessed that brain oscillations were the physical basis of mind! Newton was respected for his empirical conservatism, but in the final paragraph of his famous Principia, he indulged in a broad speculation. The modern science of electricity was barely beginning in 1723, when Newton commented, at the end of Principia’s third edition:
And now we might add something concerning a certain most subtle Spirit which pervades and lies hid in all gross bodies; by the force and action of which Spirit the particles of bodies mutually attract one another at near distances, and cohere, if contiguous; and electric bodies operate to greater distances, as well repelling as attracting the neighbouring corpuscles; …; and all sensation is excited, and the members of animal bodies move at the command of the will, namely by the vibrations of this Spirit, mutually propagated along the solid filaments of the nerves, from the outward organs of sense to the brain, and from the brain into the muscles. But these are things that cannot be explained in few words, nor are we furnished with that sufficiency of experiments which is required to do an accurate determination and demonstration of the laws by which this electric and elastic Spirit operates. (Principia, p. 443)
...
Hi Robert,
Thanks for all the information, I found it really informative. I'd really like to read the whole paper, if it's not too much trouble would you be able to E-Mail it here?
With all of your experience, it'd be great to see what you'd be capable of with a Real Time system. The methodology of programming remains relatively the same, however you just have to be conscious of the function of the processor to make sure you minimise as much decision making as possible to avoid increasing the amount of time spent in a particular thread. Real Time Operating Systems such as WindRiver VXWorks which is used on devices such as the Compact RIO still possesses this inherent 1kHz operating rate limit, however you're right in saying that the amount of jitter would be reduced enormously. If you wanted to reach higher acquisition speeds and maintain that same level of determinism (Low jitter) you could look at delegating this processing task to an FPGA to sample at enormously high rates, although I'm not sure how relevant this is to general EEG readings because I read that brainwaves only have maximum frequencies of around 10-20Hz.
Since reading your response I've ordered some electrodes. I'm no biochemical engineer but I'm thinking of implementing optical isolation to prevent these signals from ever getting to me!
I'm also going to see about renting one of these books out from my university library.
Thank you so much for your invaluable help.
- Alex.
RBG emailed the following earlier today to Alex T, with attachments:
Thanks for the good additional comments. You’ve upped my interest in real time systems, tho digging deeper for me has to wait till I’m prepared to teach my three spring courses (including one on developmental psychology that I haven’t taught in many years).
Attached is the NeuroTalk 2011 paper; also, a bunch of other things, some of which may be useful, some just a distraction. Among it is the approx. final syllabus for two of my courses. The “Mind & Brain” syllabus includes the following two references. I think the one by Thompson is particularly worth looking up, as a brief summary.
Helen Thompson (2010). Alpha, beta, gamma: the language of brainwaves. NewScientist 12 July 2010 (download).
Adam Keiper. The age of neuroelectronics. The New Atlantis, Winter 2006, pp 4-41 (free download)
The textbook listed in the Psyc 370 (Neuroscience & Behavior) course syllabus is also worth getting hold of for broader, fairly in-depth info about most brain topics.
A quick note about EEG frequencies: Up to about 20 or 30 Hz includes the traditionally studied alpha (ca. 9-13), beta (ca. 14-25 or 30), theta (4-7) and delta deep sleep waves (1-2 or 3 Hz). During the past decade or two there’s been a growing interest in so-called gamma EEG rhythms, variously estimated in the range of about 40-100 Hz, and even north of that. The most widespread theorizing about them is that they are involved in “binding” attributes of perceptions or concepts together, into coherent wholes, as synchronized (or, more generally, coherent) EEG rhythms distributed in different brain systems, during the moments of the perception. At the Society for Neuroscience meeting just past, in DC, many researchers are looking at these via fMRI imaging, and some with direct brain implants in epilepsy patients undergoing surgery. Some also seem to be successful in getting those higher frequencies in scalp recordings – which I’m also aiming at.
You might also find it interesting to look up the Society for Neuroscience website (www.sfn.org) for their Brain Facts, Brain Briefings, and other items. The approx. 16,000 abstracts of papers from this recent past annual meeting are also available there, tho will be a lot more “technical” than the public outreach publications.
If you think of it, let me know how it goes. Holler if you have other questions or thoughts. Good luck!