For their study, published on Thursday in the journal Science, the scientists focused on the visual cortex. That's the part of the mouse - and human - brain that processes information from the retina.
First, they inserted two genes into a number of the visual cortex's neurons in mice. One of these genes encoded a protein that would activate the neuron if hit with a pulse of infrared laser light. The other gene encoded a protein as well, this time one that glowed green whenever the neuron was active.
The scientists then removed part of each mouse's skull over the visual cortex and replaced it with a clear covering, essentially giving themselves a window into the animal's brain.
The scientists then displayed either a horizontal black bar or a vertical black bar on a screen with a white background and observed the mice's brains as they watched the images appear. This allowed them to determine which neurons in the brain responded to the horizontal bar and which responded to the vertical bar.
Next, they trained the animals to take a drink of water from a tube whenever they saw the vertical bar, but not when they saw the horizontal bar.
That was all essentially the preamble to the really exciting part of the study. The scientists then began to decrease the contrast between the black bars and the white background until the mice started having trouble knowing when to get a drink.
At that point, the team projected holograms onto and into the mice's brains through the window in their skulls. They did this using a device they developed specifically for their study that allowed them to control exactly which neurons the particles of light would hit.
Now, when the mice looked at the low-contrast images, they could tell whether they were seeing a vertical or horizontal bar - as long as the scientists zapped the neurons corresponding to the correct alignment at the same time.
Eventually, the scientists did away with the images altogether and found that the animals would take a drink whenever the team activated the vertical bar neurons, but not when they zapped the horizontal bar neurons.
In other words, the scientists seemed to be making the mice hallucinate the image of the bar.
"Not only is the animal doing the same thing, but the brain is, too," researcher Karl Deisseroth of Stanford University said in a press release. "So we know we're either recreating the natural perception or creating something a whole lot like it."
Perhaps the strangest part of the study is the fact that the researchers only needed to stimulate about 20 neurons to make the mice hallucinate - a surprise finding that raises questions about our own brains.
"A mouse brain has millions of neurons; a human brain has many billions," Deisseroth said. "If just 20 or so can create a perception, then why are we not hallucinating all the time, due to spurious random activity?"