A Wolfram Notebook on the Radon Transform and CT Scans
Introduction
Introduction
A century ago, in 1917, the Austrian mathematician Johann Radon (1887–1956) published a paper entitled “On the Determination of Functions from Their Integral Values along Certain Manifolds.” In two dimensions, the problem studied by Radon involved the reconstruction of a function of two variables from the values of its integrals over the set of all lines in the plane. The representation of a function in terms of its integrals along lines is now called its Radon transform in his honor. The operation studied by Radon in his paper of 1917 is referred to as the inverse Radon transform.
Radon’s research was motivated by developments in pure mathematics, and yet the ideas in his paper provide the theoretical basis for computed tomography (CT), which is a vital tool for screening and diagnosis in modern medicine.
Here, I would like to explain the connection between the Radon transform and CT scans using the built-in functions for computing symbolic Radon transforms and the image processing capabilities of the Wolfram Language.
I will begin by giving examples for computing the Radon transform and its inverse in closed form using RadonTransform and InverseRadonTransform, respectively. Next, I will show how a two-dimensional image of an object can be reconstructed from its image in Radon transform space using InverseRadon. Finally, I will explain how a practical application of these ideas allows doctors to probe a diseased organ in the human body by sending x-rays at different angles through it in a CT scan machine.
The Radon Transform
The Radon Transform
Let be a function of the two variables and . Consider a line given in normal form by the equation , as shown in the following figure.
f(x,y)
x
y
L
pxcos(ϕ)+ysin(ϕ)
Then the integral of along the line is given by:
f
ℛ(p,ϕ)=f(pcos(ϕ)-ssin(ϕ),psin(ϕ)+scos(ϕ))s
∞
∫
-∞
As the line varies, one obtains a function of the two variables and . This function is the Radon transform of .
L
ℛ(p,ϕ)
p
ϕ
f
For example, suppose that is the following Gaussian exponential function.
f
In[1]:=
f[x_,y_]:=E^(-x^2-y^2)
As seen in the following plot, has circular symmetry about the origin and decays rapidly to as and increase in absolute value.
f
0
x
y
Plot3D[f[x,y],{x,-2,2},{y,-2,2}]
Out[2]=
Hence, one expects that the Radon transform of will have an expression that does not depend on the angle and decays to 0 for large values of . This is indeed the case, as seen in the calculation below, which shows that the Radon transform is a Gaussian function of the variable alone.
f
ϕ
p
p
Integrate[f[pCos[ϕ]-sSin[ϕ],pSin[ϕ]+sCos[ϕ]],{s,-∞,∞}]
Out[3]=
-
2
p
π
This remarkably simple result can be obtained directly using RadonTransform.
RadonTransform[f[x,y],{x,y},{p,ϕ}]
Out[4]=
-
2
p
π
The situation can be summarized neatly by using DensityPlot to represent both the original function and its Radon transform.
{DensityPlot[f[x,y],{x,-2,2},{y,-2,2},FrameNone,TicksNone],DensityPlot[%,{ϕ,-π/2,π/2},{p,-3,3},FrameNone,TicksNone]}
Out[5]=
Note that, for convenience, the angle is plotted along the horizontal axis while the normal distance takes values along the vertical axis in the second density plot above.
ϕ
p
One can introduce some asymmetry into the function expression, as in the following example.
In[6]:=
g[x_,y_]:=(x^2+3y^2)E^(-x^2-y^2)
As expected, the Radon transform of depends on both and .
g
p
ϕ
RadonTransform[g[x,y],{x,y},{p,ϕ}]//FullSimplify
Out[7]=
1
2
-
2
p
π
2+42
p
2
p
Once again, the situation can be summarized by using density plots for both the function and its Radon transform.
{DensityPlot[g[x,y],{x,-2,2},{y,-2,2},FrameNone,TicksNone],DensityPlot[%,{ϕ,-π/2,π/2},{p,-3,3},FrameNone,TicksNone]}
Out[8]=
Thus, we see that the Radon transform is conceptually simple, although computing the required integrals is a nontrivial problem in general.
The Inverse Radon Transform
The Inverse Radon Transform
Another method for achieving the inversion is to use the relation of the Radon transform with the Fourier transform, which I will illustrate using an example.
This result agrees with that given by RadonTransform.
It is worth noting that the symbolic computation of the inverse Radon transform is even more involved than the direct transform. The ability to compute it in examples like the one above has been facilitated by a series of developments in the Wolfram Language, starting with MellinTransform and followed by HankelTransform (whose internal implementation relies on the computation of Mellin transforms), and finally improvements for the evaluation of two-dimensional Fourier transforms, which can be reduced to the evaluation of Hankel transforms for radially symmetric functions in two dimensions.
Image Reconstruction
Image Reconstruction
A two-dimensional image may be regarded as a function of two variables. Indeed, in the simplest case, a grayscale image can be constructed by specifying the gray level (from 0 to 1) at each pixel in the image. For instance, the following example constructs a 3×3 grayscale image using Image.
Color images can be constructed in a similar way, by specifying a triple of RGB colors at each pixel. Thus, it makes sense to talk about the Radon transform of the discrete function corresponding to such an image. The Radon image processing function computes this discrete transform on an Image expression, as shown here for the case of a disk in the plane.
The InverseRadon function can be used to reconstruct the image from its Radon transform.
InverseRadon uses robust numerical algorithms; hence, it can be used to reconstruct fairly complicated images. For example, the following is the Radon transform of an image showing the pancreas, liver, stomach and small intestine that was obtained using AnatomyData.
As seen here, InverseRadon gives a faithful reconstruction of the original image in an efficient manner.
Image reconstruction is the key tool that underlies computed tomography, which will be discussed in the next section.
CT Scans
CT Scans
The 1979 Nobel Prize in Physiology or Medicine was awarded to Allan Cormack and Godfrey Hounsfield for their contributions to the invention of computed tomography, commonly known as the CT scan. Soon after their invention, CT scans revolutionized doctors’ ability to visualize internal organs, and are now widely used for screening in emergency rooms and for the diagnosis of cancer and other diseases.
A modern CT machine, such as the one shown here, is a large boxlike machine with a short tunnel in the center. The patient lies on an examination table that slides into and out of this tunnel. X-ray tubes and electronic x-ray detectors are located opposite each other in a ring, called the gantry, that rotates around the hole in the machine. The gantry sends a fan-shaped beam of x-rays that are attenuated (diminished in intensity) as they pass through the patient’s body.
The CT scan produces a Radon image of a cross-section of an organ based on attenuation data collected by the detector at different angles. Two-dimensional images of the patient’s organs can be reconstructed from this information using the inverse Radon transform. For example, the following shows the Radon image of a cross-section of the bile duct in a patient who is suspected of having cholangiocarcinoma (cancer of the bile duct).
An image of the cross-section is reconstructed from the above as a part of the CT scan procedure. Here, we achieve the reconstruction using InverseRadon.
An examination of the CT scan image or, more typically, several such images allows the doctor to confirm the diagnosis of cancer in such cases.
Conclusion
Conclusion
Integral transforms have played a crucial role in shaping the modern technological revolution. In particular, the Fourier transform and the Laplace transform, which were developed during the nineteenth century and earlier, provide the mathematical basis for operations—such as filtering—that are used in electronic devices.
The Radon transform, which is a product of twentieth-century mathematics and builds upon the Fourier transform, is perhaps the deepest and most elegant integral transform, since it combines ideas from geometry and mathematical analysis. Computed tomography is currently the best-known application of this transform, but the Radon transform also finds use in other applications, such as barcode scanners and electron microscopy. The mathematical community continues to study this transform and its generalizations in the context of the theory of Lie groups and the analysis of linear partial differential equations. There is even some speculation that Radon-type transforms may provide geometrical insights into the foundations of modern physics.
I hope that you have enjoyed this brief introduction to the Radon transform, and welcome any comments or suggestions for further developments related to integral transforms in the Wolfram Language.