Magnetic resonance imaging (MRI) is a medical imaging technique that uses powerful magnets and radio waves to create detailed images of the inside of the body. It relies on the principles of nuclear magnetic resonance, where atomic nuclei align with a magnetic field and emit signals when perturbed by radio waves.