CT scanner (x-ray CAT scan)

Some of the techniques used in Tomography were developed by the radiologist Alessandro Vallebona in the 1930's. Vallebona created a technique to overcome the problem of trying to take clear x-ray images of targets lost in the distracting clutter of foreground and/or background objects. How do you isolate the target from the clutter? For example, say you wanted to create a cross-section image of the spine. This would be difficult because no matter that angle you take the image from you will get the ribs and internal organs getting in the way. Vallebona's technique was simple and clever. While taking a long exposure he would rotate the x-ray emitter one direction while simultaneously rotating the film in the opposite direction. Anything at the center of rotation would appear still, while objects away from the center of rotation would be blurred away. Special equipment is needed to allow the x-ray emitter to smoothly track the film so that the x-ray emitter and film do not move relative to each other.

If this sounds confusing then imagine you are outside a picket fence that surrounds the house. You can't take a good photo of the house with all the picket slats blocking the view, but if you were looking at the house while sitting in a car driving past the house then the picket slats would blur together and the fence would appear to disappear. To take advantage of this effect with your camera you can't use a fast exposure because that would freeze the slats as if you were not moving. You need a long exposure to blur the fence away, but this would also blur the house; however, if you pivot the camera to track the house while you make the exposure then the wooden slats would still stay blurred, but the house would appear still. A similar trick is used to photograph a race car as it speeds by. Using a high-speed shutter will freeze everything as if there were no motion and you end up with a boring picture of a car sitting in the road with a bunch of people staring at it. But if take the shot with a slow shutter while you track the car speeding past you then the road and the spectators will be a speeding blur, but the car will be in focus.

Back to x-rays...

In a modern Computed Tomography (CT or CaT) system an x-ray emitter and a 1-dimensional detector band is rotated 360 degrees with the target in the middle. The detector band records how much the target attenuates the x-rays at different angles. A series of these snapshot recordings are saved at regular intervals. The series of 1-dimensional bands are used to reconstruct the 2-dimensional plane that intersects a projection of each bands. The number of bands in the series can vary. The more that are recorded, the better the reconstruction. The most common method is called filtered back projection. This is an easy algorithm to implement. Seeing the original reconstructed from a series of projections is rather magical. It seems too easy, but you get what you pay for. Filtered back projection suffers from a number of flaws including artifacts, ambiguous reconstruction shadows, and sensitivity to noise and missing data. No method is perfect, but there are alternatives which are better than filtered back projection. One alternative method is called iterative reconstruction. This method is much more complex and computationally expensive than filtered back projection, but it deals better with noise, incomplete data, and it produces fewer artifacts. There are many algorithms that follow the iterative reconstruction method. One example is Algebraic reconstruction.

In this demo I synthesize a set of 1-dimensional projections of a target image at different angles, then I reconstruct an approximation of the original target image.

Johann Radon defined a transform that for a given target gives a set of 1-dimensional projections of the average of the target's density along lines parallel to a given angle. This transform is called the Radon transform. In our case, the target's "density" is the pixel's brightness. The set of 1-dimensional projections is called a "sinogram", and is graphed along an axis for the angle each 1-dimensional projection.

The Radon transform is related to the CT scanner's recordings of x-ray beam attenuation. In fact, a CT scanner creates a Radon transform of a physical target. There is one minor distinction to note here. The value of an x-ray beam attenuation through a target is exponential. To make the x-ray recordings equivalent to a Radon transform density projection you would need to take the log of the recorded x-ray values. I use the Radon transform to simulate the set of 1-dimensional projections I might get from a CT scanner. Since I'm generating the Radon transform directly from the image, not using real x-ray recording values, I don't need to take the log of the values.

Johann Radon also showed that if you have a sinogram of a target then you can reconstruct an approximation of the original target with an inverse Radon transform. This simply overlays each 1-dimensional projection over each other.

The following are crude examples of filtered back projection that do not show how this technique would actually be implemented. In particular, I don't actually do filtering part of filtered back projection, so this is just back projection. In the real world the image data would be processed and filtered in the frequency domain (usually after taking the FFT). These examples demonstrate how far you can get with simple tools.

In the following example the 1-dimensional projections of the target are made using only 45 degree rotations of the target image. Each projection is shown located at an angle from which it was generated relative to the target.

After adding the four 1-dimensional projections together (composite overlay) you get the following CT image:

+++ =

As you can see, using only 90 degree projections does not give very good results. The more sections you use the better you can approximate the original image. I found that I needed to use 8 projections to even begin to get a recognizable image. The following example is generated from 8 projections:

Here is CT image made from 32 radial sections. 32 seems to be a good number for a CT image at this resolution:

This simple algorithm will work with very complex images. Given a photograph I synthesized 32 1-dimensional scans and then regenerated the photograph using the CT algorithm.

Shepp-Logan Phantom

Here are the results using the Shepp-Logan Phantom test
The Shepp-Logan Phantom is standard test image used in tomography literature to illustrate the quality of reconstruction algorithms. It's the "Lena" test image of the 3D imaging community. I would have chosen Lena Söderberg instead.

Beam Hardening

Electronic sources of x-rays generate polychromatic beams. That means the photons have a broad spectrum of energy (frequencies). This causes distortions when raw data from these sources is used in a CT reconstruction.

Why is this bad? Remember the 1-dimensional projection recordings are assumed to measure the attenuation of the x-ray beam through the target. Attenuation is exponential for x-ray photons of a single energy. The photos are either absorbed or transmitted by the same amount through a material of a given density. Photons of a different energy will be absorbed or transmitted by a different amount. If the attenuation measurement is made up of the combined attenuation of many different photo energy levels then measurement is no longer exponential. It is no longer possible to convert to a simple density projection by taking the log.

The effect will be a bogus artifact that makes it appear as if the outer edges of a target are more dense than internal features. Internal features can be totally lost.

One way to correct for this is to filter the x-ray source. This is fairly easy to achieve by having the x-ray beam first pass through a metal plate designed to filter out the lower energy photos while allowing high energy photons to continue. Thus the x-ray photons that do hit the target will be of a greater proportion of high energy photons. This narrows the spectrum, causing the attenuation recordings to more closely follow an exponential curve or at least a continuous function. Copper or Aluminum plates of various thicknesses are often used as filters.

It is difficult to filter for this effect using a software mapping from the recorded attenuation values to an exponential curve because there will not be a continuous relationship between density and attenuation. The attenuation function will change based on angle and the density of the materials involved in the attenuation. The entire premise of CT reconstruction is based on the fact that materials of different densities will always attenuate the beam by the same amount.

physical process control variables

peak kilovoltage (kVp) is the highest voltage supplied to the x-ray emitter. This sets the upper bound on the x-ray photon energy emitted. X-ray photons below this level will still be emitted, but none above this level will be emitted. This peak effects the radiographic contrast.

radiographic contrast refers to the difference between the number of x-ray photons that the target absorbs versus the number that effect the detector. High energy x-rays will penetrate farther. The effects of energy and target composition are complex. Sometimes better image contrast can be obtained with lower energy levels, but that might also require long exposures or higher radiographic density. Very high energy x-rays may zip right through a low density target. Even with very short exposures you may not get enough contrast between the target and background to form good image details. In general high energy x-rays lower contrast, but may be necessary to penetrate a dense or thick object or to produce an image using a faster exposure time than a lower energy source. This is important with live targets where you want to limit damage from radiation exposure. In fact, filters are often used in front of the target to remove low-energy x-rays from the spectrum since these only add useless radiation exposure to the target and will not contribute information to the image.

radiographic density refers to the number of x-ray photons emitted by the x-ray emitter that make it to the detector. This is mostly controlled by the current supplied to the x-ray tube. The higher the current the more photons you get (higher radiographic density). The photons are not weaker or stronger. In general, raising current will emit more x-ray photons with the same spectrum and peak kilovoltage energy level. The peak kilovoltage also contributes a smaller portion to the radiographic density. High energy x-ray photons produce more scattering. These scattered photons may actually hit the detector and so increase the radiographic density. The downside is that if you are trying to form an image these photons only add useless noise because they were scattered from their original direction.

x-ray vs. gamma

X-rays and gamma rays are basically the same thing -- photons. The distinctions between when to use one term versus another is not standardized. Often the term gamma ray refers to photons that come from the atomic nucleus (nuclear decay, annihilation, fusion, etc.), and the term x-ray refers to photons that come from interactions with electrons. Generally, gamma photons are higher energy than x-ray photons, but this is not a rule. Some radioactive isotopes emit gamma photons when they decay that have lower energy than small, diagnostic x-ray machines. There are linear accelerators that emit megavolt photons using a process essentially no different than a small, diagnostic x-ray machines.

scintillator phosphor

Bismuth germanate (BGO)

Name: Bismuth germanate

Note: Not used for imaging. Used as a scintillator detector.

Chemical Composition: Bi4Ge3O12

Peak Wavelength: 480 nm

Cesium iodide

Name: Cesium iodide

Note: highly hygroscopic!. Less light spread than gadolinium oxysulfide, but not as bright. Used in x-ray image intensifiers and CT scanners.

insulating oil bath

High voltage dielectric insulating oil: Dow Corning 710 silicone oil

Mineral oil works.

Motor oil is bad. Probably the detergent additives ruin the insulating properties. Used motor oil is a terrible idea -- fine suspended carbon and metal particles are not known for enhancing insulation properties.

shielding

1/16th inch = 1.5875 mm

Generally attenuation decreases with energy level, so use the kVp (peak kilovolt) value to determine the shield thickness to block the desired percentage of photons. Photon energy levels below the kVp will be blocked even more.

A non-intuitive fact of shielding is that the attenuation depends only on the energy level. Higher power will mean more photons, but the same percentage will be blocked.

A more complex example

The real world of x-rays is not so simple. In the experiments above, I actually synthesize the radial sections by averaging all the pixels in the rows. This roughly approximates how an x-ray reveals average density of a line through the target. But in the real world there can be materials inside the target that are so dense that they totally block x-ray energy. This reconstruction technique assumes that every part of a target is at least somewhat transparent. If there are parts of a target that are totally opaque even to x-rays then this will result in ambiguous, hidden sections. These hidden sections not only hide what is inside of them, but they also cause shadows that distort areas outside.

The following target is similar to the one used before except that it now has a screen added. The algorithm that synthesizes the radial sections was modified to treat any red are as totally opaque. The result is that anything inside the cup shaped screen is totally hidden. The dense area also throws off the contrast so that it is difficult to see the notch at the top of the target, but you can more or less make it out. These artifacts are known as computed tomography streak artifacts. They are seen in human subjects with metal implants.

Image processing

The image that results from the composite of the 1D sections has very low contrast. It is simple to expand the dynamic range of the image, but also note that the contrast is weighted towards the center. This is because the radial sections favor the center of the image. The center of the target has the most overlapping sections so the pixels near the center contribute more signal to the average. It's difficult to apply a uniform contrast enhancement over the entire image because the result will leave the edges too dark or the center too light. What is needed is contrast enhancement that will be weighted based on the distance from the center of the image.

Source code

This is a rough draft of the source code written in Python. It requires the PIL module for image manipulation.