A patient walks into the examining room and says, "Doctor, my back hurts and nothing works—except my Percocet." Now, the physician must decide: Is this pain for real?

Despite decades of research, doctors have few tools to measure pain objectively. Generally, they ask patients to rate it themselves from one to 10, or point to the cartoon face on the wall chart whose expression best matches how they feel.

"We...