Exercise: back-projection and the Fourier slice theorem
Before this unit: Projections and the sinogram (previous unit); Day 1: Images, filters and frequencies.
See also: Day 4: Image formation; Day 5: Deconvolution; Day 21: Hough transform; Day 28: Ising model and Markov random fields.
Goal
By the end of this exercise you should be able to:
- back-project a few projections by hand and recognise the ghosts and the halo,
- explain why plain back-projection blurs every point with a 1/r halo,
- use the Fourier slice theorem to predict which projection sees which pattern, and where it appears in the 2D spectrum,
- explain why direct Fourier reconstruction needs interpolation and why its errors spread over the whole image.
Do the pen-and-paper part first, then the two demos. Questions marked (math) are for those who want the derivations; the concept questions do not depend on them.
Background
| Idea | What it means |
|---|---|
| Back-projection | every pixel receives the values of all rays through it, summed over all angles |
| Halo | plain back-projection of a point: a peak with a glow falling off like 1/r |
| Transpose | projection is A\mathbf x; back-projection is A^\top\mathbf y, not A^{-1} |
| Fourier slice theorem | 1D spectrum of the projection at \theta = 2D spectrum along the central line at \theta |
| DFT convention | as in the Fourier unit: unnormalised forward DFT, frequency 0 (DC) in the centre |
By hand
B1. Point masses A = (2, 0) (mass 1), B = (0, 1) (mass 2), C = (-1, -1) (mass 1). (a) Write down p_0 and p_{90°} (positions and heights of the bars). (b) Back-project both onto a 5 \times 5 grid with x and y from -2 to 2: each pixel gets p_0(x) + p_{90°}(y). Write the table. (c) Mark the true points. Which other pixels are as bright or brighter? Why do they appear?
B2. The halo. A point is back-projected from 180 angles. (a) How many smeared lines per unit length cross a circle of radius 5 pixels around the point? Of radius 20? (b) By what factor is the halo fainter at r = 20 than at r = 5? (c) Why does this make a bright disc look as if it were surrounded by a faint glow, and lower its contrast against the background?
B3. Back-project the row sums (3, 7) and column sums (4, 6) of the 2 \times 2 image \begin{bmatrix}1&2\\3&4\end{bmatrix}: each pixel gets its row sum plus its column sum. Compare with the image. What is right, what is wrong?
B4. Vertical stripes I = \tfrac12 + \tfrac12\cos(2\pi x/8) in a 64 \times 64 image. (a) What is the projection onto x (at 0°)? How many cycles does it have, and where are the peaks of its DFT (and how large, with the unnormalised DFT)? (b) What is the projection onto y (at 90°), and its DFT? (c) Mark both on a sketch of the 2D spectrum. Check that each projection’s spectrum is the slice at its angle.
B5. Predict, without computing: (a) Horizontal stripes with period 16 in a 64 \times 64 image: which projection shows them, and where are the dots in the 2D spectrum? (b) Stripes running diagonally (the grey value changes along the direction 45°): at which projection angle do they survive with full contrast? At which angle do they average away completely?
B6. Direct Fourier reconstruction of a 128 \times 128 image: the spectrum’s outer ring is 64 frequency steps from the centre. (a) With M spokes over 180°, how far apart are neighbouring spokes at the outer ring? (b) How many spokes are needed so that this gap is at most one frequency step? (c) Why does an interpolation error at one frequency show up over the whole reconstructed image?
B1. (a) p_0: bars at \rho = 2 (height 1, A), 0 (2, B), -1 (1, C). p_{90°}: bars at \rho = 0 (1, A), 1 (2, B), -1 (1, C). (b) Rows from y = 2 (top) to -2, columns x = -2 \dots 2:
| y \backslash x | −2 | −1 | 0 | 1 | 2 |
|---|---|---|---|---|---|
| 2 | 0 | 1 | 2 | 0 | 1 |
| 1 | 2 | 3 | 4 | 2 | 3 |
| 0 | 1 | 2 | 3 | 1 | 2 |
| −1 | 1 | 2 | 3 | 1 | 2 |
| −2 | 0 | 1 | 2 | 0 | 1 |
- B = (0, 1): 4 (the maximum); A = (2, 0): 2; C = (-1, -1): 2. Four ghosts have value 3: (-1, 1), (2, 1), (0, 0), (0, -1), all brighter than A and C. Every pixel where a bright column meets a bright row lights up; with two angles the image cannot tell real points from crossings of their rays.
B2. (a) N lines cross a circle of radius r in 2N places, so per unit length 2N/(2\pi r) = N/(\pi r): 11.5 at r = 5, 2.9 at r = 20. (b) Four times fainter: the halo falls like 1/r. (c) Each point of the disc spreads part of its value into its surroundings; outside the disc these halos add up to a glow, and inside the disc the values are no longer flat. Neighbouring regions borrow brightness from each other, so contrast falls, worst for large slow structures.
B3. a = 3 + 4 = 7, b = 3 + 6 = 9, c = 7 + 4 = 11, d = 7 + 6 = 13. The order is right (a < b < c < d) and the differences between neighbours are right too, but every value is far too large: each pixel collects the whole sum of its row and of its column. Back-projection is not an inverse: it gives a blurred, unnormalised version. (The fourth unit returns to this: it is A^\top\mathbf b.)
B4. (a) Every column has 64 equal pixels: p_0(x) = 32 + 32\cos(2\pi x/8), 8 cycles over 64 pixels. DFT: DC = 64 \cdot 32 = 2048, peaks of 32 \cdot 64/2 = 1024 at \pm 8. (b) Every row contains whole periods: p_{90°}(y) = 64 \cdot \tfrac12 = 32, constant. DFT: only DC = 2048. (c) 2D DFT: 2048 at the centre, 1024 at (\pm 8, 0). The horizontal line through the centre (the 0° slice) contains -8, 0, 8, exactly the DFT of p_0; the vertical line (90°) contains only the DC term, exactly the DFT of p_{90°}.
B5. (a) They vary along y: the projection at 90° (row sums) shows a cosine with 64/16 = 4 cycles; the projection at 0° is constant. Dots at (0, \pm 4). (b) At 45° the rays run along the stripes, so each ray sees one grey value: full contrast. At 135° the rays cross the stripes and every ray averages over whole periods: the stripes vanish (up to the edges of the image).
B6. (a) The angular step is \pi/M, so the gap at radius 64 is 64\pi/M steps (2.2 for M = 90). (b) 64\pi/M \le 1 gives M \ge 201: about \tfrac{\pi}{2} \cdot 128. (This is the angle rule of the next unit.) (c) Every point of the spectrum is the amplitude of one plane wave that covers the whole image. A wrong value at one frequency adds a wrong wave everywhere, so local spectral errors become global image errors (ripples).
Math questions
B7. (math) Prove the Fourier slice theorem P_\theta(\omega) = F(\omega\,\mathbf n_\theta) for any \theta, starting from p_\theta(\rho) = \iint f(\mathbf x)\,\delta(\mathbf x\cdot\mathbf n_\theta - \rho)\,d\mathbf x.
B8. (math) Show that the back-projection of the sinogram of a point at the origin is 1/r: compute \int_0^\pi \delta(r\cos(\theta - \varphi))\,d\theta.
B9. (math) Use B8, linearity and the shift rule of the Radon transform to show \mathcal B\mathcal R f = f * \tfrac{1}{|\mathbf x|}.
B10. (math) Discrete version at 0°: an N \times N image I[y, x] (row y, column x) has column sums c[x] = \sum_y I[y, x]. Show that the DFT of c equals the row v = 0 of the 2D DFT of I.
B7. P_\theta(\omega) = \int p_\theta(\rho)e^{-2\pi i\omega\rho}d\rho = \iint f(\mathbf x)\Big(\int\delta(\mathbf x\cdot\mathbf n_\theta - \rho)e^{-2\pi i\omega\rho}d\rho\Big)d\mathbf x = \iint f(\mathbf x)e^{-2\pi i\omega\,\mathbf x\cdot\mathbf n_\theta}d\mathbf x = F(\omega\mathbf n_\theta) (swap the integrals, then use the sifting property of \delta).
B8. Substitute u = \theta - \varphi: \int\delta(r\cos u)\,du over an interval of length \pi. r\cos u has exactly one zero there (at u = \pm\pi/2), with derivative \mp r\sin u = \mp r, so the integral is 1/|r|.
B9. f = \iint f(\mathbf x')\,\delta(\mathbf x - \mathbf x')\,d\mathbf x' is a sum of shifted points. \mathcal R and \mathcal B are linear, and \mathcal R of a shifted point is the shifted sinusoid, whose back-projection is the shifted halo (the back-projection of g(\rho - \mathbf t\cdot\mathbf n_\theta, \theta) at \mathbf x is \mathcal Bg(\mathbf x - \mathbf t)). So \mathcal B\mathcal R f(\mathbf x) = \iint f(\mathbf x')\,\frac{1}{|\mathbf x - \mathbf x'|}\,d\mathbf x' = (f * \tfrac{1}{|\cdot|})(\mathbf x).
B10. F[u, 0] = \sum_y\sum_x I[y, x]\,e^{-2\pi i(ux + 0\cdot y)/N} = \sum_x\Big(\sum_y I[y, x]\Big)e^{-2\pi iux/N} = \sum_x c[x]\,e^{-2\pi iux/N}, the DFT of c. Exact, because the line v = 0 runs through grid points; at other angles the slice falls between them.
Explore: back-projection
Left: the sinogram, with the angle being back-projected marked in orange. Middle: the filter (here none) and the current projection. Right: the reconstruction, built up angle by angle. Angles in the scan sets how many projections are measured over 180°; back-projected how many of them are already smeared back; play adds them one after the other. The other filters belong to the next unit.
E1. Preset one point → star (4 angles). Where do the four arms cross? Set angles in the scan to 16 and then 180. Describe how the picture changes, and where the bright part ends up.
E2. With 180 angles, press clear and step with +1 angle a few times, then play. How does a single angle look in the reconstruction? When does the point first stand out?
E3. Preset plain: glow. Compare the reconstruction with the phantom you saw in the first unit. What is right, what is wrong? Why does the readout give no RMSE?
E1. The arms cross only at the point, at (30, 20). With 16 angles the star has 16 arms; with 180 the arms merge into a bright spot surrounded by a halo that fades with distance (the auto contrast hides most of it; the outer parts of the image are not black). The spot sits where the point is: back-projection puts things in the right place, it just blurs them.
E2. One angle smears the projection into a stripe across the whole image (each bar of the projection becomes a band along its rays). After a few angles the stripes cross and the point is where they all meet; it stands out once several angles have been added, while the stripes far from it average into the halo.
E3. The shape is right: the skull, the ventricles and the small ellipses are in the right places. But everything is blurred and glows: the dark ellipses are not dark, the skull bleeds inwards and outwards, and the values are on a completely different scale (the halo adds up the whole image). Plain back-projection is not normalised (it is A^\top, not an inverse), so comparing its numbers with the phantom is meaningless.
Explore: the Fourier slice theorem
Slice theorem tab: drag on the image to turn the angle \theta (red line: the \rho direction; yellow: the rays). The middle panel is the 2D spectrum (log scale) with the slice at \theta in red. The plot shows the 1D spectrum of the projection (blue) and the 2D spectrum sampled along the red line (red, dashed), as log magnitude, real part or imaginary part. The readout gives their relative difference. Direct reconstruction tab: the projections’ spectra are placed on their spokes, interpolated onto the grid (nearest cell or bilinear), and inverted; the panels show the reconstruction, the gridded spectrum and the error.
E4. Preset stripes: one angle sees them, the other doesn’t (period 8). At \theta = 0°, where are the side peaks of the projection’s spectrum (in cycles per pixel)? Turn to 90°. What remains? Compare with B4.
E5. Choose tilted stripes. Find the angle at which the side peaks are largest, and their frequency. What is the period of the stripes?
E6. Preset projection ↔︎ slice match (Shepp–Logan). Read the relative difference at 0°, 30°, 45° and 90°. Why exactly zero at two of them? Switch to the real and the imaginary part: do they match too?
E7. Switch to direct reconstruction, preset spokes are sparse at the edge (24 spokes, bilinear). Look at the gridded spectrum: where is it empty? Compare the RMSE with filtered back-projection (readout).
E8. Preset nearest gridding: errors everywhere (90 spokes). Where is the error? Switch to bilinear: compare the RMSE and the fraction of grid cells filled. Then increase the spokes to 180 and 360. Does the direct method catch up with filtered back-projection?
E4. At 0° the side peaks are at \pm 0.125 = 1/8 cycles per pixel (period 8), next to the large DC peak. At 90° only the DC peak remains: every row of the stripes averages to the same value. As in B4: the 0° slice of the 2D spectrum holds the stripe peaks, the 90° slice does not.
E5. At \theta = 30°, with side peaks near \pm 0.1 cycles per pixel: the stripes vary along the 30° direction with period 10. At 120° every ray crosses the stripes and averages over whole periods: the side peaks are gone.
E6. 0.00 % at 0° and 90°, 8.21 % at 30°, 8.72 % at 45°. At 0° and 90° the projection is exactly the column or row sums, and the slice runs along grid points of the 2D DFT, so the two are the same numbers (B10). At other angles the slice is interpolated between grid points and the projection itself is computed by interpolating between pixels: small differences, mostly at high frequencies. Real and imaginary parts match as well: the theorem holds for the complex spectrum, not only for magnitudes.
E7. The gridded spectrum is filled only along the 24 spokes; between them, especially far from the centre, it is empty (18.3 % of the cells filled). Missing high frequencies mean missing fine detail and streaky ripples. RMSE 0.112 (direct, bilinear) against 0.108 (filtered back-projection): with so few angles both suffer.
E8. With nearest-cell gridding the error is spread over the whole image as faint ripples, not only at the edges of the phantom: RMSE 0.079, 29.7 % of the cells filled. Bilinear gridding fills 58.3 % and gives 0.051. With 180 and 360 spokes (bilinear) the RMSE drops to 0.044, still above filtered back-projection (0.039): the interpolation error in the spectrum remains.
Code
Write the algorithms of this unit yourself, in Rust. Setup, and how to run and check your code: coding exercises: getting started. Your code goes in radon/src/backprojection/exercise.rs. The projector of the previous unit and the Shepp–Logan phantom are given; coordinates as there (origin at the centre, y up).
C1. backproject_two(p0, p90): back-projection of two projections by hand: every pixel gets its column’s value from p_0 plus its row’s value from p_{90°} (bin 0 of p_{90°} is the bottom row). The checks are your tables of B1 and B3.
C2. backproject(sino, angles, n): plain back-projection of a whole sinogram:
for every pixel (x, y):
sum = 0
for every angle θ:
ρ = x cos θ + y sin θ
sum = sum + p_θ(ρ) # between bins: linear interpolation
out(x, y) = sum · π / (number of angles)
The checks: with the angles 0° and 90° it is \tfrac{\pi}{2} times C1, and the halo of a point is about 4 times fainter at r = 20 than at r = 5 (B2).
C3. projection_spectrum(p) and spectrum_slice(spectrum, θ): the two sides of the Fourier slice theorem, as sizes, with frequency 0 in the middle:
P = the DFT of the projection p_θ # sizes |P(ω)|
for ω from −n/2 to n/2 − 1:
S(ω) = |F| at the point ω (cos θ, sin θ) of the image's 2D DFT # between grid points: bilinear
(The DFT counts rows downwards, so the point is column \omega\cos\theta, row -\omega\sin\theta.) The checks are B4 and B5: the stripes give the same numbers on both sides at 0° and 90°, and stripes along 30° show at 30°, not at 150°.
Then cargo run -p radon -- backprojection and open the pictures in out/backprojection/. The program back-projects a point from 1, 4, 16 and 180 angles (point-*-angles.png), measures the halo of a point on rings around it, back-projects the phantom, and compares the two sides of the Fourier slice theorem for the phantom at 0°, 30° and 90°.
C4. Look at the four point pictures and read the printed ring averages. Check that the halo falls like 1/r. What are the values of the back-projected phantom, compared with the true 0 to 1?
C5. At 0° and 90° the two sides of the slice theorem agree exactly, at 30° they differ by more than 10 %. Why? (B10, and the slide “Direct Fourier reconstruction”.)
The model solution is radon/src/backprojection/solution.rs in the download.
C4. One angle gives a single line through the point, four angles a star of four lines, 16 angles a star of 16, and 180 angles a bright spot whose glow fades outwards. Ring averages at r = 2, 5, 10, 20, 40: 0.566, 0.228, 0.116, 0.058, 0.030. The product r \cdot value stays between 1.13 and 1.20: the halo falls like 1/r (3.9 times fainter at 20 than at 5). The back-projected phantom has values from 23.5 to 75.4 instead of 0 to 1: the right shape, but unnormalised and blurred, and even the empty corners glow.
C5. Differences 0.00 % at 0° and 90°, 15 % at 30° (12 % for |\omega| \le 16). At 0° and 90° the rays run through pixel centres and the line through the spectrum runs through its grid points: both sides are exact, and the theorem holds exactly (B10). At 30° both sides interpolate: the projection between pixels, the slice between frequencies. The phantom’s spectrum oscillates quickly (it has large objects with sharp edges), so interpolating its sizes between grid points is crude. This is the gridding problem that makes direct Fourier reconstruction hard.
Where this leads
The spokes crowd at the centre of the spectrum: that is why plain back-projection over-weights slow waves. The next unit, filtered back-projection, weights each projection’s spectrum by |\omega| before smearing back (filtered back-projection), and asks how many angles and photons a good reconstruction needs.