Magnetic resonance imaging (MRI) of the head is done to: 1  Look for the cause of headaches. 2  Help diagnose a stroke or blood vessel problems in the head.3  Problems with blood vessels may include an aneurysm or abnormal twisted blood vessels that are present at birth (this is called an arteriovenous [AV] malformation). Check the eyes, the nerves from the eyes to the brain (optic nerves), the ears, and the nerves from the ears to the brain (auditory nerves). 2  Look for problems of the pituitary gland. 3  Investigate or follow a finding seen on another test.