There's an episode in Red Dwarf series 6 — "Gunmen of the Apocalypse" — in which Lister, Rimmer and the Cat watch Kryten's dream battle, as he lays hooked up to a TV screen.
It seems as though this technology may not exist purely in the realm of science fiction — and is not that far away.
A team of scientists at the University of California, Berkeley, has used a combination of brain imaging and computer simulation to create a visual reconstruction of the brain activity of people watching film trailers.
At this point, the technology can only reconstruct images that the subject has already viewed, but the potential applications are incredible. Eventually, the team hopes to be able to find a way to show native thoughts, dreams and memories.
This would allow us to figure out what happens, for example, in the minds of coma patients and stroke victims, as well as those with neurodegenerative diseases, opening up a means of communication.
It could also be a step towards controlling a computer interface simply by thinking about it.
"This is a major leap toward reconstructing internal imagery," said Professor Jack Gallant, a UC Berkeley neuroscientist and co-author of the study. "We are opening a window into the movies in our minds."
However, they were also careful to point out that any technology that allows us to read each other's thoughts and intentions is at least decades away.
The study was conducted on three of the scientists, whose brain patterns were analysed using functional Magnetic Resonance Imaging (fMRI), which measured the flow of blood through the visual cortex. A 3D model of the brain, constructed of small cubes called "voxels", allowed the computer to learn what parts of the brain corresponded with visual patterns.
The team then tested the computer's algorithm using a second set of clips.
The results are stunning. You can check it out in the video below; the image on the left is the clip viewed, while the image on the right shows the computer's reconstruction.
The study was authored by Shinji Nishimoto, An T Vu, Thomas Naselaris, Yuval Benjamini, Bin Yu and Jack L Gallant, and you can view more details at the Gallant Lab website.