The electroencephalography-based test could improve patient pain assessments and reduce the over-prescription of opioids, the researchers say.