# Physics of magnetic resonance imaging

Magnetic resonance imaging (MRI) is a medical imaging technique mostly used in radiology and nuclear medicine in order to investigate the anatomy and physiology of the body, and to detect pathologies including tumors, inflammation, neurological conditions such as stroke, disorders of muscles and joints, and abnormalities in the heart and blood vessels among other things. Contrast agents may be injected intravenously or into a joint to enhance the image and facilitate diagnosis. Unlike CT and X-ray, MRI uses no ionizing radiation and is, therefore, a safe procedure suitable for diagnosis in children and repeated runs. Patients with specific non-ferromagnetic metal implants, cochlear implants, and cardiac pacemakers nowadays may also have an MRI in spite of effects of the strong magnetic fields. This does not apply on older devices, and details for medical professionals are provided by the device's manufacturer.
Certain atomic nuclei are able to absorb and emit radio frequency energy when placed in an external magnetic field. In clinical and research MRI, hydrogen atoms are most often used to generate a detectable radio-frequency signal that is received by antennas close to the anatomy being examined. Hydrogen atoms are naturally abundant in people and other biological organisms, particularly in water and fat. For this reason, most MRI scans essentially map the location of water and fat in the body. Pulses of radio waves excite the nuclear spin energy transition, and magnetic field gradients localize the signal in space. By varying the parameters of the pulse sequence, different contrasts may be generated between tissues based on the relaxation properties of the hydrogen atoms therein.
When inside the magnetic field (B$_0$) of the scanner, the magnetic moments of the protons align to be either parallel or anti-parallel to the direction of the field. While each individual proton can only have one of two alignments, the collection of protons appear to behave as though they can have any alignment. Most protons align parallel to B$_0$ as this is a lower energy state. A radio frequency pulse is then applied, which can excite protons from parallel to anti-parallel alignment, only the latter are relevant to the rest of the discussion. In response to the force bringing them back to their equilibrium orientation, the protons undergo a rotating motion (precession), much like a spun wheel under the effect of gravity. The protons will return to the low energy state by the process of spin-lattice relaxation. This appears as a magnetic flux, which yields a changing voltage in the receiver coils to give a signal. The frequency at which a proton or group of protons in a voxel resonates depends on the strength of the local magnetic field around the proton or group of protons, a stronger field corresponds to a larger energy difference and higher frequency photons. By applying additional magnetic fields (gradients) that vary linearly over space, specific slices to be imaged can be selected, and an image is obtained by taking the 2-D Fourier transform of the spatial frequencies of the signal (k-space). Due to the magnetic Lorentz force from B$_0$ on the current flowing in the gradient coils, the gradient coils will try to move producing loud knocking sounds, for which patients require hearing protection.

## History

The MRI scanner was developed from 1975 to 1977 at the University of Nottingham by Prof Raymond Andrew FRS FRSE following from his research into nuclear magnetic resonance. The full body scanner was created in 1978.

## Nuclear magnetism

Subatomic particles have the quantum mechanical property of spin. Certain nuclei such as $^1$H (protons), $^2$H, $^3$He, $^{23}$Na or $^{31}$P, have a non–zero spin and therefore a magnetic moment. In the case of the so-called spin-1⁄2 nuclei, such as $^1$H, there are two spin states, sometimes referred to as up and down. Nuclei such as $^{12}$C have no unpaired neutrons or protons, and no net spin; however, the isotope $^{13}$C does.
When these spins are placed in a strong external magnetic field they precess around an axis along the direction of the field. Protons align in two energy eigenstates (the Zeeman effect): one low-energy and one high-energy, which are separated by a very small splitting energy.

### Resonance and relaxation

Quantum mechanics is required to accurately model the behaviour of a single proton. However, classical mechanics can be used to describe the behaviour of an ensemble of protons adequately. As with other spin $1/2$ particles, whenever the spin of a single proton is measured it can only have one of two results commonly called parallel and anti-parallel. When we discuss the state of a proton or protons we are referring to the wave function of that proton which is a linear combination of the parallel and anti-parallel states.
In the presence of the magnetic field, B$_0$, the protons will appear to precess at the Larmor frequency determined by the particle's gyro-magnetic ratio and the strength of the field. The static fields used most commonly in MRI cause precession which corresponds to a radiofrequency (RF) photon.
The net longitudinal magnetization in thermodynamic equilibrium is due to a tiny excess of protons in the lower energy state. This gives a net polarization that is parallel to the external field. Application of an RF pulse can tip this net polarization vector sideways (with, i.e., a so-called 90° pulse), or even reverse it (with a so-called 180° pulse). The protons will come into phase with the RF pulse and therefore each other.
The recovery of longitudinal magnetization is called longitudinal or T$_1$ relaxation and occurs exponentially with a time constant T$_1$. The loss of phase coherence in the transverse plane is called transverse or T$_2$ relaxation. T$_1$ is thus associated with the enthalpy of the spin system, or the number of nuclei with parallel versus anti-parallel spin. T$_2$ on the other hand is associated with the entropy of the system, or the number of nuclei in phase.
When the radio frequency pulse is turned off, the transverse vector component produces an oscillating magnetic field which induces a small current in the receiver coil. This signal is called the free induction decay (FID). In an idealized nuclear magnetic resonance experiment, the FID decays approximately exponentially with a time constant T$_2$. However, in practical MRI there are small differences in the static magnetic field at different spatial locations ("inhomogeneities") that cause the Larmor frequency to vary across the body. This creates destructive interference, which shortens the FID. The time constant for the observed decay of the FID is called the T$^*$ $_2$ relaxation time, and is always shorter than T$_2$. At the same time, the longitudinal magnetization starts to recover exponentially with a time constant T$_1$ which is much larger than T$_2$ (see below).
In MRI, the static magnetic field is augmented by a field gradient coil to vary across the scanned region, so that different spatial locations become associated with different precession frequencies. Only those regions where the field is such that the precession frequencies match the RF frequency will experience excitation. Usually, these field gradients are modulated to sweep across the region to be scanned, and it is the almost infinite variety of RF and gradient pulse sequences that gives MRI its versatility. Change of field gradient spreads the responding FID signal in the frequency domain, but this can be recovered and measured by a refocusing gradient (to create a so-called "gradient echo"), or by a radio frequency pulse (to create a so-called "spin-echo"), or in digital post-processing of the spread signal. The whole process can be repeated when some T$_1$-relaxation has occurred and the thermal equilibrium of the spins has been more or less restored. The repetition time (TR) is the time between two successive excitations of the same slice.
Typically, in soft tissues T$_1$ is around one second while T$_2$ and T$^*$ $_2$ are a few tens of milliseconds. However, these values can vary widely between different tissues, as well as between different external magnetic fields. This behavior is one factor giving MRI its tremendous soft tissue contrast.
MRI contrast agents, such as those containing Gadolinium(III) work by altering (shortening) the relaxation parameters, especially T$_1$.

## Imaging
### Imaging schemes

A number of schemes have been devised for combining field gradients and radio frequency excitation to create an image:
* 2D or 3D reconstruction from projections, such as in computed tomography.
* Building the image point-by-point or line-by-line.
* Gradients in the RF field rather than the static field.
Although each of these schemes is occasionally used in specialist applications, the majority of MR Images today are created either by the two-dimensional Fourier transform (2DFT) technique with slice selection, or by the three-dimensional Fourier transform (3DFT) technique. Another name for 2DFT is spin-warp. What follows here is a description of the 2DFT technique with slice selection.
The 3DFT technique is rather similar except that there is no slice selection and phase-encoding is performed in two separate directions.

#### Echo-planar imaging

Another scheme which is sometimes used, especially in brain scanning or where images are needed very rapidly, is called echo-planar imaging (EPI): In this case, each RF excitation is followed by a train of gradient echoes with different spatial encoding. Multiplexed-EPI is even faster, e.g., for whole brain functional MRI (fMRI) or diffusion MRI.

### Image contrast and contrast enhancement

Image contrast is created by differences in the strength of the NMR signal recovered from different locations within the sample. This depends upon the relative density of excited nuclei (usually water protons), on differences in relaxation times (T$_1$, T$_2$, and T$^*$ $_2$) of those nuclei after the pulse sequence, and often on other parameters discussed under specialized MR scans. Contrast in most MR images is actually a mixture of all these effects, but careful design of the imaging pulse sequence allows one contrast mechanism to be emphasized while the others are minimized. The ability to choose different contrast mechanisms gives MRI tremendous flexibility. In the brain, T$_1$-weighting causes the nerve connections of white matter to appear white, and the congregations of neurons of gray matter to appear gray, while cerebrospinal fluid (CSF) appears dark. The contrast of white matter, gray matter and cerebrospinal fluid is reversed using T$_2$ or T$^*$ $_2$ imaging, whereas proton-density-weighted imaging provides little contrast in healthy subjects. Additionally, functional parameters such as cerebral blood flow (CBF), cerebral blood volume (CBV) or blood oxygenation can affect T$_1$, T$_2$, and T$^*$ $_2$ and so can be encoded with suitable pulse sequences.
In some situations it is not possible to generate enough image contrast to adequately show the anatomy or pathology of interest by adjusting the imaging parameters alone, in which case a contrast agent may be administered. This can be as simple as water, taken orally, for imaging the stomach and small bowel. However, most contrast agents used in MRI are selected for their specific magnetic properties. Most commonly, a paramagnetic contrast agent (usually a gadolinium compound) is given. Gadolinium-enhanced tissues and fluids appear extremely bright on T$_1$-weighted images. This provides high sensitivity for detection of vascular tissues (e.g., tumors) and permits assessment of brain perfusion (e.g., in stroke). There have been concerns raised recently regarding the toxicity of gadolinium-based contrast agents and their impact on persons with impaired kidney function. (See Safety/Contrast agents below.)
More recently, superparamagnetic contrast agents, e.g., iron oxide nanoparticles, have become available. These agents appear very dark on T$^*$ $_2$-weighted images and may be used for liver imaging, as normal liver tissue retains the agent, but abnormal areas (e.g., scars, tumors) do not. They can also be taken orally, to improve visualization of the gastrointestinal tract, and to prevent water in the gastrointestinal tract from obscuring other organs (e.g., the pancreas). Diamagnetic agents such as barium sulfate have also been studied for potential use in the gastrointestinal tract, but are less frequently used.

### k-space

In 1983, Ljunggren and Twieg independently introduced the k-space formalism, a technique that proved invaluable in unifying different MR imaging techniques. They showed that the demodulated MR signal S(t) generated by the interaction between an ensemble of freely precessing nuclear spins in the presence of a linear magnetic field gradient G and a receiver-coil equals the Fourier transform of the effective spin density, $\rho ({\vec {x}})$. Fundamentally, the signal is derived from Faraday's law of induction:
    $S(t)={\tilde {\rho }}_{\mathrm {eff} }\left({\vec {k}}(t)\right)\equiv \int _{-\infty }^{\infty }\mathrm {d} {\vec {x}}\ \rho ({\vec {x}})\cdot e^{2\pi i\ {\vec {k}}(t)\cdot {\vec {x}}}$
where:
    ${\vec {k}}(t)\equiv \int _{0}^{t}{\vec {G}}(\tau )\ \mathrm {d} \tau$
In other words, as time progresses the signal traces out a trajectory in k-space with the velocity vector of the trajectory proportional to the vector of the applied magnetic field gradient. By the term effective spin density we mean the true spin density $\rho ({\vec {x}})$ corrected for the effects of T$_1$ preparation, T$_2$ decay, dephasing due to field inhomogeneity, flow, diffusion, etc. and any other phenomena that affect that amount of transverse magnetization available to induce signal in the RF probe or its phase with respect to the receiving coil' s electromagnetic field.
From the basic k-space formula, it follows immediately that we reconstruct an image $I({\vec {x}})$ by taking the inverse Fourier transform of the sampled data, viz.
    $I\left({\vec {x}}\right)=\int _{-\infty }^{\infty }\mathrm {d} {\vec {k}}\ S\left({\vec {k}}(t)\right)\cdot e^{-2\pi i\ {\vec {k}}(t)\cdot {\vec {x}}}$
Using the k-space formalism, a number of seemingly complex ideas became simple. For example, it becomes very easy (for physicists, in particular) to understand the role of phase encoding (the so-called spin-warp method). In a standard spin echo or gradient echo scan, where the readout (or view) gradient is constant (e.g., G), a single line of k-space is scanned per RF excitation. When the phase encoding gradient is zero, the line scanned is the k$_x$ axis. When a non-zero phase-encoding pulse is added in between the RF excitation and the commencement of the readout gradient, this line moves up or down in k-space, i.e., we scan the line k$_y$ = constant.
The k-space formalism also makes it very easy to compare different scanning techniques. In single-shot EPI, all of k-space is scanned in a single shot, following either a sinusoidal or zig-zag trajectory. Since alternating lines of k-space are scanned in opposite directions, this must be taken into account in the reconstruction. Multi-shot EPI and fast spin echo techniques acquire only part of k-space per excitation. In each shot, a different interleaved segment is acquired, and the shots are repeated until k-space is sufficiently well-covered. Since the data at the center of k-space represent lower spatial frequencies than the data at the edges of k-space, the T$_E$ value for the center of k-space determines the image's T$_2$ contrast.
The importance of the center of k-space in determining image contrast can be exploited in more advanced imaging techniques. One such technique is spiral acquisition—a rotating magnetic field gradient is applied, causing the trajectory in k-space to spiral out from the center to the edge. Due to T$_2$ and T$^*$ $_2$ decay the signal is greatest at the start of the acquisition, hence acquiring the center of k-space first improves contrast to noise ratio (CNR) when compared to conventional zig-zag acquisitions, especially in the presence of rapid movement.
Since ${\vec {x}}$ and ${\vec {k}}$ are conjugate variables (with respect to the Fourier transform) we can use the Nyquist theorem to show that a step in k-space determines the field of view of the image (maximum frequency that is correctly sampled) and the maximum value of k sampled determines the resolution; i.e.,
    ${\rm {FOV}}\propto {\frac {1}{\Delta k}}\qquad \mathrm {Resolution} \propto |k_{\max }|\ .$
(These relationships apply to each axis independently.)

### Example of a pulse sequence

In the timing diagram, the horizontal axis represents time. The vertical axis represents: (top row) amplitude of radio frequency pulses; (middle rows) amplitudes of the three orthogonal magnetic field gradient pulses; and (bottom row) receiver analog-to-digital converter (ADC). Radio frequencies are transmitted at the Larmor frequency of the nuclide to be imaged. For example, for $^1$H in a magnetic field of 1 T, a frequency of 42.5781 MHz would be employed. The three field gradients are labeled G$_X$ (typically corresponding to a patient's left-to-right direction and colored red in diagram), G$_Y$ (typically corresponding to a patient's front-to-back direction and colored green in diagram), and G$_Z$ (typically corresponding to a patient's head-to-toe direction and colored blue in diagram). Where negative-going gradient pulses are shown, they represent reversal of the gradient direction, i.e., right-to-left, back-to-front or toe-to-head. For human scanning, gradient strengths of 1–100 mT/m are employed: Higher gradient strengths permit better resolution and faster imaging. The pulse sequence shown here would produce a transverse (axial) image.
The first part of the pulse sequence, SS, achieves "slice selection". A shaped pulse (shown here with a sinc modulation) causes a 90° nutation of longitudinal nuclear magnetization within a slab, or slice, creating transverse magnetization. The second part of the pulse sequence, PE, imparts a phase shift upon the slice-selected nuclear magnetization, varying with its location in the Y direction. The third part of the pulse sequence, another slice selection (of the same slice) uses another shaped pulse to cause a 180° rotation of transverse nuclear magnetization within the slice. This transverse magnetisation refocuses to form a spin echo at a time T$_E$. During the spin echo, a frequency-encoding (FE) or readout gradient is applied, making the resonant frequency of the nuclear magnetization vary with its location in the X direction. The signal is sampled n$_{FE}$ times by the ADC during this period, as represented by the vertical lines. Typically n$_{FE}$ of between 128 and 512 samples are taken.
The longitudinal magnetisation is then allowed to recover somewhat and after a time T$_R$ the whole sequence is repeated n$_{PE}$ times, but with the phase-encoding gradient incremented (indicated by the horizontal hatching in the green gradient block). Typically n$_{PE}$ of between 128 and 512 repetitions are made.
The negative-going lobes in G$_X$ and G$_Z$ are imposed to ensure that, at time T$_E$ (the spin echo maximum), phase only encodes spatial location in the Y direction.
Typically T$_E$ is between 5 ms and 100 ms, while T$_R$ is between 100 ms and 2000 ms.
After the two-dimensional matrix (typical dimension between 128 × 128 and 512 × 512) has been acquired, producing the so-called k-space data, a two-dimensional inverse Fourier transform is performed to provide the familiar MR image. Either the magnitude or phase of the Fourier transform can be taken, the former being far more common.

### Overview of main sequences

This table does not include uncommon and experimental sequences.
| Group | Sequence | Abbr. | Physics | Main clinical distinctions | Example |
| Spin echo | T1 weighted | T1 | Measuring spin–lattice relaxation by using a short repetition time (TR) and echo time (TE). | Lower signal for more water content, as in edema, tumor, infarction, inflammation, infection, hyperacute or chronic hemorrhage. High signal for fat High signal for paramagnetic substances, such as MRI contrast agents Standard foundation and comparison for other sequences | |
| Spin echo | T2 weighted | T2 | Measuring spin–spin relaxation by using long TR and TE times | Higher signal for more water content Low signal for fat in standard Spine Echo (SE), though not with Fast Spin Echo/Turbo Spin Echo (FSE/TSE). FSE/TSE is the standard of care in modern medicine because it is faster. With FSE/TSE, fat has high signal due to disruption of hyperfine J-coupling between adjacent fat protons. Low signal for paramagnetic substances Standard foundation and comparison for other sequences | |
| Spin echo | Proton density weighted | PD | Long TR (to reduce T1) and short TE (to minimize T2). | Joint disease and injury. High signal from meniscus tears. (pictured) | |
| Gradient echo (GRE) | Steady-state free precession | SSFP | Maintenance of a steady, residual transverse magnetisation over successive cycles. | Creation of cardiac MRI videos (pictured). | |
| Gradient echo (GRE) | Effective T2 or "T2-star" | T2* | Spoiled gradient recalled echo (GRE) with a long echo time and small flip angle | Low signal from hemosiderin deposits (pictured) and hemorrhages. | |
| Gradient echo (GRE) | Susceptibility-weighted | SWI | Spoiled gradient recalled echo (GRE), fully flow compensated, long echo time, combines phase image with magnitude image | Detecting small amounts of hemorrhage (diffuse axonal injury pictured) or calcium. | |
| Inversion recovery | Short tau inversion recovery | STIR | Fat suppression by setting an inversion time where the signal of fat is zero. | High signal in edema, such as in more severe stress fracture. Shin splints pictured: | |
| Inversion recovery | Fluid-attenuated inversion recovery | FLAIR | Fluid suppression by setting an inversion time that nulls fluids | High signal in lacunar infarction, multiple sclerosis (MS) plaques, subarachnoid haemorrhage and meningitis (pictured). | |
| Inversion recovery | Double inversion recovery | DIR | Simultaneous suppression of cerebrospinal fluid and white matter by two inversion times. | High signal of multiple sclerosis plaques (pictured). | |
| Diffusion weighted (DWI) | Conventional | DWI | Measure of Brownian motion of water molecules. | High signal within minutes of cerebral infarction (pictured). | |
| Diffusion weighted (DWI) | Apparent diffusion coefficient | ADC | Reduced T2 weighting by taking multiple conventional DWI images with different DWI weighting, and the change corresponds to diffusion. | Low signal minutes after cerebral infarction (pictured). | |
| Diffusion weighted (DWI) | Diffusion tensor | DTI | Mainly tractography (pictured) by an overall greater Brownian motion of water molecules in the directions of nerve fibers. | Evaluating white matter deformation by tumors Reduced fractional anisotropy may indicate dementia. | |
| Perfusion weighted (PWI) | Dynamic susceptibility contrast | DSC | Measures changes over time in susceptibility-induced signal loss due to gadolinium contrast injection. | Provides measurements of blood flow In cerebral infarction, the infarcted core and the penumbra have decreased perfusion and delayed contrast arrival (pictured). | |
| Perfusion weighted (PWI) | Arterial spin labelling | ASL | Magnetic labeling of arterial blood below the imaging slab, which subsequently enters the region of interest. It does not need gadolinium contrast. | Provides measurements of blood flow In cerebral infarction, the infarcted core and the penumbra have decreased perfusion and delayed contrast arrival (pictured). | |
| Perfusion weighted (PWI) | Dynamic contrast enhanced | DCE | Measures changes over time in the shortening of the spin–lattice relaxation (T1) induced by a gadolinium contrast bolus. | Faster Gd contrast uptake along with other features is suggestive of malignancy (pictured). | |
| Functional MRI (fMRI) | Blood-oxygen-level dependent imaging | BOLD | Changes in oxygen saturation-dependent magnetism of hemoglobin reflects tissue activity. | Localizing brain activity from performing an assigned task (e.g. talking, moving fingers) before surgery, also used in research of cognition. | |
| Magnetic resonance angiography (MRA) and venography | Time-of-flight | TOF | Blood entering the imaged area is not yet magnetically saturated, giving it a much higher signal when using short echo time and flow compensation. | Detection of aneurysm, stenosis, or dissection | |
| Magnetic resonance angiography (MRA) and venography | Phase-contrast magnetic resonance imaging | PC-MRA | Two gradients with equal magnitude, but opposite direction, are used to encode a phase shift, which is proportional to the velocity of spins. | Detection of aneurysm, stenosis, or dissection (pictured). | (VIPR) |

## MRI scanner
### Construction and operation

The major components of an MRI scanner are: the main magnet, which polarizes the sample, the shim coils for correcting inhomogeneities in the main magnetic field, the gradient system which is used to localize the MR signal and the RF system, which excites the sample and detects the resulting NMR signal. The whole system is controlled by one or more computers.

### Magnet

The magnet is the largest and most expensive component of the scanner, and the remainder of the scanner is built around it. The strength of the magnet is measured in teslas (T). Clinical magnets generally have a field strength in the range 0.1–3.0 T, with research systems available up to 9.4 T for human use and 21 T for animal systems. In the United States, field strengths up to 7 T have been approved by the FDA for clinical use.
Just as important as the strength of the main magnet is its precision. The straightness of the magnetic lines within the center (or, as it is technically known, the iso-center) of the magnet needs to be near-perfect. This is known as homogeneity. Fluctuations (inhomogeneities in the field strength) within the scan region should be less than three parts per million (3 ppm). Three types of magnets have been used:
* Permanent magnet: Conventional magnets made from ferromagnetic materials (e.g., steel alloys containing rare-earth elements such as neodymium) can be used to provide the static magnetic field. A permanent magnet that is powerful enough to be used in an MRI will be extremely large and bulky; they can weigh over 100 tonnes. Permanent magnet MRIs are very inexpensive to maintain; this cannot be said of the other types of MRI magnets, but there are significant drawbacks to using permanent magnets. They are only capable of achieving weak field strengths compared to other MRI magnets (usually less than 0.4 T) and they are of limited precision and stability. Permanent magnets also present special safety issues; since their magnetic fields cannot be "turned off," ferromagnetic objects are virtually impossible to remove from them once they come into direct contact. Permanent magnets also require special care when they are being brought to their site of installation.
* Resistive electromagnet: A solenoid wound from copper wire is an alternative to a permanent magnet. An advantage is low initial cost, but field strength and stability are limited. The electromagnet requires considerable electrical energy during operation which can make it expensive to operate. This design is essentially obsolete.
* Superconducting electromagnet: When a niobium-titanium or niobium-tin alloy is cooled by liquid helium to 4 K (−269 °C, −452 °F) it becomes a superconductor, losing resistance to flow of electric current. An electromagnet constructed with superconductors can have extremely high field strengths, with very high stability. The construction of such magnets is extremely costly, and the cryogenic helium is expensive and difficult to handle. However, despite their cost, helium cooled superconducting magnets are the most common type found in MRI scanners today.
Most superconducting magnets have their coils of superconductive wire immersed in liquid helium, inside a vessel called a cryostat. Despite thermal insulation, sometimes including a second cryostat containing liquid nitrogen, ambient heat causes the helium to slowly boil off. Such magnets, therefore, require regular topping-up with liquid helium. Generally a cryocooler, also known as a coldhead, is used to recondense some helium vapor back into the liquid helium bath. Several manufacturers now offer 'cryogenless' scanners, where instead of being immersed in liquid helium the magnet wire is cooled directly by a cryocooler. Alternatively, the magnet may be cooled by carefully placing liquid helium in strategic spots, dramatically reducing the amount of liquid helium used, or, high temperature superconductors may be used instead.
Magnets are available in a variety of shapes. However, permanent magnets are most frequently C-shaped, and superconducting magnets most frequently cylindrical. C-shaped superconducting magnets and box-shaped permanent magnets have also been used.
Magnetic field strength is an important factor in determining image quality. Higher magnetic fields increase signal-to-noise ratio, permitting higher resolution or faster scanning. However, higher field strengths require more costly magnets with higher maintenance costs, and have increased safety concerns. A field strength of 1.0–1.5 T is a good compromise between cost and performance for general medical use. However, for certain specialist uses (e.g., brain imaging) higher field strengths are desirable, with some hospitals now using 3.0 T scanners.

### Shims

When the MR scanner is placed in the hospital or clinic, its main magnetic field is far from being homogeneous enough to be used for scanning. That is why before doing fine tuning of the field using a sample, the magnetic field of the magnet must be measured and shimmed.
After a sample is placed into the scanner, the main magnetic field is distorted by susceptibility boundaries within that sample, causing signal dropout (regions showing no signal) and spatial distortions in acquired images. For humans or animals the effect is particularly pronounced at air-tissue boundaries such as the sinuses (due to paramagnetic oxygen in air) making, for example, the frontal lobes of the brain difficult to image. To restore field homogeneity a set of shim coils is included in the scanner. These are resistive coils, usually at room temperature, capable of producing field corrections distributed as several orders of spherical harmonics.
After placing the sample in the scanner, the B$_0$ field is 'shimmed' by adjusting currents in the shim coils. Field homogeneity is measured by examining an FID signal in the absence of field gradients. The FID from a poorly shimmed sample will show a complex decay envelope, often with many humps. Shim currents are then adjusted to produce a large amplitude exponentially decaying FID, indicating a homogeneous B$_0$ field. The process is usually automated.

### Gradients

Gradient coils are used to spatially encode the positions of protons by varying the magnetic field linearly across the imaging volume. The Larmor frequency will then vary as a function of position in the x, y and z-axes.
Gradient coils are usually resistive electromagnets powered by sophisticated amplifiers which permit rapid and precise adjustments to their field strength and direction. Typical gradient systems are capable of producing gradients from 20 to 100 mT/m (i.e., in a 1.5 T magnet, when a maximal z-axis gradient is applied, the field strength may be 1.45 T at one end of a 1 m long bore and 1.55 T at the other). It is the magnetic gradients that determine the plane of imaging—because the orthogonal gradients can be combined freely, any plane can be selected for imaging.
Scan speed is dependent on performance of the gradient system. Stronger gradients allow for faster imaging, or for higher resolution; similarly, gradient systems capable of faster switching can also permit faster scanning. However, gradient performance is limited by safety concerns over nerve stimulation.
Some important characteristics of gradient amplifiers and gradient coils are slew rate and gradient strength. As mentioned earlier, a gradient coil will create an additional, linearly varying magnetic field that adds or subtracts from the main magnetic field. This additional magnetic field will have components in all 3 directions, viz. x, y and z; however, only the component along the magnetic field (usually called the z-axis, hence denoted G$_z$) is useful for imaging. Along any given axis, the gradient will add to the magnetic field on one side of the zero position and subtract from it on the other side. Since the additional field is a gradient, it has units of gauss per centimeter or millitesla per meter (mT/m). High performance gradient coils used in MRI are typically capable of producing a gradient magnetic field of approximate 30 mT/m or higher for a 1.5 T MRI. The slew rate of a gradient system is a measure of how quickly the gradients can be ramped on or off. Typical higher performance gradients have a slew rate of up to 100–200 T·m$^{−1}$·s$^{−1}$. The slew rate depends both on the gradient coil (it takes more time to ramp up or down a large coil than a small coil) and on the performance of the gradient amplifier (it takes a lot of voltage to overcome the inductance of the coil) and has significant influence on image quality.

### Radio frequency system

The radio frequency (RF) transmission system consists of an RF synthesizer, power amplifier and transmitting coil. That coil is usually built into the body of the scanner. The power of the transmitter is variable, but high-end whole-body scanners may have a peak output power of up to 35 kW, and be capable of sustaining average power of 1 kW. Although these electromagnetic fields are in the RF range of tens of megahertz (often in the shortwave radio portion of the electromagnetic spectrum) at powers usually exceeding the highest powers used by amateur radio, there is very little RF interference produced by the MRI machine. The reason for this is that the MRI is not a radio transmitter. The RF frequency electromagnetic field produced in the "transmitting coil" is a magnetic near-field with very little associated changing electric field component (such as all conventional radio wave transmissions have). Thus, the high-powered electromagnetic field produced in the MRI transmitter coil does not produce much electromagnetic radiation at its RF frequency, and the power is confined to the coil space and not radiated as "radio waves." Thus, the transmitting coil is a good EM field transmitter at radio frequency, but a poor EM radiation transmitter at radio frequency.
The receiver consists of the coil, pre-amplifier and signal processing system. The RF electromagnetic radiation produced by nuclear relaxation inside the subject is true EM radiation (radio waves), and these leave the subject as RF radiation, but they are of such low power as to also not cause appreciable RF interference that can be picked up by nearby radio tuners (in addition, MRI scanners are generally situated in metal mesh lined rooms which act as Faraday cages.)
While it is possible to scan using the integrated coil for RF transmission and MR signal reception, if a small region is being imaged, then better image quality (i.e., higher signal-to-noise ratio) is obtained by using a close-fitting smaller coil. A variety of coils are available which fit closely around parts of the body such as the head, knee, wrist, breast, or internally, e.g., the rectum.
A recent development in MRI technology has been the development of sophisticated multi-element phased array coils which are capable of acquiring multiple channels of data in parallel. This 'parallel imaging' technique uses unique acquisition schemes that allow for accelerated imaging, by replacing some of the spatial coding originating from the magnetic gradients with the spatial sensitivity of the different coil elements. However, the increased acceleration also reduces the signal-to-noise ratio and can create residual artifacts in the image reconstruction. Two frequently used parallel acquisition and reconstruction schemes are known as SENSE and GRAPPA. A detailed review of parallel imaging techniques can be found here: