Over the last few years there have been huge advances in techniques for mapping brain activity and then correlating that activity with what people perceive from the world outside their brains (through sight, sound, smell, and touch) and even what they are thinking about (what goes on "in" their brains).
To get an idea of where the science of "brain decoding" has got to and where it's heading you should take a look at the work being done by Professor Jack Gallant's laboratory at the University of California, Berkeley.
Professor Gallant's work is mostly based on functional magnetic resonance imaging (fMRI) which detects changes in blood oxygenation within the brain, a technique called blood oxygenation level dependent (BOLD).
The way fMRI BOLD imaging works is to generate a powerful magnetic field (about 50,000 times greater than the earth's natural field) within someone's brain which causes the hydrogen nuclei in the water in the brain tissues to align. As every hydrogen nucleus has a magnetic north and south pole when millions of nuclei align with the external field they in turn create a magnetic field that can be measured. By cunning manipulation of the magnetic fields 3D images with a resolution of 30 to 40 fps and a voxel (volume pixel) size of 3mm by 3mm by 3mm can be created.
Now if the brain was just an homogenous bag of water this would not be very interesting as you'd get the same signal from every voxel but real brains are made up of of lots of other chemicals. Hemoglobin in particular has magnetic properties that change when it's oxygenated and the degree of oxygenation is related to the level of neural activity.
So, given that we can image the level of brain neural activity at a high enough rate and fine enough spatial resolution to see more-or-less real time changes in neural activity what can we see?
This is what Professor Gallant has been working on and his methodology consists of showing subjects in an MRI machine a series of images as their neural activity is recorded then using software to correlate the observed spatial and temporal distribution of neural activity with the images. Voila! Mind reading. Well, sort of.
Obviously there's a huge difference between decoding of neural activity and truly knowing what is going on in someone's brain but the implications and potential of brain decoding are, to say the least, thought provoking.
On the Gallant Lab web site you can find the Brain Viewer, an amazing visualization tool that provides two views: Attention during natural vision warps semantic representation across the human brain and A continuous semantic space describes the representation of thousands of object and action categories across the human brain. The latter "shows how information about thousands of object and action categories is represented across human neocortex. The data come from brain activity measurements made using fMRI while a participant watched hours of movie trailers. Computational modeling procedures were used to determine how 1705 distinct object and action categories are represented in the brain."
The Gallant Labs Brain Viewer showing the "semantic space" of a subject's brain
Both of these amazing visualizations are very high tech and made possible by the use of WebGL ("a cross-platform, royalty-free web standard for a low-level 3D graphics API based on OpenGL ES 2.0, exposed through the HTML5 Canvas element as Document Object Model interfaces").
For more on the Gallant Lab research see Nature's Brain decoding: Reading minds.