a, Example X-ray of a participant with bilateral implant of Activa PC + S DBS generators attached to depth leads in the ACC and paddle leads in the OFC (red highlights). b, Group localization of all electrode contacts in coronal (top) and sagittal (bottom) view. Blue shaded area is the ACC; yellow shaded area is OFC. Below are example raw LFP recordings from ACC (top) and OFC (bottom). c, Summary of the chronic pain-state decoding scheme for pain VAS using example data from one participant. Normalized power spectra are computed for each recording (ordered by increasing pain VAS (overlaid white circles) for display) and power values at each frequency are displayed across all recordings for an example participant. Above the color bar scale, a horizontal histogram of pain VAS shows the distribution of pain scores, which are split by the median value to define a dichotomous response variable (high (1) versus low (0) pain states). Average power values in frequency bands of interest serve as predictive features in two complementary decoding schemes. Power features sub-selected from either brain region or hemisphere are used to train models that decode high versus low pain states using LDA. d, Bar plots of decoding performance with successful pain-state prediction based on NRS for all participants using LDA. CP1–CP4 had n = 89, 137, 234 and 452 independent simultaneous recordings and pain score reports, respectively. One-sided empirical P values were calculated using permutation tests (n = 1,000; black dots), without correction for multiple comparisons (Methods) as reported in Supplementary Fig. 4 for all metrics and models. P values for NRS models in d from left to right are: CP1: 0.092, 0.801, 0.016; CP2: 0.001, 0.001, 0.001, 0.001, 0.001, 0.002, 0.001, 0.003, 0.777; CP3: 0.001, 0.005, 0.041, 0.001, 0.002, 0.027, 0.001, 0.001, 0.143; CP4: 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.612, 0.001. e, Normalized mean feature weights (importance) for each participant from full models (bilateral OFC/ACC) in d. (Note CP1 only has a unilateral implant. Contra, brain hemisphere contralateral to participants’ body side with chronic pain; ipsi, ipsilateral. ‡P < 0.05, *P < 0.01, †P < 0.001).