A team at Stanford University in California used computer learning software to sort through data generated by brain scans and detect when people were in pain.
"The question we were trying to answer was can we use neuroimaging to objectively detect whether a person is in a state of pain or not. The answer was yes," Dr. Sean Mackey of the Stanford University School of Medicine in California, whose study appears in the journal PLoS One.
Currently, doctors rely on patients to tell them whether or not they are in pain. And that is still the gold standard for assessing pain, Mackey said.
But some patients -- the very young, the very old, dementia patients or those who are not conscious -- cannot say if they are hurting, and that has led to a long search for some way to objectively measure pain.
"People have been looking for a pain detector for a very long time," Mackey said.
"We're hopeful we can eventually use this technology for better detection and better treatment of chronic pain."
For the study, Mackey's team used a linear support vector machine -- a computer algorithm invented in 1995 -- to classify patterns of brain activity and determine whether or not someone is experiencing pain.
To train the computer, eight volunteers underwent brain scans while they were touched first by an object that was hot, and then by one that was so hot it was painful.
The computer used data from these scans to recognize different brain activity patterns that occur when a person is detecting heat, and which ones detect pain.
In tests the computer was more than 80 percent accurate in detecting which brain scans were of people in pain, and it was just as accurate at ruling out those who were not in pain.
Mackey cautioned that the study was done in a very controlled lab environment, and it did not look at the differences between chronic and acute pain.
More than 100 million Americans suffer chronic pain, and treating them costs around $600 billion each year in medical expenses and lost productivity, the Institute of Medicine, one of the National Academy of Sciences, reported in June.
(Reporting by Julie Steenhuysen in Chicago; Editing by Cynthia Osterman)