Transcranial magnetic stimulation (magnetic stimulation of the brain) may also be done to study the function of the brain cortex (outer nervous tissue of the brain) and the effects of treatment on brain excitability.