Print View

NERS/BIOE 580
Lab04 - Source Module B

Purpose:

In this module we will modify the x-ray spectrum which emerges from the target to account for filtration by the tube envelope and other added filtration that may be used to define the spectral shape of the x-ray beam before penetrating an object.

Discussion:

We have seen in the previous module how the x-ray spectrum from an x-ray tube target will have a large amount of low energy radiation. Much of this radiation will not be able to penetrate the glass and oil envelope that surrounds the target and forms the vacuum space. Moreover, low energy radiations that do not penetrate the subject can cause excessive radiation exposures in medical radiography. Thus, additional material is generally added to the beam to further remove low energy radiations. The spectral filtration caused by the glass and oil are referred to as intrinsic filtration and the added material, usually aluminum, is referred to as added filtration.

For molybdenum target tubes used to radiograph thin objects, the low energy characteristic radiations are of primary interest. In this case the tube will often have a beryllium window which is highly transmissive and an added molybdenum layer that reduces the bremsstrahlung radiation intensity above the characteristic peak.

Note: If you examine the spectra for a tungsten target spectrum at 100 kVp from the previous lab, you will notice a discontinuity at about 8 keV. This is due to self absorption in the target and the discontinuity that occurs in the tungsten absorption coefficient at the L edge.
The present version of spect_gen does not include the L characteristic radiations that would normally be seen near 8 keV. We will see in this lab that these are normally removed by added filtration and so this limitation in the spectral model is not significant.

Task Src-B0: XSPECT Procedures

In this module, we will generate an x-ray spectrum and attenuate it using the spect_gen.exe and atten.exe programs. When executing the XSPECT executable programs in the _xspect3.5/_bin folder, the input arguments need to be assembled and passed to the executable programs with any error messages caught. The commands to do this are in the _xspect3.5/_templates folder. For example, see the _xspect3.5/_templates/spect_gen.txt file.

To simplify the script commands used to execute these programs, TCL procedures have been written that incorporate the commands in the template files. The procedures are in the _xspect3.5/_tcl folder. For example, see the _xspect3.5/_tcl/spect_gen.tsp file. Using Microsoft Windows, you may want to set 'notepad' as the default for opening *.tsp files (NOTE: see the TIP at the end of this module regarding Notepad++). The input argument syntax for all procedures is documented in xspectTclProcedures.txt.

Towards the end of the link.tcl file there are script commands that initialize all of the *.tsp files in the .../_xspect3.5/_tcl directory:

  • #--------------------------------------------------------
  • # Define TCL directory and source required tcl procedures
  • set TCL [file join $env(XSPECT_DIR) _xspect3.5 _tcl]
  • # Source all tcl procedures in $TCL using
  • set tspList [glob -directory $TCL *.tsp]
  • foreach tsp $tspList {
  •     source $tsp
  • }

The 'source' command reads and interprets the commands in the *.tsp file so that the procedure can subsequently be called as a command. The 'glob' command, a pattern matching command common in Unix systems, is used to make a list of all *.tsp files in the directory and then a 'foreach ...' loop is used to source all files in the list. By sourcing all procedures, they become available if needed.

In the following laboratory modules, we will incorporate additional procedures into scripts. A general discussion of the methods used to combine procedure calls to form a model for a particular problem can be found in the xspect documentation. Read the documentation for xSpect, XSPECT_v3-5c.pdf, which is in $XSPECT_DIR/_xspect3.5/_doc.

Task Src-B1: Spectral attenuation program, 'atten.exe'

The program called 'atten' is similar to 'atten_coeff' which we used in Lab03 in that it uses the database to determine the transmission for a specified thickness of material. However, with atten the energy dependent transmission values are used to modify the spectral values contained in the current spectra.tmp file. Read the documentation for atten in $XSPECT_DIR/_xspect3.5/_doc. Then review the atten procedure in _xspect3.5/_tcl/atten.tsp.

By using the atten procedure, the program can be executed using a simple single line Tcl command:

  • ...
  • atten $matList
  • ...
Multiple layers of materials and their thicknesses are passed to the procedure using a Tcl list variable. A list in Tcl is a specific type of variable that has a set of variables grouped in brackets, {one two three}. For atten, the list variable is understood to be a list of lists, { {Mat1 T1} {Mat2 T2} {Mat3 T3} } , where T1, T2, T3, ... are the thicknesses in cm units for Mat1, Mat2, Mat3 ...

Task Src-B2: Intrinsic Filtration: Attenuation from x-ray tube and housing materials.

General purpose x-ray sources use a glass tube with the filament (cathode) and target (anode) placed in an oil filled housing. X-rays emerge from the housing using a thin exit port. Typical materials and thickness for the tube and housing are:

1.48 mm of glass_pyrex,
0.30 cm of oil, and
0.25 cm of al_1100.

Making a folder in your NERS580 course directory with a name such as 'Lab04' for use with this module. Then create a file named L04_Src-B2.tcl file and open it with a text editor (Note: see the tip at the end of this module). Add the following commands to initialize the environment and compute a filtered spectra.

  • #!/bin/sh
  • # The next line restarts using tclsh8.0 \
  • exec tclsh $0 ${1+"$@"}
  • # ----------------------------------------
  • # MODEL: ???
  • # AUTHOR: ??? DATE: ???
  • #
  • # ---------- Initialize XSPECT -----------
  • #set env(XSPECT_DIR) "C:/../../../_Rad-Img"
  • source $env(XSPECT_DIR)/_xspect3.5/_tcl/link.tcl
  • cd TEMP
  • ##########################################
  • #
  • # ------ spectra from an x-ray tube ---------
  • set intrinsicFiltration {
  •     {glass_pyrex 0.148}
  •     {oil 0.30}
  •     {al_1100 0.25}
  • }
  • spectGen 74 12 1 100 1
  • atten $intrinsicFiltration

The commands above the '### ... ###" line perform the initialization. This will be the same for future labs. If needed, fill in the path for env(XSPECT_DIR) and remove the comment character. The cd TEMP command change execution of the script to the TEMP directory where all files created by the script will be created. This is optional, but makes it easier to delete temporary files after the essential results have been moved elsewhere.

The script then defines a list variable called 'intrinsicFiltration' that describes the materials and thickness associated with the exit port. The spectGen procedure then generates a spectra.tmp file for a tungsten target (74) with a 12 degree target angle. The spectra is generated from 1 to 100 keV using increments of 1 keV.

Run the script to generate the spectrum.tmp file and verify that the attenuation was applied by reviewing the added notations at the end of the file. The XSPECT procedures include a utility to plot spectra using gnuplot. At the end of the file, add the plot command:

  • ...
  • plotSpectra spectra.tmp
The plotSpectra procedure is similar to the one written in Lab03 but additionally labels the axis with the spectral units. Run the script again to see the plot generated in a window. A png graphic file named temp.png is also created.

Task Src-B3: Added Filtration: Tungsten target spectra attenuated by aluminum.

In this task, we examine the effects of different amounts of aluminum filtration added outside of the tube housing exit port. Make a copy of the L04_Src-B2.tcl file and rename it for this task (for example L04_Src-B3.tcl).

Now we want to edit L04_Src-B3.tcl to describe the effects of adding additional filtration and show the results with several spectra on the same graph. We will use the 'foreach...' construction described in Tclsh.txt to set up a sequence of thickness values for aluminum added filtration. At the end of the current L04_Src-B3.tcl script, remove the plotSpectra spectra.tmp command and add;

  • #---------------------------------------------------
  • # added filtration applied to the xray tube spectrum
  • set mmTotal 0
  • foreach added {0.1 0.3 0.4 0.8} {
  •     atten [list "al_1100 $added"]
  •     set mmTotal [expr $mmTotal + $added*10]
  •     file copy -force spectra.tmp spectra${mmTotal}.tmp
  • }

Since variable values, $var, are not interpreted inside of curly braces, { .. }, the argument to the atten command is formed with the list command using a quoted pair to generate the input argument with variable substitution for $added. This repeatedly computes the attenuation of the spectrum as if plates of aluminum were sequentially added to the exit port of the xray tube. The 'file copy ..' command at the end makes a copy of the current spectra.tmp file having a modified file name. The '-force' option allows overwriting a file. The total amount of aluminum is computed within the loop, mmTotal, and used to for each filename. Note that the filename is formed with the variable value formed with brackets, ${..}. This syntax is used when a variable value is next to other characters.

Executing this script should generate a set of spectral files named spectra0.1.tmp, spectra0.3.tmp, spectra0.4.tmp, and spectra0.8.tmp. Look at the entries at the end of the last file and you will see the sequential attenuation that has been applied. The total added filtration of the last spectra is 16 mm of aluminum.

We used the plot procedure , ' plotSpectra fileList', above using a single arguement that was a valid spectra.tmp file. If the argument is a list of spectral files, i.e. {spectra1 spectra2 ...}, then multiple spectra are plotted on the same graph. We can use it here to plot multiple spectra on the same line by building the list at the end of the 'foreach' body using the list append command, 'lappend ..'. Then adding the plot command after the loop and renaming the png file;

  • foreach al {0.1 0.3 0.4 0.8} {
  •     ...
  •     ...
  •     lappend spectList spectra${mmTotal}.tmp
  • }
  • plotSpectra $spectList
  • file rename -force temp.png L04-B3.png

Task Src-B4: Added Filtration: Molybdenum target spectra attenuated by molybdenum.

Repeat task Src-B3 above for a molybdenum target x-ray tube. Make a copy of the L04_Src-B3.tcl script and rename it to L04_Src-B4.tcl. Change the parameter values in this file as follows;

  • Target: . . . . . . molybdenum (Z=42), 12 degree angle
  • kVp:. . . . . . . . 1 to 40.0 with increments of 0.5 keV
  • Intrinsic filt: . . beryllium .01
  • Added filt: . . . molybdenum { .001, .003, .004, .008, .016 }

Compare the results from this script for a molybdenum target with those for a tungsten target. Note in particular the fact that the added filtration for the molybdenum target tube modifies the high energy portion of the spectrum.

You may want to edit the temp.gpl file created and regenerate the plots using scaling that shows the bremsstrahlung spectra better. Try adding 'set yrange [0:5e+010] at the beginning, just after the comment.


TIP:

In the last two labs, it was suggested that a text editor such as Notepad be used to review and write tcl scripts. More advanced programs are available for editing files with program source code (c+, fortran, ..), script commands (tcl, perl, ..), or web page documents (html). Notepad++ is an open source (free, Gnu Pubic License) source code editor and Notepad replacement that runs in the MS Windows environment. The Tcl command syntax is automatically recognized, formatted and shown with syntax highlighting. It also supports editing of multiple files shown on tabbed pages. For the remainder of the course, use of Notepad++ is encouraged.


Lab04 Results:

At the end of this module, please turn in the scripts from Src-B3 and Src-B4 (L04_Src-B3.tcl and L04_Src-B4.tcl) along with the plots (png files).

  • L04_Src-B3.tcl : tcl script for section B3 of this lab module.
  • L04_Src-B4.tcl : tcl script for section B4 of this lab module.
  • L04-B3.png : Tungsten spectra with various added filtration.
  • L04-B4.png : Molybdenum spectra with various added filtration.

Remember to add your name and the date at the beginning of the scripts. This can be done by filling in the documentation lines at the top.

L04-B2 Reference script: Lab04_Src-B2.tcl
L04-B3 Reference script: Lab04_Src-B3.tcl
L04-B4 Reference script: Lab04_Src-B4.tcl

Next:

The next module is 05-Object-A.