How specifically does an MRI machine build an image from received radio waves?

The key to understanding image generation in MRI lies in realizing that the signal sent to the antenna (or coil) by the patient's tissues includes two different types of information:

  1. Information regarding the magnitude of the transverse magnetization of the tissue under the influence of a structured sequence of RF stimulation pulses. This magnitude depends on the tissue composition of every single voxel (3D pixel) of the anatomy being interrogated, and will be coded for medical interpretation by mapping it to gray-scale values to generate the final image.
  2. The necessary spatial encoding that will allow tracing back each component of the signal to a specific location in physical space.

In the following diagram of an MRI of the brain in progress, two voxels (red and magenta) are highlighted, and their individual signals added up to form a resultant wave, filling in a line in k-space (Fourier space):

enter image description here

The spatial information is induced via linear gradient fields. At any particular point in space, i.e. $\color{red}{\vec r}$ corresponding to the location of the red voxel, the precession frequency of the atoms of hydrogen is (rotating frame):

$$\omega =\gamma\, \vec G_z \cdot \color{red}{\vec r}$$

with $\gamma$ corresponding to the gyromagnetic ratio; and $\vec G_z,$ the 3D gradient of the magnetic field $\vec G_z = \nabla B_z.$

The phase of the hydrogen atoms at location $\color{red}{\vec r},$ is the time integral of

$$\begin{align} \phi(\color{red}{\vec r}, t) &= \int_0^t \omega(\color{red}{\vec r},\tau)\,\mathrm d\tau\\ &=\int_0^t \gamma\, \vec G_z(\tau) \cdot \color{red}{\vec r} \, \mathrm d\tau \\ &= \left( \gamma \int_0^t \vec G_z(\tau) \, \mathrm d\tau \right) \cdot \color{red}{\vec r} \\ &= \vec k(t) \cdot \color{red}{\vec r} \end{align}$$

where $\vec k(t)=\gamma \, \int_0^t \vec G_z(\tau)\, \mathrm d\tau$ is defined such that it parametrically defines a path through spatial frequency space.

The signal acquired in MRI is the sum of all transverse magnetization:

$$\begin{align} \color{purple}{\text{Signal}}(t) & \sim \int_{-\infty}^\infty M_{xy}(\vec r, t)\,\mathrm dx\mathrm dy\mathrm dz\\[2ex] &=\int_{-\infty}^\infty M_{xy}(\vec r,t)\, \mathrm d\vec r \\[2ex] & = \large \int_{-\infty}^\infty \underbrace{M_{xy}(\vec r, 0)}_{\color{blue}{\text {Image}}} \, \underbrace{\mathrm e^{-\mathrm 2\pi i \,\vec k(t) \,\cdot\, \vec r}}_{\color{orange}{\text{Phase rotation}}} \mathrm d\vec r \tag 1 \end{align}$$

The phase rotation depends on time and space and does not affect the magnitude of the magnetization (or signal).

Equation (1) is a Fourier transform relating $\color{purple}{\text{Signal}}$ as a function of time and the $\color{blue}{\text {Image}}.$

Each point in physical space (patient) will contribute one frequency component to the time domain signal. Conversely, each point in k-space represents the magnitude of one given spatial frequency over the whole image.

Critically, there is no FFT between signal reception ("Resultant signal" captured by the antenna (coil) in the diagram above) and the line in K-space being filled in. The signal received is already in Fourier space thanks to the action of the gradients that induce different spatial frequencies across the $x$- and $y$-axes in real space. Here is the diagrammatic depiction of the resulting phase differences induced by the application the phase and frequency encoding gradients used to obtain a line close to the center of K-space at the start of the $180^o$ train in an turbo (or fast) spin echo sequence (taken from this great animation by Tyler Moore on youtube):

enter image description here

Notice the change along the $y$-axis (vertical waveform along the spins diagram in the left-upper quadrant) when a more peripheral line of K-space is obtained after the second refocusing pulse (right at the start of the readout):

enter image description here

On the other hand, the spatial frequency along the $x$-axis is identical to the prior line of K-space at the same point in time.

A finer point to understand is the need for as many phase encoding steps as the matrix in the phase encoding direction. The explanation for these repetitive experiments, each filling in a single line of K-space, is the fact that for every single step the spins colored the same on the diagram below will only differ in phase - not in frequency - as they go through the different lobes of the frequency encoding gradients, because the phase gradient is not turned on during readout, and the spins return to processing at the same frequency, albeit with residual phase shifts.

enter image description here

When two constituent sinusoids contributing to the signal emitted by the patient have the same frequency, and vary only in phase, they cannot be distinguished. A single sinusoidal of a different phase and amplitude will be received, losing the information contingent solely on phase differences.


Finally, the signal extracted from the patient during the application of the middle lobe of the readout gradient can be conceptualized by simplifying the process, and thinking of it as the aggregate of different discrete sine waves: the first ones captured in the temporal line correspond to the highest frequencies collected, which are replaced by progressively slower sine waves of increasing amplitude until they peak at the point of maximum coherence in the transverse magnetization of the spins after the $180^0$ pulse. After that the process is reverted:

enter image description here

The component frequencies captured map to points in K space. The ADC transforms the analog signal, and the spacing between samples is referred to as the dwell time (sampling rate), whereas the reciprocal of the dwell time $(\Delta t)$ is the receiver bandwidth $(\text{RBW}=1/\Delta t).$ Each frequency can be sampled by the receiver for a shorter or longer period of time, and the longer each frequency represented in K space is sampled (lower bandwidth), the higher the signal-to-noise (SNR) will be, at the cost of a slower readout rate.

An ADC effectively averages the input signal over the dwell time, thus the effective noise on the digitized signal is proportional to $1/\sqrt{\Delta t}$ making it desirable to increase $\Delta t.$ Signal noise [sic] is also directly proportional to the receiver bandwidth. Richard Ansorge and Martin Graves - The Physics and Mathematics of MRI.

The Nyquist theorem imposes restrictions on the number of samples needed to capture a given frequency, but since two quadrature samples are taken at each $\Delta t$ interval, here would be the diagram of the sampling of a signal with 5 acquisition points along the frequency direction:

enter image description here

[Please note that on the image above, sampling is carried out only on the first part of the echo - this is theoretically possible given the symmetry of the signal, although in practice, more than 50% of the echo is sampled. Also in partial-echo techniques it is last part of the signal that is sampled to decrease the TE by shortening the readout gradient.]

Contrarily, a higher bandwidth will sample more points per msec at the expense of lower SNR, but with the upside of obtaining more closely packed echoes (shorter echo spacing, ESP), enabling longer ETL's for a given TR: $\text{ESP}\sim \frac{\text{freq encoding steps}}{\text{receiver bandwidth}}.$


Resources:

A K-space analysis of Small-Tip-Angle-Excitation by John Pauly et al. JMR 1989

MRI: Introduction to K-space by Eric Wong

Fast Spin Echo - Spaces Animation by Tyler Moore


In MRI, an image is created by using gradient magnetic fields. By adding a gradient magnetic field the magnetic field is different at different positions in the body. The most important term in understanding the use of this is the larmor frequency. This is the frequency with which the hydrogen atoms will precess in a certain magnitude magnetic field and is proportional to the gyromagnetic ratio. A gradient magnetic field is first applied in the length of the patient (head to feet). Then, by applying a radiofrequency wave the atoms in exactly that slice of the patient for which the rf pulse has the larmor frequency are excited. This is called slice selection. From this point we know that all information must come from this one slice, so one of the three dimensions is known. The next step is to apply a gradient in lets say the left right direction. Because of the different larmor frequencies, the hydrogen atoms at a different lateral position will now precess at a different frequency, which is the same frequency at which they will emit a radiofrequency wave. So from the frequency of the recieved pulses you can know the second dimension of its source. This is called frequency encoding As for the third and last dimension a similar but slightly different technique is applied, called phase encoding. If you really want to get into it look that up, but for now you might want to start with understanding the first two dimensions.

The answer given by John is (partially) true for CT scans, but most certainly not for MRI. This is the reason that a CT scanner has a rotating head whereas an MRI has no moving parts. If you want to get into CT image building, look up filtered back projection.