Difference between revisions of "CT x-ray scanner"

From Noah.org
Jump to navigationJump to search
Line 230: Line 230:
 
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 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.
+
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:targeto.png|frameless]] [[image:targeto_out.png|frameless]]
 
[[image:targeto.png|frameless]] [[image:targeto_out.png|frameless]]
 
  
 
== Image processing ==
 
== Image processing ==

Revision as of 11:19, 4 June 2011

CT scanner (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.

target.png section 4 0.png
section 4 3.png section 4 2.png section 4 1.png

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

section 4 0.png+section 4 3.png+section 4 2.png+section 4 1.png = target 4 out.png

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:

targetd animated.giftarget 8 out.png

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

target 32 out.png

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: hygroscopic! Used in x-ray image intensifiers and CT scanners.
  • Chemical Composition: CsI, CsI:Na<super>+</super>, CsI:Tl<super>+</super>
  • Peak Wavelength: 545 nm (Green)
  • Decay Time: 5 µs

Gadolinium oxysulfide

  • Name: Gadolinium oxysulfide, P43 (EIA) or GY (WTDS)
  • Note: Excellent scintillator for x-rays < 250nm
  • Chemical Composition: Gd2O2S:Tb
  • Peak Wavelength: 545 nm (Green), Chromaticity Coordinates=(0.344, 0.568)
  • Decay Time: 1ms to 10%
  • Quantum Yield (photons/eV/electron): 0.05
  • Emission Efficiency: 13%
  • Absorption: K-edge @ 50.22 keV
  • Effective atomic #: 59.5

Yttrium silicate

  • Name: Yttrium silicate, P47 (EIA) or BH (WTDS)
  • Note: Fast decay
  • Chemical Composition: Y2SiO5:Ce<super>3+</super>
  • Peak Wavelength: 400nm (Violet-blue), Chromaticity Coordinates=(0.173, 0.088)
  • Decay Time: 55ns
  • Quantum Yield (photons/eV/electron): 0.055
  • EIA- Electronics Industries Association of the USA.
  • WTDS- Worldwide Phosphor Type Declaration System.

x-ray sources

Small diagnostic x-ray heads: 60 kVp to 80 kVp

Mammography x-ray Mo/Mo tube (molybdenum target and molybdenum filter): 35 kVp, The characteristic radiation of molybdenum peaks at 18 (Ka) and 20 keV (Kb). The molybdenum target gives a narrow spectrum in the 18.20 keV range, which combined with the molybdenum filter cuts the peak abruptly at 20 keV.

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.

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.

For kVp = 80 kV

  • 0.01 mm Pb=25% x-ray shielded
  • 0.04 mm Pb=55%
  • 0.10 mm Pb=70%
  • 0.125mm Pb=80%
  • 0.25 mm Pb=96%
  • 0.35 mm Pb=97%
  • 0.50 mm Pb=99%
  • 1.00 mm Pb=>99%

So 1.5875 mm (1/16th inch) lead sheet should be sufficient for a medium sized dental x-ray head of 80 kV.

Formula to get the total attenuation for a given number of half-value layers where n = number of half-value layers
attenuation coefficient, µ = 2-n
Formula to get the n number of half-value layers needed to attenuate by the given attenuation coefficient, µ
n = -log2(µ) or n = - ln(µ) / ln(2)
Half-Value Layer, mm (inch)
Peak Voltage (kVp) Lead Concrete
50 0.06 mm (0.002") 4.32 mm (0.170")
100 0.27 mm (0.010") 15.10 mm (0.595")
150 0.30 mm (0.012") 22.32 mm (0.879")
200 0.52 mm (0.021") 25.00 mm (0.984")
250 0.88 mm (0.035") 28.00 mm (1.102")
300 1.47 mm (0.055") 31.21 mm (1.229")
400 2.50 mm (0.098") 33.00 mm (1.299")
1000 7.90 mm (0.311") 44.45 mm (1.750")

X-Ray Mass Attenuation Coefficients

X-ray mass attenuation coefficients for select elements.

See also the NIST values of the mass attenuation coefficient, μ/ρ, and the mass energy-absorption coefficient, μen/ρ, as a function of photon energy.

atomic number "Z", Element, atomic number to mass "Z/A", mean excitation energy "I" (eV), Density "ρ" (g/cm3)
 4, Be Beryllium,  0.44384,  63.7, 1.848E+00
12, Mg Magnesium,  0.49373, 156.0, 1.740E+00
13, Al Aluminum,   0.48181, 166.0, 2.699E+00
14, Si Silicon,    0.49848, 173.0, 2.330E+00
22, Ti Titanium,   0.45948, 233.0, 4.540E+00
26, Fe Iron,       0.46556, 286.0, 7.874E+00
28, Ni Nickel,     0.47708, 311.0, 8.902E+00
29, Cu Copper,     0.45636, 322.0, 8.960E+00
30, Zn Zinc,       0.45879, 330.0, 7.133E+00
47, Ag Silver,     0.43572, 470.0, 1.050E+01
50, Sn Tin,        0.42120, 488.0, 7.310E+00
56, Ba Barium,     0.40779, 491.0, 3.500E+00
64, Gd Gadolinium, 0.40699, 591.0, 7.900E+00
74,  W Tungsten,   0.40250, 727.0, 1.930E+01
78, Pt Platinum,   0.39984, 790.0, 2.145E+01
79, Au Gold,       0.40108, 790.0, 1.932E+01
80, Hg Mercury,    0.39882, 800.0, 1.355E+01
82, Pb Lead,       0.39575, 823.0, 1.135E+01
83, Bi Bismuth,    0.39717, 823.0, 9.747E+00
92,  U Uranium,    0.38651, 890.0, 1.895E+01

misc

Miniature X-Ray Generator with Pyroelectric Crystal Heating and cooling of the pyroelectric crystal LiNbO3 causes it to emit electrons. When these strike a copper target the target will emit x-rays through bremsstrahlung emission. Radius Health is working on a more sophisticated device that uses the same principle.

Lohmann x-ray tubes - "German engineering" may be a cliché, but no other phrase comes to my mind after I held one of these x-ray tubes. I only wish their web site had more pictures.

J. R. Hird, C. G. Camara, and S. J. Putterman, A triboelectric x-ray source, Appl. Phys. Lett., 2011, 98 (13).

http://www.wikiradiography.com/

http://www.wise-uranium.org/calc.html

http://www.nukeworker.com/

A more complex example

target n.png target n out.png target n out enhanced.png

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. targeto.png targeto out.png

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.

Click here to download: cat_scanner.py <include src="/home/noahspurrier/noah.org/engineering/src/python/x-ray_cat_scan/cat_scanner.py" highlight="python" />

misc

http://www.wise-uranium.org/calc.html

http://www.wise-uranium.org/rdcri.html

http://www.nukeworker.com/