Magnetic resonance imaging, or MRI, is a non-invasive medical imaging technique. It is used primarily for imaging soft tissues such as the brain, spinal cord, and abdominal organs.
MRI works by placing your body in a strong magnetic field. As a result of this external field, the magnetic moments of Hydrogen atoms in your body (think of them as little bar magnets) tend to align with each other. This alignment produces a net magnetisation which can be measured and used to create images.
The net magnetisation is measured by first applying a radio-wave to the body. This causes the magnetisation to tip partly into a plane that is perpendicular to the external magnetic field.
Once this is complete, the magnetisation begins to precess about the external field, much like a spinning top as it begins to slow. This rotating magnetisation can be measured by placing a coil of wire next to the body, which acts as an antenna and picks up the signal.