Physics of Magnetic Resonance Imaging
The body is largely composed of water molecules. Each water molecule has two hydrogen nuclei or protons. When a person goes inside the powerful magnetic field of the scanner, the magnetic moments (the measure of its tendency to align with a magnetic field) of some of these protons changes, and aligns with the direction of the field.

In a magnetic resonance imaging (MRI) machine a radio frequency (Rf) transmitter is briefly turned on, producing an electromagnetic field. The photons of this field have just the right energy, known as the resonance frequency, to flip the spin of the aligned protons in the body. As the intensity and duration of application of the field increase, more aligned spins are affected. After the field is turned off, the protons decay to the original spin-down state and the difference in energy between the two states is released as a photon. It's these photons that produce the electromagnetic signal that the scanner detects. The frequency the protons resonate at depends on the strength of the magnetic field. As a result of conservation of energy, this also dictates the frequency of the released photons. The photons released when the field is removed have an energy, and therefore a frequency, due to the amount of energy the protons absorbed while the field was active.

It's this relationship between field-strength and frequency that allows the use of nuclear magnetic resonance for imaging. Additional magnetic fields are applied during the scan to make the magnetic field strength depend on the position within the patient, in turn making the frequency of the released photons dependent on position in a predictable manner.

Position information can then be recovered from the resulting signal by the use of a Fourier transform. These fields are created by passing electric currents through specially-wound solenoids, known as gradient coils. Since these coils are within the bore of the scanner, there are large forces between them and the main field coils, producing most of the noise that is heard during operation. Without efforts to dampen this noise, it can approach 130 decibels (dB) with strong fields as discussed further down on acoustic noise.

An image can be constructed because the protons in different tissues return to their equilibrium state at different rates, which is a difference that can be detected. By changing the parameters on the scanner, this effect is used to create contrast between different types of body tissue or between other properties, as in diffusion MRI.

Contrast agents may be injected intravenously to enhance the appearance of blood vessels, tumors, or inflammation in the case of multiple sclerosis (MS). Contrast agents are typically used for MS patients to help determine if there is any active disease progression. Unlike computed tomography (CT), MRI uses no ionizing radiation and is generally a very safe procedure. Nonetheless the strong magnetic fields and radio pulses can affect metal implants, including cochlear implants and cardiac pacemakers. In the case of cardiac pacemakers, the results can sometimes be lethal, so patients with such implants are generally not eligible for MRI.

MRI is used to image every part of the body, and is particularly useful for tissues with many hydrogen nuclei and little density contrast, such as the brain, spinal cord, muscle, connective tissue and most tumors.

Safety

Death and injuries have occurred from projectiles created by the magnetic field, although few compared to the millions of examinations administered. MRI makes use of powerful magnetic fields that, though not known to cause direct biological damage, can interfere with metallic and electromechanical devices. Additional (small) risks are presented by the RF systems, components or elements of the MRI system's operation, elements of the scanning procedure and medications that may be administered to facilitate MRI imaging.

There are many steps that the MRI patient and referring physician can take to help reduce the remaining risks, including providing a full, accurate and thorough medical history to the MRI provider.

Implants and foreign bodies

Pacemakers are generally considered an absolute contraindication towards MRI scanning, though highly specialized protocols have been developed to permit scanning of select pacing devices. Several cases of arrhythmia or death have been reported in patients with pacemakers who have undergone MRI scanning without appropriate precautions. Other electronic implants have varying contraindications, depending upon scanner technology, and implant properties, scanning protocols and anatomy being imaged.

In the case of pacemakers, the risk is thought to be primarily RF induction in the pacing electrodes/wires causing inappropriate pacing of the heart, rather than the magnetic field affecting the pacemaker itself.

Ferromagnetic foreign bodies such as metal fragments, or metallic implants such as surgical prostheses and aneurysm clips are also potential risks, and safety aspects need to be considered on an individual basis. Interaction of the magnetic and radio frequency fields with such objects can lead to trauma due to movement of the object in the magnetic field, thermal injury from Rf induction heating of the object, or failure of an implanted device. These issues are especially problematic when dealing with the eye. Most MRI centers require an orbital x-ray to be performed on anyone suspected of having metal fragments in their eyes, something not uncommon in metalworking.

Because of its non-ferromagnetic nature and poor electrical conductivity, titanium and its alloys are useful for long term implants and surgical instruments intended for use in image-guided surgery. In particular, not only is titanium safe from movement from the magnetic field, but artifacts around the implant are less frequent and less severe than with more ferromagnetic materials such as stainless steel. Artifacts from metal frequently appear as regions of empty space around the implant that are frequently called a "black-hole artifact". For example, a 3 mm titanium alloy coronary stent may appear as a 5 mm diameter region of empty space on MRI, whereas around a stainless steel stent, the artifact may extend for 10–20 mm or more.

Acoustic noise

Switching of field gradients causes a change in the Lorentz force experienced by the gradient coils, producing minute expansions and contractions of the coil itself. As the switching is typically in the audible frequency range, the resulting vibration produces loud noises (clicking or beeping). This is most marked with high-field machines and rapid-imaging techniques in which sound intensity can reach 120 dB(A) (equivalent to a jet engine at take-off). As a reference, 120 dB is the threshold of loudness causing sensation in the human ear canal — tickling, and 140 dB is the threshold of ear pain. Since decibel is a logarithmic measurement, a 10 dB increase equates to a 10-fold increase in intensity — which, in acoustics, is roughly equal to a doubling of loudness.

The use of ear protection is essential for anyone inside the MRI scanner room during the examination.

Contrast agents

The most commonly used intravenous contrast agents are based on a chemical compound of Gadolinium (gd). In general, these agents have proved safer than the iodinated contrast agents used in X-ray radiography or CT. Anaphylactoid reactions are rare, occurring in approximately 0.03–0.1%. Of particular interest is the lower incidence of nephrotoxicity, compared with iodinated agents, when given at usual doses — this has made contrast-enhanced MRI scanning an option for patients with renal impairment, who would otherwise not be able to undergo contrast-enhancement.

Although Gadolinium agents have proved useful for patients with renal impairment, in patients with severe renal failure requiring dialysis there is a risk of a rare but serious illness, nephrogenic systemic fibrosis, that may be linked to the use of certain gadolinium-containing agents. The most frequently linked is gadodiamide, but other agents have been linked too. Although a causal link has not been definitively established, current guidelines in the United States are that dialysis patients should only receive gadolinium agents where essential, and that dialysis should be performed as soon as possible after the scan to remove the agent from the body promptly.

Pregnancy

No known effects of MRI on the fetus have been demonstrated. In particular, MRI avoids the use of ionizing radiation, to which the fetus is particularly sensitive. However, as a precaution, current guidelines recommend that pregnant women undergo MRI only when essential. This is particularly the case during the first trimester of pregnancy, as organogenesis takes place during this period. The concerns in pregnancy are the same as for MRI in general, but the fetus may be more sensitive to the effects. However, one additional concern is the use of contrast agents; gadolinium compounds are known to cross the placenta and enter the fetal bloodstream, and it's typically recommended that their use be avoided.

Despite these concerns, MRI is rapidly growing in importance as a way of diagnosing and monitoring congenital defects of the fetus because it can provide more diagnostic information than ultrasound and it lacks the ionizing radiation of CT.

Claustrophobia and discomfort

Due to the construction of some MRI scanners, they can be potentially unpleasant to lie in. Older models of closed bore MRI systems feature a fairly long tube or tunnel. The part of the body being imaged must lie at the center of the magnet, which is at the absolute center of the tunnel. Because scan times on these older scanners may be long (occasionally up an hour for the entire procedure), people with even mild claustrophobia are sometimes unable to tolerate an MRI scan without management. Modern scanners may have larger bores and scan times are shorter. This means that claustrophobia is less of an issue, and many patients now find MRI an innocuous and easily tolerated procedure.

Alternative scanner designs, such as open or upright systems, can also be helpful where these are available. Though open scanners have increased in popularity, they produce inferior scan quality because they operate at lower magnetic fields than closed scanners. However, commercial 1.5 tesla open systems have recently become available, providing much better image quality than previous lower field strength open models.