Exercises
ex01-fourier-slice
Easy(a) Create a Shepp-Logan phantom.
(b) Compute the Radon transform (projection) at angle .
(c) Take the 1D FFT of the projection and the 2D FFT of the phantom. Extract the radial slice of the 2D FFT at .
(d) Plot both on the same axes. Verify they are identical (up to numerical precision).
(e) Repeat for . At which angle is the numerical agreement worst? Why?
Use interpolation (e.g., scipy.ndimage.map_coordinates) to extract the radial slice from the 2D FFT grid.
Worst agreement typically occurs at 45 degrees where the interpolation path cuts diagonally across grid cells.
Setup
Use skimage.data.shepp_logan_phantom() or construct
manually. Compute projections with skimage.transform.radon().
Verification
The 1D FFT of the projection at and the radial slice of the 2D FFT at angle should match to within numerical precision ( relative error for 64-bit arithmetic). Diagonal angles have slightly worse agreement due to interpolation across the Cartesian FFT grid.
ex02-fbp-basic
Easy(a) Implement FBP for X-ray CT using the Ram-Lak filter. Use the Shepp-Logan phantom ().
(b) Reconstruct with projections. Compute the PSNR.
(c) Implement the Shepp-Logan and cosine filters. Reconstruct with and compare all three filters in PSNR and visual quality.
(d) Plot the three filter frequency responses . Explain why the cosine filter suppresses streak artifacts.
(e) What is the minimum for PSNR dB with each filter?
The Ram-Lak filter is ; discretize carefully to avoid the DC singularity.
The cosine filter rolls off high frequencies, reducing aliased energy that creates streaks.
Filter responses
Ram-Lak: . Shepp-Logan: . Cosine: . The cosine filter suppresses high spatial frequencies where angular undersampling causes aliasing (streaks).
Minimum views for 25 dB
Typically: Ram-Lak needs ; Shepp-Logan ; cosine . The smoother filters tolerate sparser sampling.
ex03-ewald-geometry
Easy(a) Write a function that computes the Ewald circle for a given incident direction and wavenumber .
(b) Plot the Ewald circles for views at GHz. Label each circle with its view angle.
(c) For each configuration, compute the coverage ratio (fraction of the disk that is covered).
(d) At what does exceed 0.9 for a single frequency?
(e) Add frequencies (8--12 GHz). How does the coverage change?
Discretize each Ewald circle into approximately 360 points and compute coverage on a grid.
Ewald circle formula
For incident direction : . The circle has center and radius .
Coverage analysis
With a single frequency, requires (the arcs are thin curves with limited area). Adding frequencies increases coverage substantially because each view now fills an annular band rather than a single arc.
ex04-diffraction-tomography
Medium(a) Create a 2D object () with 3 circular inclusions of varying contrast () in a homogeneous background.
(b) Simulate the scattered field under the Born approximation for views and frequencies (8--12 GHz). Add noise at dB.
(c) Reconstruct using: (i) gridding + IFFT with DCF, (ii) CGLS (100 iterations).
(d) Compare PSNR and visual quality. Which method best preserves the circular boundaries?
(e) Reduce to views. How do the results change? Which method degrades more gracefully?
For Born simulation, compute the forward integral via FFT convolution with the Green's function.
CGLS handles incomplete data better because it implicitly regularizes via early stopping.
Forward simulation
The Born model gives . Implement via FFT-based convolution for each view and frequency.
Reconstruction comparison
At , both methods produce reasonable reconstructions (PSNR -- dB). CGLS slightly better preserves edges. At , gridding shows severe streaks (PSNR dB) while CGLS remains acceptable (PSNR dB) due to implicit regularization from limited iterations.
ex05-coverage-optimization
Medium(a) For a fixed budget of views, find the set of angles that maximizes the coverage ratio (single frequency, GHz).
(b) Compare: (i) uniform spacing, (ii) random angles, (iii) greedy selection (add the angle that maximally increases ).
(c) Plot vs. for all three strategies.
(d) Repeat for wideband (8--12 GHz, ). Does the optimal angle selection change?
(e) For limited-angle imaging ( only), which Fourier regions are always missing?
Greedy maximization of coverage ratio is a set cover problem; it gives a -optimal solution.
Greedy algorithm
Initialize . For : choose where is the Ewald arc for angle .
Result analysis
Greedy and uniform give similar for single-frequency (both for ). For wideband, greedy slightly outperforms uniform because it can exploit the radial diversity to place views where angular gaps matter most. Limited-angle imaging always misses the Fourier quadrant opposite to the view range.
ex06-density-compensation
Medium(a) For views and frequencies, compute the Ewald arc sample positions on a Fourier grid.
(b) Implement the Voronoi-based DCF: compute the Voronoi cell area for each sample point.
(c) Implement the iterative (Pipe-Menon) DCF with 20 iterations.
(d) Reconstruct a test object with and without the DCF. Compare PSNR and visual quality.
(e) Plot the DCF as a function of . How does it compare to the theoretical ramp filter ?
Use scipy.spatial.Voronoi; clip infinite cells at the boundary.
Without DCF, the reconstruction is biased toward low spatial frequencies.
DCF effect
Without DCF, low spatial frequencies are overweighted (they appear in multiple overlapping arcs), producing a blurred reconstruction with PSNR -- dB lower. The Pipe-Menon DCF closely approximates the Voronoi DCF and produces reconstructions with uniform frequency weighting.
Comparison with ramp filter
The DCF approximately follows at low spatial frequencies (similar to the ramp filter in FBP) but deviates at high frequencies where the Ewald arc density is non-uniform.
ex07-nufft-reconstruction
Medium(a) Implement gridding + FFT reconstruction using a Kaiser-Bessel interpolation kernel (, oversampling ).
(b) Implement NUFFT-based reconstruction using the
finufft library (or equivalent).
(c) Compare both with direct summation on a problem. Verify they produce the same result (within tolerance).
(d) Benchmark computation time for grid sizes . At what does gridding become faster than direct summation?
(e) Vary the Kaiser-Bessel width and measure reconstruction error vs. computation time.
The deapodization step divides by the Fourier transform of the Kaiser-Bessel kernel at each image point.
Gridding typically becomes faster than direct summation at .
Crossover point
Direct summation is where is the number of k-space samples. Gridding + FFT is . For typical and , gridding wins above .
Kernel width tradeoff
: fast but inaccurate (relative error ). : standard choice (error ). : marginally better accuracy but 80% more gridding operations. is the standard tradeoff.
ex08-born-validity
Hard(a) Simulate scattering from a dielectric cylinder of radius and contrast using the exact Mie series solution (2D).
(b) Compute the Born approximation prediction for the same cylinder.
(c) Plot the relative error as a function of the scattering parameter .
(d) At what does the Born error exceed 10%? 20%?
(e) Reconstruct the object using FDT + gridding with exact and Born data. At what does the reconstruction PSNR drop below 20 dB?
(f) Compare with the Rytov approximation. For which objects is Rytov more accurate than Born?
The 2D Mie series uses Bessel and Hankel functions of integer order.
Rytov is more accurate for large objects with small refractive index contrast.
Born validity threshold
The Born approximation typically breaks at -- (10% error) and fails badly at (50%+ error). The Rytov approximation extends the validity to -- for smooth objects because it correctly handles phase accumulation even when the total phase shift is large.
Reconstruction impact
PSNR drops below 20 dB at for Born and for Rytov. Beyond these thresholds, iterative methods (DBIM) are needed.
ex09-near-field-tomography
Hard(a) Simulate near-field scattering from 3 point scatterers using the exact Green's function (spherical waves) at GHz. Measurement array: 32 elements on a circle of radius 20 cm.
(b) Reconstruct using: (i) far-field FDT (plane-wave model), (ii) near-field model (spherical-wave back-propagation).
(c) Compute position error and PSNR for both methods.
(d) Vary the array radius from 10 cm to 2 m. Plot PSNR vs. distance for both methods. At what distance do they converge?
(e) Implement the NF-FF transformation for a planar measurement surface. Apply it to the near-field data, then reconstruct with the far-field FDT. Compare with direct near-field reconstruction.
The NF-FF transformation is a 2D spatial FFT, propagation phase correction, then IFFT.
Both methods should converge around .
Near-field advantage
At 20 cm range (), the far-field model gives PSNR dB with 8 mm position errors. The near-field model gives PSNR dB with sub-millimeter position errors.
Convergence distance
Both methods converge (PSNR difference dB) at . For cm at 10 GHz: m.
ex10-multi-freq-synthesis
Hard(a) Implement bandwidth synthesis: combine narrowband measurements at frequencies uniformly spaced from 8 to 12 GHz.
(b) Verify that the range resolution matches cm for GHz. Place two point scatterers at varying separations and find the minimum resolvable separation.
(c) What happens if the frequency spacing exceeds MHz (for a 30 cm object)? Demonstrate range ambiguity.
(d) Add 10% random phase errors across frequencies (simulating oscillator drift). How does this affect the range resolution?
(e) Implement phase-error calibration using a single known reference scatterer. Show that the phase errors can be estimated and corrected.
Range ambiguity appears as ghost targets at multiples of .
Phase calibration uses the known scatterer position to estimate the phase offset at each frequency.
Bandwidth synthesis verification
With coherent combination of 20 frequencies over 4 GHz bandwidth, the range profile shows a sinc-like peak with mainlobe width matching cm. Two scatterers are resolvable at separations cm.
Range ambiguity
When MHz, ghost targets appear at range offsets of . For GHz: ghosts at cm -- within the 30 cm object.
Phase calibration
The reference scatterer at known position provides the expected phase at each frequency. The difference between expected and measured phase gives the frequency-dependent phase error, which can be subtracted from all measurements.
ex11-resolution-analysis
Hard(a) For the configuration: GHz, GHz, , (full ), compute and plot the 2D PSF.
(b) Measure the dB mainlobe width in range and cross-range. Compare with the theoretical predictions and .
(c) Measure the peak sidelobe level. Compare between Ram-Lak, Shepp-Logan, and cosine filters.
(d) Repeat for limited aperture: . Plot resolution (range and cross-range) vs. aperture angle.
(e) Place two point scatterers at varying separations. Determine the minimum resolvable separation (Rayleigh criterion) for each configuration.
The PSF is the inverse FFT of the filtered coverage indicator function.
Compute the PSF on a fine grid (at least oversampled) for accurate mainlobe measurement.
PSF measurement
For GHz, full aperture: range mainlobe cm (close to theoretical cm); cross-range mainlobe cm (close to cm at 12 GHz).
Filter comparison
Peak sidelobe levels: Ram-Lak dB, Shepp-Logan dB, cosine dB. The tradeoff is sidelobe level vs. mainlobe width (cosine has wider mainlobe).
ex12-limited-angle-regularized
Hard(a) Create a scene with 5 objects (mix of point and extended targets). Simulate DT data with views limited to , , , dB.
(b) Reconstruct with gridding + IFFT. Identify the artifact pattern and explain it in terms of missing Fourier data.
(c) Reconstruct with FISTA + regularization.
(d) Reconstruct with ADMM + TV regularization.
(e) Compare all three methods in PSNR and visual quality. Which best fills the missing Fourier data?
(f) Increase the aperture to , then . At what aperture does gridding match the regularized methods?
Limited-angle tomography produces an elongated PSF along the missing directions.
TV regularization is particularly effective for extended targets with sharp edges.
Artifact analysis
Quarter-aperture () leaves three-quarters of the angular Fourier data missing. The gridding reconstruction shows severe directional streaks and elongation of point targets along the missing directions.
Regularization comparison
FISTA (): PSNR dB; good for point targets, less effective for extended objects. ADMM (TV): PSNR dB; best for extended targets with edges; mild staircase artifacts. Gridding matches regularized methods at approximately -- aperture.
ex13-xlmimo-nearfield
Hard(a) Model an XL-MIMO array with m aperture at 28 GHz ( cm), 128 elements. Compute .
(b) Place 5 point scatterers at range m. Simulate the received signal using the exact near-field Green's function.
(c) Reconstruct using: (i) far-field beamforming, (ii) near-field beamfocusing.
(d) Compute and compare the PSFs for both methods at ranges m.
(e) At what range does far-field beamforming become acceptable (PSNR within 1 dB of near-field)?
Near-field beamfocusing uses range-dependent phase compensation: the steering vector depends on both angle and range.
The transition occurs near for practical purposes.
Far-field distance
m. At m, the target is at -- deep in the Fresnel zone.
Transition analysis
Far-field beamforming becomes acceptable (PSNR within 1 dB) at approximately m (). This is earlier than the formal Fraunhofer criterion because imaging tolerates some PSF broadening.
ex14-full-pipeline
ChallengeBuild an end-to-end diffraction tomography imaging system:
(a) Scene: A cm region with 3 dielectric cylinders (radii 1, 2, 3 cm; contrasts ) plus 5 point scatterers.
(b) System: 24 Tx and 24 Rx on a 30 cm circular array. Frequency: 6--14 GHz, 32 stepped frequencies.
(c) Forward model: Born approximation with near-field Green's functions (the array is in the Fresnel zone).
(d) Reconstruction pipeline: (i) Compute coverage map and PSF. (ii) Gridding + IFFT with DCF (fast preview). (iii) FISTA + for sparse refinement. (iv) ADMM + TV for edge preservation of extended targets.
(e) Evaluation: PSNR, SSIM, and computation time for each stage.
(f) Sensitivity analysis: Vary from 10 to 40 dB. At what does gridding become acceptable (PSNR dB)? At what does regularization become essential?
(g) Near-field impact: Compare reconstruction with and without near-field correction. Quantify the PSNR loss from ignoring phase curvature.
Use the NUFFT for efficient Fourier-domain operations throughout the pipeline.
The near-field correction is most important for the innermost array elements.
Progressive refinement: gridding provides initialization for FISTA, which provides initialization for ADMM+TV.
Pipeline performance
Typical results at dB: Gridding: PSNR dB, 0.1 s. FISTA: PSNR dB, 5 s. ADMM+TV: PSNR dB, 15 s. Near-field correction adds -- dB at this configuration.
Sensitivity thresholds
Gridding acceptable ( dB) at dB. Regularization becomes essential (gridding PSNR dB) at dB.
ex15-fbp-cnn
Challenge(a) Train a simple CNN (3--5 convolutional layers) to post-process FBP reconstructions from limited-view DT.
(b) Training data: Generate 500 random phantoms (random circles and rectangles), simulate DT data (, , dB), reconstruct with gridding. Pairs: (gridding output, ground truth).
(c) Evaluate on 50 test phantoms. Compare: (i) gridding alone, (ii) gridding + CNN, (iii) FISTA ().
(d) How does the CNN perform on out-of-distribution phantoms (e.g., phantoms with triangular objects, not seen in training)?
(e) Discuss: is this approach (physics initialization + learned refinement) more or less robust than end-to-end learning? Connect to the FBPConvNet paradigm.
Use a U-Net architecture (3 levels) for the post-processing CNN.
Out-of-distribution generalization is a key limitation of purely data-driven methods.
Expected results
Gridding + CNN typically achieves PSNR -- dB, comparable to or slightly better than FISTA, with much faster inference ( ms vs. s). The CNN effectively learns to suppress streak artifacts.
Generalization
On out-of-distribution phantoms, the CNN's PSNR drops by -- dB, while FISTA's performance is largely unchanged. This motivates hybrid approaches (Chapter 13) that combine physics-based algorithms with learned components.