Radon and Fourier slice filtering¶
| Fact | Value |
|---|---|
| Also called | Radon transform, Sinogram, Filtered back projection, Ramp filter, Fourier slice theorem |
| Status | Implemented and tested |
| Family | Frequency-domain filters |
| Engine | Science engine |
| Type | Linear, transform, Radon transform and filtered back projection |
| Output | Image |
| Operator shown as | transform (exact) |
| Support radius | global |
| Code | engine/src/pixelnexus_engine/filters/radon.py, radon_filter |
| Operator code | engine/src/pixelnexus_engine/filters/radon.py, radon_representation |
| Packages | scikit-image |
| Channels | Brightness only, RGB |
Overview¶
This filter shows how computed tomography works. The Radon transform adds up the image along parallel lines, for many angles, as an X-ray scanner does. The result is the sinogram. Back projection spreads each set of sums back over the image along its lines. Alone, that gives a blurred image. With the ramp filter first, it gives the image back. You can show the sinogram, the plain back projection or the filtered one, and change the number of angles and the filter window. The filter runs in the PixelNexus engine on your computer.
How it works¶
- Place the image in the middle of a square of zeros.
- For each angle, add up the image along parallel lines at that angle. Each angle gives one column of the sinogram.
- For the filtered back projection, sharpen each column with the ramp filter and the window.
- Spread each column back over the image along its lines, and add up all angles.
- Cut the result back to the image.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(I(x, y)\): The input channel, with x to the right and y downward from the middle
- \(p_\theta(t)\): The projection at angle theta, at position t along the detector
- \(n, \theta_i\): The number of angles and the angles themselves
- \(h\): The ramp filter, times the window
- \(Q_i\): The filtered projection at angle theta_i
- \(\hat{I}\): The rebuilt channel
The Radon transform p_theta(t) sums the image along the line at angle theta and distance t from the middle. Stacking the projections for all angles gives the sinogram. A point turns into a sine curve there, which gives the sinogram its name. The Fourier slice theorem says that the 1-D Fourier transform of one projection is the slice of the 2-D Fourier transform of the image along the same angle. So the projections hold the whole spectrum, but the slices crowd together near the center and spread apart far from it. Plain back projection smears each projection back along its lines and sums them. That blurs the image, since low frequencies are counted too often. The ramp filter h, whose response grows with |frequency|, undoes this weighting. Here h is the sampled ramp filter of Kak and Slaney. It has h(0) = 1/4, h(k) = -1 / (pi k)^2 for odd k and 0 for even k. It is applied with the FFT and multiplied by the chosen window. x grows to the right and y downward from the middle.
The Fourier slice theorem is the key to rebuilding the image. It says that the 1-D Fourier transform of one projection equals the 2-D Fourier transform of the image along a line through the origin at the same angle. So the projections at all angles fill the whole spectrum, line by line, like the spokes of a wheel. Near the center the spokes are close together, so plain back projection gives the low frequencies too much weight. The image comes out blurred, and a single point spreads out like 1 / r. The ramp filter multiplies each frequency by its distance from the center, which evens out the weights. Kak and Slaney show that sampling the ramp in space, as h(k), avoids a small bias that a ramp sampled in frequency would add. Windows such as Hann or Hamming lower the highest frequencies, where noise lives, at the cost of some sharpness. Shepp and Logan proposed one of these windows in 1974, for images of the head.
Kernel or operator¶
The Inspector asks the engine for the stages with the current settings. The first is the Radon transform with its angles. Then come the sinogram display, the plain back projection, or the ramp filter with its window and the filtered back projection.
Algorithm¶
- Place the channel in the middle of a square of zeros.
- For each of the n angles, sum the channel along parallel lines to get one projection.
- For the sinogram, resize the projections to the image and stretch them to the full gray range.
- Otherwise, filter each projection with the ramp filter and the window, or skip that for plain back projection.
- Smear each projection back along its lines, add them up and multiply by pi / (2 n).
- Cut the result back to the image.
Parameters¶
| Parameter | Default | Values | Meaning |
|---|---|---|---|
Output output |
Filtered back projection | Sinogram, Back projection without filter, Filtered back projection | Which stage to show. The sinogram is resized to the image, with the angle across and the position along the detector down. |
Angles angles |
180 | 2 to 720 | How many projection angles, spread evenly over 180 degrees. |
Filter window window |
Ramp | Ramp, Shepp-Logan, Cosine, Hamming, Hann | The window that multiplies the ramp filter, for the filtered back projection. |
Channels channelScope |
Brightness only | RGB, Brightness only | Which part of the color image the filter changes. |
Implementation¶
radon_filter in engine/src/pixelnexus_engine/filters/radon.py runs radon_plane on each channel the scope names. The function sinogram places the plane in a square of zeros with centered_square and calls skimage.transform.radon. The function back_project calls skimage.transform.iradon with the chosen window, or with none for the plain back projection. Then it cuts the result back to the plane. The sinogram is resized to the image with skimage.transform.resize. With the brightness scope, the sinogram and the plain back projection come out gray. There is no live preview. The result arrives when you click Apply.
Worked example¶
| Window | 10 angles | 30 angles | 90 angles | 180 angles | 360 angles |
|---|---|---|---|---|---|
| Ramp | 14.78 | 22.72 | 31.97 | 34.31 | 34.50 |
| Hann | 17.08 | 24.75 | 29.96 | 30.13 | 30.12 |
The PSNR in dB of the filtered back projection against the disks, 160 by 160 pixels. Here more angles help up to about 180. Beyond that, the sampled transform itself limits the result. The Hann window gives a lower PSNR on this clean image, since it softens fine detail. On noisy projections, it softens the noise too.
The Fourier slice theorem can be checked exactly at 0 degrees, where a projection is the sum of each column. For a random image of 48 by 48 pixels, the 1-D FFT of that projection and the row f_y = 0 of the 2-D FFT of the image differ by less than 1e-12, which is rounding.
Complexity¶
- Time: \(O(N n)\)
- Memory: \(O(N + n sqrt(N))\)
N is the number of pixels and n the number of angles. Each projection and each back projection touches every pixel once.
Artifacts and limitations¶
Limitations
- The sampled transform and its back projection are not exact inverses. Fine detail and thin lines lose some contrast.
- Slow for large images, since each angle touches every pixel twice.
- Values outside the image count as zero, so a bright image edge acts like a step.
Artifacts
- Straight streaks across the image when there are few angles.
- Ringing next to sharp edges with the ramp filter.
Tests¶
The projections of a disk are checked against its exact chord lengths, 2 sqrt(r^2 - t^2), at 12 angles. The Fourier slice theorem is checked exactly at 0 degrees. The whole filter is checked against radon and iradon of scikit-image on a square image. More tests check that a smooth image comes back closely, and that a point off the center of a wide image comes back in place. Plain back projection must fall off like 1 / r, and the ramp filter must remove that tail. The sinogram must fill the image size, and the Hann window must lower noise more than the ramp.
References¶
- Kak, A. C., and Slaney, M. Principles of Computerized Tomographic Imaging. SIAM, 2001. Reprint of the IEEE Press edition of 1988. DOI 10.1137/1.9780898719277.
- Shepp, L. A., and Logan, B. F. The Fourier reconstruction of a head section. IEEE Transactions on Nuclear Science 21(3), 21 to 43, 1974. DOI 10.1109/TNS.1974.6499235.
- scikit-image, skimage.transform.radon and iradon. https://scikit-image.org/docs/stable/api/skimage.transform.html