Stella Nova
How CT works

Medical imaging · inverse problems · 1917 to today

How CT works: a picture of the inside, made from shadows

An X-ray photograph squashes a whole body into one shadow. A CT scanner takes hundreds of shadows from every direction around you, then solves for the one slice that could have cast all of them. Watch it happen below: the source turns, each turn fills a sinogram, and the image sharpens view by view.

Every figure on this page runs a real reconstruction in your browser: our own JavaScript code for the textbook algorithms, the same ones the ASTRA Toolbox runs on GPUs for research scanners. The phantoms are drawn shapes with realistic attenuation, not patient scans. Each figure has a link to the matching experiment in the CT Lab.

01

Shadows: how X-rays fade

An X-ray photon either crosses the body or is taken out of the beam, mostly by scattering off electrons and by the photoelectric effect. Every millimetre of tissue removes the same fraction of the photons that reach it. That is why the beam fades exponentially, and bone, with more electrons per millimetre, removes a larger fraction than soft tissue.

Photons through one row of a head

Open in CT Lab →

Each dot is a photon. Orange flashes are photons taken out of the beam. Tap or drag on the head to move the beam. The counter on the right compares the counted fraction with the exponential law.

The Beer-Lambert law

The attenuation coefficient μ says what fraction of photons a material removes per centimetre. At 70 keV, water has μ ≈ 0.19 /cm and dense bone two to three times that.

Take the logarithm and the exponential is gone. The detector reading becomes p, the sum of μ along the ray. A CT scanner measures thousands of such line sums. The rest of the page is about turning them back into μ at every point.

02

One projection: a row of line integrals

Line up many parallel rays and one detector element behind each. The row of readings is a projection: the object squashed flat in one direction. A single projection cannot tell a dense spot at the front from the same spot at the back. Turn the beam and the answer changes.

The Radon transform

The delta function keeps only the points on the line at distance s from the centre, with its normal at angle θ. Johann Radon showed in 1917 that if you know p for every θ and every s, you know μ everywhere. He also gave the inversion formula, more than fifty years before anyone had a reason to use it.

Over 180° of parallel rays, every line has been measured once. Going on to 360° measures each line again from the other side.

03

The sinogram: every projection, stacked

Put each projection in a column, one column per angle, and you get a sinogram. It is the raw data of every CT scan. The name comes from what a single point does in it: as the beam turns, the point's shadow slides back and forth across the detector along a sine curve.

Turn the gantry and watch the columns fill

Open in CT Lab →
Tap the object to move the point.

A point at (x0, y0) lands on the detector at s(θ). Its amplitude is the point's distance from the centre and its phase is the point's direction. Every object is a sum of points, so every sinogram is a sum of sine curves, which is why a sinogram looks like woven ribbons. The dashed amber curve is this formula, drawn over the data.

04

Back-projection, and why it blurs

The obvious way back: take each projection and smear it back across the image along the rays it came from, then add up all the smears. Bright spots get smeared through from every angle and pile up where they belong. But the smear also lands everywhere else.

The 1/r star

With a few views, a point back-projects into a star of lines. With many views the star fills in, but it does not go away: the sum falls off only as 1/r with distance from the point. The back-projected image is the true image blurred by 1/r.

Every edge gets a halo and every organ a glow. To remove that blur we need to know what 1/r does to each spatial frequency. That is a job for the Fourier transform.

05

The Fourier slice theorem

Here is the key fact of tomography. Take the one-dimensional Fourier transform of one projection. It equals the two-dimensional Fourier transform of the image along one line through the centre, at the same angle as the beam. Each view gives one spoke of the image's spectrum.

Each view fills one line of k-space

Open in CT Lab →

The middle panel is built only from the sinogram: the 1D spectrum of each projection, placed on its spoke. It matches the right panel, the 2D Fourier transform of the object, computed directly. Fill in every spoke, invert the 2D transform, and you have the image. Look at the spokes, though: near the centre they crowd together, at the edge they spread apart. Plain back-projection counts the crowded low frequencies too often, and that excess weight is exactly the 1/r blur.

06

Filtered back-projection

The fix is to weight each spoke by its spacing, which grows in proportion to the frequency |k|. In practice you filter each projection with a ramp before you smear it back. The ramp boosts fine detail, adds negative side lobes around every edge, and these cancel the halos when the views are added up. This is filtered back-projection (FBP), and nearly every clinical scanner has used it for fifty years.

The ramp filter and its windows

Open in CT Lab →

The bare ramp (Ram-Lak, after Ramachandran and Lakshminarayanan, 1971) is the sharpest, and it also boosts noise most, because noise lives at high frequencies. A window W(k) rolls the ramp off: Shepp-Logan a little, Cosine, Hamming and Hann more. The cutoff stops the filter below the detector's Nyquist frequency. Sharper or quieter: you choose, per scan, and the change also drives the figure below.

Same views, with and without the filter

Open in CT Lab →

Views arrive spread over 180°, so at first you see the streaks of a few views. The filtered image (right) uses the window chosen above. The PSNR compares it with the true object; higher is closer.

07

Parallel, fan and cone beams

The first scanner, EMI's in 1971, used one pencil beam and one detector. It stepped across the head, turned one degree, and stepped across again, 180 times: several minutes for each pair of slices. Third-generation scanners spread the beam into a fan and caught it on an arc of hundreds of detectors, so one turn of well under a second gives a slice. Cone-beam scanners open the beam in the other direction too and catch it on a flat panel, which gives a whole volume per turn.

What changes in the maths

Fan beam. Each fan ray is also a parallel ray at some angle, so you can re-sort (rebin) fan data into parallel projections and use FBP. Or you filter the fan data directly, with a weight for the ray's distance from the source. Both need 180° plus the fan angle of data; this page's engine uses a full turn.

Cone beam. Rays that leave the central plane cross several slices. Feldkamp, Davis and Kress (1984) gave the standard approximation, FDK: weight each detector row by its cone angle, ramp-filter along rows, and back-project along the real 3D rays. It is exact in the mid-plane and drifts further out, which shows as streaks at the top and bottom of the volume.

The panel at the bottom right shows what the detector reads at this angle: a profile for the fan and the pencil beam, a full 2D projection for the cone.

Fan beam in the CT Lab → The lab works in 2D, so it has fan presets but no cone preset.

08

Iterative reconstruction: CT as a system of equations

Forget calculus for a moment. Split the slice into pixels, unknowns xj. Each ray adds up the pixels it crosses, weighted by its path length in each one: one linear equation per ray. A scan is a huge system Ax = b, with a row for every ray and a column for every pixel. Solve it, and you have the image. Hounsfield's first scanner solved it this way.

Four solvers on 30 noisy views

Open in CT Lab →

ART (Kaczmarz 1937; Gordon, Bender and Herman 1970) takes one ray at a time and moves the image just enough to satisfy that ray. On the left, each line is one ray's equation: the estimate zigzags between them towards the crossing. When two rays are nearly parallel, the zigzag is slow. ART in the CT Lab →

SIRT uses all rays at once and averages the corrections, with R and C the inverse row and column sums. It is smooth and slow. SART (Andersen and Kak 1984) does the same one view at a time. CGLS runs conjugate gradients on the least-squares problem and gets close in a few steps.

The curves show the error against the true object, not the fit to the data. With noisy data, the solvers first approach the truth and then start to fit the noise; stopping early is itself a kind of regularisation. With few views or low dose, iterative methods beat FBP (dashed), which is why modern scanners use them to cut dose.

09

Artefacts: when the model is wrong

Reconstruction assumes a perfect world: enough photons, enough angles, one energy, perfect detectors, an object that holds still. Each broken assumption leaves its own fingerprint in the image. Radiologists learn to read them, and scanner makers spend fortunes to correct them.

Break one assumption at a time

Open in CT Lab →

Noise and dose. Photon counts follow Poisson statistics, so the noise in each reading goes as 1/√I. Halve the dose and the noise grows by √2. The ramp filter then amplifies it into fine streaky grain. Every CT protocol trades this grain against radiation dose.

10

Hounsfield units and windows

A scanner reconstructs μ, which depends on the beam energy. To make images comparable, CT reports the Hounsfield unit (HU) instead, fixed by two points: air is −1000 and water is 0. Each HU is one tenth of a percent of the attenuation of water.

One slice, four ways to look at it

Open in CT Lab →

Hover or tap the slice to read the value. A screen shows about 256 greys and the eye separates far fewer, but the HU scale spans thousands. A window picks a band of the scale, a level at its centre and a width, and spreads only that band over black to white.

The definition

Fat is around −100, soft tissue and blood a few tens above zero, and dense bone near +1000 and more. Brain grey and white matter differ by only a few HU, so the brain window is just 80 HU wide. The lung window is wide and low, to show airways and vessels inside dark lung. The bone window is wider still.

The HU values on this page come from our phantom's mixes at 70 keV, so they are close to clinical values, not equal to them.

11

A short history

The mathematics came first, by decades. The machine came from a record company's research lab.

  1. 1895Wilhelm Röntgen discovers X-rays in Würzburg. The first medical radiographs follow within weeks.
  2. 1917Johann Radon, in Vienna, proves that a function in the plane is fixed by its integrals along all lines, and gives the inversion formula.
  3. 1937Stefan Kaczmarz publishes the row-by-row method for linear systems that later becomes ART.
  4. 1956Ronald Bracewell reconstructs maps of the Sun's radio emission from strip scans, using the Fourier slice idea.
  5. 1963–64Allan Cormack, a physicist in Cape Town and at Tufts, works out how to reconstruct attenuation from line measurements and tests it on a simple phantom. Few people read the papers at the time.
  6. 1970Gordon, Bender and Herman describe ART for electron microscopy and X-ray photography.
  7. 1971Ramachandran and Lakshminarayanan publish the convolution form of filtered back-projection. On 1 October, the EMI scanner built by Godfrey Hounsfield scans its first patient at Atkinson Morley's Hospital in London and shows a brain tumour.
  8. 1974Lawrence Shepp and Benjamin Logan publish the head phantom of ten ellipses that this page uses, and a filter.
  9. 1979Cormack and Hounsfield share the Nobel Prize in Physiology or Medicine.
  10. 1984Feldkamp, Davis and Kress publish cone-beam FDK. Andersen and Kak publish SART.
  11. 1989Willi Kalender and colleagues introduce spiral (helical) CT: the table moves while the gantry turns.
  12. 2015–16The ASTRA Toolbox papers describe an open GPU toolbox for 2D and 3D tomography that many research groups now use.
12

Credits and the real tool

This page and the CT Lab were inspired by the ASTRA Toolbox, the open-source, GPU-accelerated toolbox for tomography from imec-Vision Lab (University of Antwerp) and CWI (Amsterdam). If you want to reconstruct real data, use it.

ASTRA Toolbox

github.com/astra-toolbox/astra-toolbox · astra-toolbox.com

  • W. van Aarle, W. J. Palenstijn, J. De Beenhouwer, T. Altantzis, S. Bals, K. J. Batenburg and J. Sijbers, “The ASTRA Toolbox: A platform for advanced algorithm development in electron tomography”, Ultramicroscopy 157 (2015) 35–47. doi:10.1016/j.ultramic.2015.05.002
  • W. van Aarle, W. J. Palenstijn, J. Cant, E. Janssens, F. Bleichrodt, A. Dabravolski, J. De Beenhouwer, K. J. Batenburg and J. Sijbers, “Fast and flexible X-ray tomography using the ASTRA toolbox”, Optics Express 24(22) (2016) 25129–25147. doi:10.1364/OE.24.025129

The ASTRA Toolbox is GPL-3.0 software. No ASTRA code is used or ported here: this page runs our own JavaScript implementation of the published algorithms.

The algorithms on this page

  • J. Radon (1917), the line-integral transform and its inverse.
  • A. C. Kak and M. Slaney, Principles of Computerized Tomographic Imaging, IEEE Press (1988): FBP, fan-beam FBP and the discrete ramp filter.
  • L. A. Shepp and B. F. Logan, “The Fourier reconstruction of a head section”, IEEE Trans. Nucl. Sci. 21 (1974): the phantom.
  • P. M. Joseph (1982): the ray projector with linear interpolation.
  • L. A. Feldkamp, L. C. Davis and J. W. Kress, JOSA A 1 (1984): cone-beam FDK.
  • R. Gordon, R. Bender and G. T. Herman (1970): ART. A. H. Andersen and A. C. Kak (1984): SART. M. R. Hestenes and E. Stiefel (1952): conjugate gradients.

The procedural phantoms (head, chest, suitcase, walnut, hip) are our own drawings. Attenuation values are approximate figures for water, bone and iron at 70 keV, mixed coarsely. No patient data is on this page.

Try everything in the CT Lab →