"The patients were repeatedly asked to imagine playing tennis or walking around their home. In healthy volunteers each produces a distinct pattern of activity, in the premotor cortex for the first task and the parahippocampal gyrus for the second. It allowed the researchers to put a series of yes or no questions to severely brain-injured patients. A minority were able to answer by using the power of thought."
So, I imagine they could say "To answer YES, imagine playing tennis. To answer NO, imagine walking around your home". Then they could ask yes/no questions and monitor the patterns of brain activity.