---
title: "k-space: measuring the Fourier transform of an image line by line"
description: "Gradients along two axes give a 2D spatial frequency. Fill k-space one line per excitation, compute scan time and gradient steps, and read raw k-space data."
canonical_url: "https://sandboxphysics.com/stories/mri-spatial-encoding/k-space-and-fourier-imaging/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/mri-spatial-encoding/k-space-and-fourier-imaging/"
last_modified: "2026-10-29"
---

[MRI spatial encoding](https://sandboxphysics.com/stories/mri-spatial-encoding/)

L2 · Chapter 4

# k-space: measuring the Fourier transform of an image line by line

Sandbox Physics · 2026-10-29

One readout in Chapter 3 measures a single line: one $k_y$ and a run of $k_x$. A two-dimensional image needs encoding along the other direction too. MRI does it by playing a brief $y$ gradient before each readout to choose $k_y$, reading a whole line, then repeating with the next $k_y$. All the lines together are called k-space, and they are exactly the two-dimensional Fourier transform of the image. This chapter explains what each k-space sample measures, where the scan time comes from, and why raw k-space data look nothing like an image.

## Before you begin

k, the field of view and the pixel from Chapter 3, and the real part, imaginary part and magnitude of a complex number. The two-dimensional Fourier transform is built up from the one-dimensional case in the first section.

- Explain that each k-space sample corresponds to a stripe pattern, and find the stripe direction and spacing from k.
- Explain how phase encoding fills k-space line by line, and compute the scan time and the gradient area each step needs.
- Say which image features the centre and the edge of k-space decide, and why the magnitude image is used.

## Two gradients, two spatial frequencies

With gradients along both $x$ and $y$, the water at $(x,y)$ gains the phase $2\pi(k_xx+k_yy)$. The MIT handout writes the coil signal as the two-dimensional integral below: a fast oscillation shared by all positions, times the two-dimensional Fourier transform of the water density.

What does a sample $(k_x,k_y)$ measure? It compares the water distribution with a stripe pattern $e^{i2\pi(k_xx+k_yy)}$. The stripes are perpendicular to the vector $(k_x,k_y)$ and $1/|k|$ apart. Small $k$ means wide stripes that measure large-scale brightness; large $k$ means fine stripes that measure detail and edges.

$$
s(k_x,k_y)=\iint\rho(x,y)\,e^{-i2\pi(k_xx+k_yy)}\,dx\,dy
$$

The result on page 12 of the MIT handout without the common precession factor.

$$
k_x(t)=\bar\gamma\int_0^tG_x\,d\tau,\qquad k_y(t)=\bar\gamma\int_0^tG_y\,d\tau
$$

The time integrals of the gradients decide which spatial frequency is measured at each moment.

Each excitation records one line of k-space: the phase-encoding gradient picks $k_y$ and the readout sweeps $k_x$. Solid lines are recorded and dashed lines skipped, as when every other line is kept. The spacing $\Delta k=1/\mathrm{FOV}$ sets the field of view; the extent $N\Delta k$ sets the pixel. Original schematic.

Source: MIT 6.3000 Signal Processing · M. Lustig

## Phase encoding: one line per excitation

The readout gradient points along $x$, so one readout sweeps a whole line of $k_x$. Before the readout, a $y$ gradient of fixed duration and adjustable strength sets the $k_y$ of that line by its area. There is no $y$ gradient during the readout, so the whole line shares one $k_y$. This step is called phase encoding because it only gives different $y$ positions different phases before the readout.

Line $m$ needs $k_y=m\Delta k$, so the gradient areas of neighbouring lines differ by $\Delta k/\bar\gamma$. The longitudinal magnetization has to recover between excitations, so the lines are one repetition time $T_R$ apart. The MIT handout works it out: 256 lines at 2 s each take about 8.5 minutes.

Lustig and co-workers point out that in Cartesian sampling the readout direction is always fully sampled; time can only be saved by recording fewer phase-encode lines, and the saving is exactly proportional to the fraction left out. Chapters 5 and 6 are about which lines to leave out and how to fill them in.

$$
T_{\mathrm{scan}}=N_{\mathrm{lines}}\times T_R
$$

One line per excitation. The readout itself takes a few milliseconds; nearly all the scan time is spent waiting for the magnetization to recover.

Source: MIT 6.3000 Signal Processing · M. Lustig

## k-space data do not look like an image

The MIT handout shows a set of real k-space data. The magnitude needs a logarithmic scale to be seen at all, with almost all the energy near the centre, and the phase looks random. These measurements are not an image; they are its Fourier transform. Lustig and co-workers also note that most of an image’s energy is concentrated close to the k-space origin.

The image obtained by inverse Fourier transform has both a real and an imaginary part, because the signal path from excitation to reception adds phase delays. The MIT handout therefore takes the magnitude of the complex image as the final image.

The centre sample $s(0,0)=\iint\rho\,dx\,dy$ is the total amount of water in the sample. When the object moves by $\mathbf r_0$, every sample is multiplied by the phase factor $e^{-i2\pi\mathbf k\cdot\mathbf r_0}$ and keeps its magnitude. This is the shift theorem, and you will meet it again when you drag the phantom.

$$
\rho(\mathbf r-\mathbf r_0)\;\longleftrightarrow\;s(\mathbf k)\,e^{-i2\pi\mathbf k\cdot\mathbf r_0}
$$

A shift changes only the phase of k-space; the magnitude stays the same.

Source: MIT 6.3000 Signal Processing · M. Lustig

## The exact transform of the phantom

The head phantom in the k-space experiment is a sum of nine uniform ellipses, a teaching phantom defined for this course. A uniform ellipse has an exact Fourier transform that uses the first-order Bessel function $J_1$, the counterpart of a sine for a circular edge, which oscillates and decays as its argument grows. Every k-space sample therefore comes straight from the continuous object; nothing is drawn as pixels and transformed.

The benchmark program checks this formula in two independent ways. It compares $J_1$ with Bessel’s integral directly, a difference of $2.2\times10^{-9}$, and it cuts every ellipse into chords and integrates them one by one, which agrees with the formula to $6.7\times10^{-10}$ of the ellipse area or better.

$$
F(\mathbf k)=\rho\,ab\,\frac{J_1(2\pi\kappa)}{\kappa}\,e^{-i2\pi\mathbf k\cdot\mathbf r_0},\qquad \kappa=\sqrt{(ak_u)^2+(bk_v)^2}
$$

Semi-axes $a$ and $b$, centre $\mathbf r_0$; $k_u$ and $k_v$ are the components of $\mathbf k$ along the two axes of the ellipse.

Source: MIT 6.3000 Signal Processing · M. Lustig

## Worked example: one 64-by-64 scan

Problem: a 256 mm field of view, a $64\times64$ matrix, $T_R=2\,\mathrm s$ and phase-encoding gradients that last 1 ms. Find the k-space step, the largest spatial frequency, the pixel width, the scan time and the phase-encoding gradient of the outermost line. This is the full scan of the k-space experiment.

The step is $\Delta k=1/0.256\,\mathrm m=3.906\,\mathrm{m^{-1}}$, the largest spatial frequency $k_{\max}=32\Delta k=125\,\mathrm{m^{-1}}$ and the pixel $256/64=4\,\mathrm{mm}$. The scan takes $64\times2\,\mathrm s=128\,\mathrm s=2.13\,\mathrm{min}$; with 256 lines, as in the MIT handout, it would take 8.53 minutes.

Each step needs a gradient area of $\Delta k/\bar\gamma=3.906/(42.576\times10^6)=9.17\times10^{-8}\,\mathrm{T\,s/m}$. Spread over 1 ms, the gradient grows by 0.0917 mT/m per step, and the outermost line, 32 steps out, needs 2.94 mT/m.

A related question from the MIT handout: how many $(k_x,k_y)$ pairs does a 10-inch square field of view need at 1 mm resolution? Ten inches is 254 mm, so 254 samples per side and $254^2=64\,516$ in all; at 2 s per line the scan takes 8.47 minutes.

Source: MIT 6.3000 Signal Processing · M. Lustig

## Try it in the Lab

### [Watch k-space fill line by line](https://sandboxphysics.com/labs/mri-k-space-reconstruction/)

1. In the “Every line: the full scan” preset, watch the k-space record appear line by line and read the 2.13-minute scan time.
2. Drag the head inside the bore. Predict from the shift theorem that the log magnitude of the k-space record hardly changes and only the phase does. Check against the record.
3. Click a row near the edge of the k-space record to drop it, then drop a row at the centre instead. Which changes the image more? Explain it by the centre deciding large-scale brightness.

## Exercises with explained answers

1. How many phase-encode lines do a 200 mm field of view and 2 mm resolution need, and how long does the scan take with 2 s per line?

   Show the answer

   $200/2=100$ lines, so the scan takes $100\times2\,\mathrm s=200\,\mathrm s$, about 3.33 minutes. The ISMRM diffusion problem set uses the same $100\times100$ matrix.

2. The object moves 10 mm along $y$. By how much does the phase of the line at $k_y=50\,\mathrm{m^{-1}}$ change?

   Show the answer

   By $2\pi k_y y_0=2\pi\times50\times0.01=\pi$: the samples change sign and keep their magnitude.

3. What can you learn from the single sample at the very centre of k-space?

   Show the answer

   Only $s(0,0)=\iint\rho\,dx\,dy$, the total amount of water in the sample, with no information about position. That is exactly what the coil measures without any gradient.

[Previous: How a gradient turns position into frequency](https://sandboxphysics.com/stories/mri-spatial-encoding/gradients-make-position-into-frequency/) [Next: Sampling, wraparound and resolution: what one missing line does](https://sandboxphysics.com/stories/mri-spatial-encoding/sampling-aliasing-and-resolution/)

## Sources and what we recomputed

1. [MIT 6.3000 Signal Processing, Magnetic Resonance Imaging lecture handout (6 May 2025), data and examples from E. Adalsteinsson](https://sigproc.mit.edu/_static/spring25/lectures/MRI-handout.pdf)

   Read in full. Page 9: the proton gyromagnetic ratio rounded to 42.58 MHz/T. Pages 11–13: gradient fields, the phase integral and the definition of k as the time integral of the gradient. Pages 15–18: k-space data, the complex image and its magnitude. Page 19: 256 lines at 2 s each, about 8.5 minutes. Pages 20–21: keeping only even columns of k-space. Pages 24–36: two-coil unfolding, including the coil pair whose sensitivities cannot separate the folded pixels. The handout uses the sign convention of the Fourier kernel that this course follows.

2. [M. Lustig, D. Donoho and J. M. Pauly, Sparse MRI: the application of compressed sensing for rapid MR imaging, Magnetic Resonance in Medicine 58, 1182–1195 (2007), doi:10.1002/mrm.21391](https://doi.org/10.1002/mrm.21391)

   Read in full. Fig. 1 and the three requirements of compressed sensing; Fig. 2 (a 256-sample sparse signal, 8-fold undersampled); Eq. 1 (spread of the interference) and its derivation in Appendix B, which the text calls Appendix II; the remark that single-slice 2DFT interference is D^{1/4} larger; Eq. 2 (transform point spread); Eqs. 3–4 (constrained reconstruction); Appendix A, Eqs. A1–A3 (Lagrangian form and nonlinear conjugate gradients, 80 to 200 iterations); Results and Discussion (2.4-fold brain, 5-fold angiography from 22 s to 4.4 s, loss of low-contrast features). The in-vivo images are described, not reproduced.
