Title: A Validation of Spekpy: A Software Toolkit For Modelling X-Ray Tube Spectra
Title: A Validation of Spekpy: A Software Toolkit For Modelling X-Ray Tube Spectra
Title: A Validation of Spekpy: A Software Toolkit For Modelling X-Ray Tube Spectra
com/science/article/pii/S1120179720301083
Manuscript_da2f275a3145670fa7c17ff863e16860
Title: A validation of SpekPy: a software toolkit for modelling x-ray tube spectra
1
© 2020 published by Elsevier. This manuscript is made available under the Elsevier user license
https://www.elsevier.com/open-access/userlicense/1.0/
Abstract
Purpose: To validate the SpekPy software toolkit that has been developed to estimate the spectra
emitted from tungsten anode x-ray tubes. The model underlying the toolkit introduces
Materials and Methods: Using the same theoretical framework as the widely-used SpekCalc
software, new electron penetration data was simulated using the Monte Carlo (MC) method,
included, and improvements to numerical methods implemented. The SpekPy toolkit was developed
with the Python programming language. The toolkit was validated against other popular x-ray
spectrum models (50 to 120 kVp), x-ray spectra estimated with MC (30 to 150 kVp) as well as
reference half value layers (HVL) associated with numerous radiation qualities from standard
Results: The toolkit can be used to estimate x-ray spectra that agree with other popular x-ray
spectrum models for typical configurations in diagnostic radiology as well as with MC spectra over a
wider range of conditions. The improvements over SpekCalc are most evident at lower incident
electron energies for lightly and moderately filtered radiation qualities. Using the toolkit, estimations
of the HVL over a large range of standard radiation qualities closely match reference values.
Conclusions: A toolkit to estimate x-ray spectra has been developed and extensively validated for
central-axis spectra. This toolkit can provide those working in Medical Physics and beyond with a
2
INTRODUCTION
Across all modalities in x-ray diagnostics, both patient dose and image quality are dependent on the
photon energy spectrum used during an exposure.[1-4] Therefore, reliable estimations of the
emissions from x-ray tubes are sought after for a wide range of tube/filter/geometry configurations
covering clinic operating conditions. While it may be tempting to measure photon energy spectra
directly from an x-ray tube, it is often impractical, since it requires specialized equipment, precisely
determined geometries and substantial knowledge of the field to achieve reliable results.[5, 6] An
alternative approach is to estimate the emission of spectra from an x-ray tube by simulating the
physics of x-ray production using the Monte Carlo (MC) method.[7, 8] However the MC method
imaging equipment.
purpose-built software application. This has been a topic of research over several decades. Models of
spectra that form the basis of such software applications can be derived purely from theoretical
principles, based on empirical data, or combine theory with experimental results (semi-empirical).
Some of the developed spectrum models rely solely on data from a set of previously determined x-
ray spectra. Arbitrary spectra can be estimated by interpolating between a base set representing
different clinical operating conditions (e.g., varying tube voltage).[9, 10] The base set of spectra can
In the semi-empirical case, parts of the spectrum model are based on physical theory, but there are
also parameters that can be adapted so that the predictions conform to experimental results. Birch
and Marshall [13] developed a semi-empirical model of photon emission from an x-ray tube by
measured spectra in the diagnostic energy range. The Birch and Marshall model was used to
3
estimate a range of photon energy spectra and released in printed form (as a book of tables)[14] and
was later used to estimate a wider range of photon energy spectra with an accompanying software
Poludniowski et al developed a model of photon emission from an x-ray tube that treated the
distribution of electrons impinging a tungsten anode differently from Birch and Marshall.[16, 17]
Instead of relying on the Thomson-Whiddington law to characterize electron energy at depth [13],
the MC method was used to estimate the energy distribution of electrons at different penetration
estimate bremsstrahlung emission using a theoretical (rather than fitted) differential bremsstrahlung
cross-section. However, two normalization factors were introduced to match the estimated
bremsstrahlung and characteristic emissions to experimental data.[17] This model was implemented
in a software application, SpekCalc[18], and it has been widely-used in universities and hospitals
around the world. A modified version of SpekCalc has been used in the ImaSim toolkit which also
provided special treatment of the anode-heel effect.[19] We note that Hernandez and Fernandez
penetration in a tungsten target, using more accurate tabulated values of bremsstrahlung cross-
sections[21]. A general overview of different approaches to modeling x-ray spectra is available for
The purpose of this work is to present and validate a new software toolkit for calculating x-ray tube
spectra and estimating associated quantities. The toolkit, developed in the Python programming
SpekCalc semi-empirical model. It is a powerful package that permits the scripting of spectra
4
A comprehensive validation of central-axis x-ray spectra is made in this study against: (1) spectra
simulated using the MC method, (2) estimations of spectra using other popular software applications
(IPEM78, Spektr3 and SpekCalc) and (3) beam quality metrics for a multitude of spectra (N=192) from
standard laboratories.
The theoretical framework, like that of the SpekCalc program, is based on that of Poludniowski et al.
In the model, a beam of electrons of definite kinetic energies ( ), defined by the tube potential
(kVp), are assumed focused onto a point on the x-ray tube’s anode. The incident electrons are also
assumed to have a definite initial direction (perpendicular to surface). See figure 1 for an illustration
of the geometry. Note that electrons have a near normal incidence on the anode, as the x-ray tube
anode is a conductor. [25] However, even if the incidence is non-normal, it has little effect on
predictions, as multiple-scattering rapidly changes the electrons directions in the target. As the
electrons penetrate the target material they undergo elastic and inelastic interactions, resulting in
random changes of direction and energy-loss and the production of secondary-electrons. Relatively
rarely, an inelastic interaction results in the emission of a bremsstrahlung x-ray that exits the target.
Let the number of electrons that pass through a plane at depth in a target, per incident electron
with kinetic energy , be denoted ( ; ). The probability that an electron at this depth has a
kinetic energy can be defined as ( | ; ). The probability that this electron emits a
density of target atoms, d is the path length travelled by the electrons in the target and is the
(per solid angle and unit energy) emerging from the target per incident electron can then be
expressed as:
5
, * d#br
, ( , ; )= ! " d ( ; )" +d ( | ; ) ( ; )&'() ( , , , ), (1)
d
where and are the angles relative to the central axis (z) in the anode-cathode (x) and
perpendicular (y) directions, respectively. The intrinsic filtration (self-filtration by the target) is
>
?
= −A− (2B)
2
D
= atan C F (2G)
E
H
= atan C I F, (2c)
where A is the anode angle (in radians). The coefficient ! is the average ratio of path-length
travelled to depth penetrated (d /d ) and is set to a value of 2 (the incident electrons are assumed to
instantly attain a diffuse directional distribution, i.e., instant electron diffusion). The quantity is
The characteristic emission density for an atomic subshell S0 of the target material, is defined as:
LM ( )= ∑O ∑O PO )
O QO R( − O QO
, *+ d# , (3)
× ! " d ( ; )" d ( | ; ) br ( ; )
S0 d
where O QO and PO QO are the line energy and probability of a radiative S0-S1 transition (a
vacancy in the subshell S0 migrates to an outer subshell S1 with emission of a characteristic x-ray),
accounting for both the number of inner shell vacancies created per bremsstrahlung photon of
energy above the edge energy and the probability of escaping the target. Note that there is no
intrinsic filtration included in this expression, as the depth-distribution for fluorescence production is
unspecified. In this work, S0 may correspond to the K-shell or an L-subshell (LI, LII or LIII).
6
The total fluence density (per unit energy per incident electron) at a distance, E, from the focus can
& U) ( , , ) LM
Φ ( , , E; )= C , ( , ; )+ , ( )F, (4)
E: C1 + tan2 + tan2 F
where & U) ( , , ) = exp(− ∑W 2W ( )XW ( , )) is the extrinsic filtration (tube casing and added
filtration), where 2W is the linear attenuation coefficient of the Y !Z filter material and XW is the
thickness of the filter. In general, XW , will be dependent on the off-axis angles ( , ), as the path-
While generally successful, the implementation of the theoretical framework in SpekCalc has several
shortcomings which have the potential to limit the reliability and range of applicability of the model:
1. The electron depth ( ) and energy distributions ( ) are split into “first pass” and “multiple
pass” contributions which are each described by parameterizations fitted to a limited set of
MC data;
3. The energy distributions of electrons at depth ( ) are based on MC data for a single tube
potential (100 kVp) with a scaling to other tube potentials, again based on the Thomson-
Whiddington range;
4. The Thomson-Whiddington range also defines a sharp cut-off for the maximum depth of
penetration of electrons in the target. This can truncate contributions to the spectrum;
7
6. Only the K-edge transition is modelled for characteristic radiation (no L-lines);
7. The numerical methods employed were relatively crude (coarse grids of electron depths and
In the new implementation, there have been several improvements. The “first-pass” and “multiple-
pass” contributions have been consolidated into one quantity for both the depth distribution and the
energy distribution. Further, instead of fitting parameterizations to this data, tabulations have been
made based on more extensive Monte Carlo simulations. The use of the Thomson-Whiddington
range is abandoned along with any extrapolation to a user-defined tube potential based on range-
scaling. Where range-scaling has proved useful for interpolation purposes (for and ), this has
range ([\O]^ ). The maximum depth for x-ray production is assumed to be half the [\O]^ and this
assumption has been verified as acceptable. A variety of improvements have also been implemented
in the numerical methods, such as a finer grid spacing, use of cubic-spline interpolation routines and
The most significant changes in the physics models are the use of the NIST bremsstrahlung cross-
section tabulations, instead of the simplified analytic expression based on Elwert-Bethe-Heitler, and
the inclusion of L-lines in the characteristic emission. The NIST cross-sections are expected to make
the spectra slightly “harder” (i.e. increase the HVL)[16] while the inclusion of L-lines is expected to
make spectra slightly “softer” (particularly for lightly-filtered spectra at low tube potentials). Note
that, as in SpekCalc, electrons incident on the target are assumed to reach a state of diffusion
instantly, with the direction at depth uncorrelated with the incident direction.
8
Figure 1: Depiction of the geometry of the model of photon emission in a cross-section of an x-ray
tube where A is the anode angle and is the off-axis angle relative to the central axis (z) and the
The MC method was used to characterize the penetration of normally incident monoenergetic
electrons in a block of pure tungsten, representing a thick absorber. The simulations were made
using the BEAMnrc software tool [26] which is an extension of the EGSnrc Monte Carlo system [27]. A
simulation geometry was created consisting of 18 contiguous slabs of tungsten where the thickness
of the slabs varied to adapt to the electron range at different incident electron energies. In each slab,
the electron transport cut-off (ECUT) was set to 521 keV (i.e., a kinetic energy of 10 keV). The
PRESTA-II electron-step algorithm and the EXACT boundary crossing algorithm were used in the
simulations, with single scattering of electrons enforced by setting the skin depth to a suitably large
value. “Spin effects” and “Electron Impact Ionization” were switched on”. A Pegs4 material file,
representing tungsten, was created with a lower energy threshold (AE) and upper energy threshold
9
(UE) for electrons of 512 and 1512 keV, respectively. 100 million histories were used in the
Multiple incident electron energies were simulated. The simulations were chosen to provide good
coverage between 20 keV and 1 MeV incident electron energies (15 incident energies in total). For
each incident electron energy, the maximum depth that was analyzed was chosen to be close to half
of the CSDA range in tungsten. This was sufficient as the probability of an electron penetrating to a
depth greater than half the CSDA range is negligible in a high-Z target, due to the high degree of
multiple-scattering and the resulting tortuous paths followed by the electrons. The ESTAR database
[28] from NIST was used to obtain the [\O]^ for the different incident electron energies. The depths
of the individual slabs in the simulation geometry were adjusted for each incident energy to provide
penetration data at between 12 – 18 different depths, depending on the CSDA range of each incident
electron energy. A scoring plane was placed at each depth increment. The simulations generated a
Beamdp [29] was used to analyze the phase-space files. The analysis determined the planar fluence
distribution of electrons using a circular region of interest with a radius substantially larger than the
electron range. The energy grid was binned in 1 keV intervals up to 200 keV incident energy, 2 keV
intervals up to 400 keV incident energy and 5 keV intervals up to 1000 keV incident energy. From this
_` _a
C , ,Δ F = (0.01, 0.01, 10 ij) . (5)
*+ bcdef
All data that is used to model characteristic emission (see Eq. 2) was taken from tabulated values in
the material definition file for tungsten from the Penelope MC system.[30] The binding energies for
the K- and L-shells are from work by Carlson[31]. The probability of a transition from one shell to
10
another, PO QO , is from work by Perkins et al [32] and the energy emitted during that transition,
O QO , is from work by Deslattes et al [33]. The binding energies for the different shells are 69.5,
12.1, 11.5, and 10.2 keV for the k, lm , lmm , lmmm edges respectively.
The n and arguments defined as inputs for generating an x-ray tube model are used to define
grids of interpolations in the tabulated electron penetration data to arrive at a set of estimates of
and added filtration) of the emitted x-ray spectra is applied using tabulated photon cross-sections for
different elements from NIST[34]. The integrations in Eq. 1 and Eq. 3 are made using Simpson’s Rule
and a log-log cubic interpolation is used when interpolating the photon cross-sections.
Empirical model parameters were determined by fitting to a set of simulated spectra. The
simulations were generated using the BEAMnrc MC user-code and represented an x-ray tube
configuration typical of those in use for medical imaging. The x-ray tube geometry consisted of
several components including a pure tungsten anode (12 degrees) suspended in a vacuum, beam
collimators, a filter, and an approximately 100 cm column of air. Simulations were made at incident
electron energies of 20, 35, 50, 100, 150, 300, and 500 keV. Two simulations were made at each
incident electron energy, to isolate both the bremsstrahlung and characteristic components of the x-
In the simulations, the electron transport options closely corresponded to those used in calculating
subsection). However, the electron transport cut-off energy (ECUT) was set to 516 keV and the
photon transport cut-off energy (PCUT) was set to 5 keV. The parameters AE (low-energy threshold
photons) were set to 512 keV and 1 keV, respectively. The XCOM photon cross sections were used.
11
Bound Compton scattering and Rayleigh scattering were set to “On”. When excluding characteristic
emissions (i.e. bremsstrahlung only) the parameters for atomic relaxations and impact ionization
were set to “Off” and were “On” otherwise. The electron impact ionization algorithm was set to the
PENELOPE option. The NIST bremsstrahlung cross sections and the “SIM” bremsstrahlung angular
sampling was used. The number of histories was selected in a way so that the relative standard
uncertainty would be less than 1%, when using variance reduction techniques in each simulation.
A scoring plane in “air” was located at a focus to detector distance of 100 cm. The scoring plane
generated a phase-space file that was analyzed with Beamdp. The planar fluence distribution of
photons were scored using a circular region with a radius of 2 cm. The photon energy spectra were
binned on an energy grid with 0.5 keV bins. The resulting photon energy spectra were transferred to
units of photons per ij ∙ qr: per incident electron. Note that the simulations were made with a
broad beam geometry, that is, the collimation was appreciably larger than the scoring radius.
The empirical parameter is used to normalize the magnitude of the bremsstrahlung component
to match MC estimated x-ray spectra (see Eq.(1)). The parameter value was determined using the
optimize submodule of the scipy Python package. An optimal value of was found by minimizing
the difference between predicted and simulated spectra across all incident electron energies (20-500
keV). A similar approach was used to find the empirical parameters, st − sttt and u , which are
used to normalize the characteristic component (L- and K-lines) (see Eq.(3)). For L-line emissions, the
optimization covered incident electron energies below 40 keV and for K-line emissions, the
Using the framework, the same model as SpekCalc [18] can be selected (referred to as “legacy”
mode). In this case the normalization factors and u were determined in a different manner
compared to the updated model. Using a 100 kVp minimally filtered x-ray spectrum (1 mm Be, 1000
mm air) with a 12 degree anode angle, bremsstrahlung and characteristic contributions to air kerma
were matched to those estimated with SpekCalc. The empirical model parameters for this model and
12
legacy mode are presented in table 1. Observe that, in legacy mode, there are no normalization
Table 1: Empirical normalization factors that are used in the spectrum model.
SpekPy was developed as a user-friendly toolkit using the Python programming language (Python
Software Foundation) and encapsulates the spectrum models discussed above. It is freely available
permissive MIT license. Two additional (but standard) packages are required to use the Python code:
Spekpy allows the user to create an initial spectrum model for a tube with a defined tube voltage,
anode angle, energy bin, spatial coordinates, etc. The user can then manipulate the initial spectrum
by filtering with a range of different materials. The toolkit is equipped with a number of methods
that can be used to estimate metrics such as air Kerma, first and second half value layer (HVL) and
other quantities.
While SpekPy does not currently feature a Graphical User Interface (such as the SpekCalc program),
the flexibility of the toolkit and the scriptability of the methods offers advantages for the more
advanced user. We refer the reader to the appendix of this paper or the online documentation for
Validation
The validation of the x-ray spectrum models (SpekPy default and legacy modes) consisted of two
stages. In the first stage, specifications on the L- and M- series x-ray beams from the NIST standards
13
laboratory (personal communication with NIST, December 2018) were used to estimate the x-ray
spectra using the MC method. The tube voltages, anode angles, filtration and focus to detector
distances for each of the standard radiation qualities are presented in table 2. Similar simulation and
analysis configurations were used to those for determination of the model normalization factors (see
section titled Determination of Model Parameters). For the validation, 5x108 histories were used in
each simulation with the directional bremsstrahlung splitting variance reduction technique. The
bremsstrahlung angular sampling was set to “KM”, however, (for thick targets) this mode gives nearly
identical results to the “SIM” mode that was used in the determination of the normalization
factors.[35] Note, in the simulations, 966.8 mm of air was used instead of 1000 mm to compensate
for the column of vacuum between the anode and the exit window in an x-ray tube. The simulations
Table 2: Configurations that were used to simulate x-ray tubes with Monte Carlo where FDD is the
focus to detector distance
After the x-ray spectra in table 2 were simulated, the MC spectra were imported into SpekPy and the
1st half-value layer (HVL) was calculated (defined in terms of air Kerma). These HVL values were
compared to estimations with SpekPy (this work), SpekPy legacy mode (this work), and SpekCalc[18].
Note that in this last case, the HVL value provided by the SpekCalc application was used. Further,
each of the L- and M spectra are associated with reference HVL values from NIST, which were also
14
To provide a more clinically relevant comparison of SpekPy with other spectrum models, four
qualities from the IEC RQR series were estimated using SpekCalc[18], Cranley et al’s IPEM78[15], and
Punnoose et al’s Spektr 3.0 (TASMICS model)[12]. The configuration of each of these IEC radiation
qualities were taken from specification provided by the national secondary standards laboratory at
the Swedish Radiation Safety Authority (SSM). Since Spektr 3.0 cannot generate spectra with
arbitrary anode angles, the anode angle in this comparison was set to 12 degrees for all models.
Table 3 presents the configurations of the RQR spectra that were used in this comparison.
In the second stage of the validation, SpekPy was used to estimate HVL over a wide range of tube
voltages and filtrations (192 in total). The specifications for these 192 radiations qualities were
garnered from standard laboratories at SSM, PTB, and NIST and represent the available radiation
qualities for calibrations at each institution. Note, there is some overlap between the radiation
qualities as, for example, multiple institutions may provide IEC RQR radiation qualities, however, the
filtration may differ slightly. The HVL values estimated with SpekPy were compared to the HVL
values associated with each standard spectrum specified by the different standard laboratories. Only
first HVL values were compared. However, as these comprise of multiple levels of filtration for the
RESULTS
A visual representation of radiation qualities from the NIST standards laboratory (L-, and M-series)
predicted with MC, SpekPy, SpekPy legacy mode, and SpekCalc is presented in figure 2 - 4. The
spectra have been normalized to the units of photons per [keV µGy cm2]. For low and medium
15
filtration spectra (L- and M-series), at low kVps (figure 2), the presence of L-line characteristic
emissions can be seen in the MC, and SpekPy spectra. Since SpekPy legacy mode and SpekCalc do not
include characteristic L-line emissions, the normalization by air kerma (µGy) ensures that they have a
slightly higher curves in the mid energy ranges, compared to MC and SpekPy. Figure 2 also shows
that SpekPy in legacy mode and SpekCalc match each other well (as intended). Figure 3-4 show that
for higher tube voltages, MC, SpekPy, SpekPy legacy mode, and SpekCalc are all in good agreement
Tabulations of HVL for the different spectra presented in figures 2-4 are given in table 4. Note, the
NIST column in table 4 is considered to be the golden standard for HVL estimations as these are the
reference values provided by the standard laboratory. Table 4 shows that not including characteristic
L-line emissions can have an appreciable effect on the HVL, for x-ray spectra at low tube voltages
with low or moderate filtration. In general, SpekPy closely matches the reference HVL values across
the L- and M-radiation qualities. Table 4 also confirms that SpekPy legacy mode and SpekCalc are in
Figure 5 presents four IEC RQR spectra calculated by four software tools: SpekPy, SpekCalc, Spektr
3.0 and IPEM78. Only the IPEM78 predictions show clear deviations from the other models. Note
that the energy bin size in the Spektr 3.0 application was fixed at 1.0 keV, instead of 0.5 keV, as fixed,
or selected, in the other software programs. The different bin size affects the magnitude of the
characteristic K-line emissions in figure 4. Table 5 presents a comparison between first and second
HVL values for the RQR spectra estimated with the spectra presented in figure 5. The values reveal
that IPEM78 provides the hardest spectral predictions (highest HVLs) and that SpekCalc produces
16
Figure 2: Visual comparison of x-ray spectra estimated with different models for tube voltages
ranging from 30-40 kVp.
Figure 3: Visual comparison of x-ray spectra estimated with different models for tube voltages
ranging from 50-80 kVp.
17
Figure 4: Visual comparison of x-ray spectra estimated with different models for tube voltages
ranging from 100-150 kVp.
Table 4: Comparison of HVL estimations of NIST L- and M-series using different x-ray spectrum
models.
HVL [mm Al] (Difference [%])
NIST SpekPy
Quality MC SpekPy SpekCalc
(Ref) (legacy mode)
L30 0.23 0.23 (0.0) 0.24 (4.2) 0.31 (25.1) 0.30 (23.2)
L40 0.52 0.50 (-4.0) 0.52 (0.0) 0.55 (5.9) 0.55 (5.5)
L50 0.79 0.78 (-1.3) 0.79 (0.0) 0.79 (0.3) 0.79 (0.0)
L80 1.81 1.86 (2.7) 1.90 (-0.6) 1.80 (-0.6) 1.80 (-0.6)
L100 2.80 2.80 (0.0) 2.86 (-3.3) 2.72 (-3.0) 2.71 (-3.3)
M30 0.36 0.37 (2.7) 0.39 (7.7) 0.41 (12.8) 0.41 (12.2)
M40 0.74 0.76 (2.6) 0.78 (5.1) 0.76 (2.1) 0.76 (2.6)
M50 1.04 1.03 (-1.0) 1.06 (1.9) 1.02 (-2.1) 1.02 (-2.0)
M80 3.08 2.82 (-9.2) 2.90 (-6.2) 2.79 (-10.4) 2.79 (-10.4)
M100 5.10 4.89 (-4.3) 5.05 (-1.0) 4.90 (-4.0) 4.91 (-3.9)
M120 6.77 6.58 (-2.9) 6.78 (0.1) 6.66 (-1.7) 6.68 (-1.3)
M150 10.3 9.76 (-5.5) 10.02 (-2.8) 9.94 (-3.7) 10.00 (-3.7)
18
Figure 5: Visual comparison of different spectrum models for IEC RQR radiation qualities using a 12-
degree anode angle.
Table 5: Comparison of HVL values between different spectrum models for IEC RQR radiation
qualities.
1st HVL [mm Al] (Difference [%]) 2nd HVL [mm] (Difference [%])
Quality SpekPy SpekCalc IPEM78 Spektr 3.0 SpekPy SpekCalc IPEM78 Spektr 3.0
RQR3 1.82 1.77 (-2.7) 1.83 (+0.5) 1.80 (-1.1) 2.41 2.34 (-2.9) 2.37 (-1.7) 2.37 (-1.9)
RQR5 2.65 2.56 (-3.4) 2.71 (+2.3) 2.63 (-0.8) 3.76 3.64 (-3.2) 3.76 (0.0) 3.69 (-1.8)
RQR7 3.55 3.41 (-3.9) 3.70 (+4.2) 3.47 (-2.3) 5.28 5.10 (-3.4) 5.35 (+1.3) 5.10 (-3.5)
RQR9 5.39 5.26 (-2.4) 5.64 (+4.6) 5.23 (-3.0) 7.73 7.61 (-1.6) 7.84 (+1.4) 7.48 (-3.4)
Figure 6 presents a comparison between HVL values estimated with SpekPy and reference HVL values
for 192 radiation qualities provided by the standard calibration laboratories NIST, SSM and PTB. The
reference HVL values provided by the standard laboratories can either be given in units of mm Al or
mm Cu or both mm Al and mm Cu, depending on the radiation quality. HVLs were estimated using
the matching material and plotted against the reference. A linear fit was made to each of the plots
and the results of the fit are displayed in the legend. If the estimated HVLs matched the reference
19
In table 6, the radiation quality series, the number of radiation qualities, the mean percent difference
and standard deviation of the percent difference between SpekPy/reference values for each series is
presented. Over all 192 spectra, SpekPy exhibited the following statistics of agreement: (n, mean, SD,
min, max) = (139, 1.2%, 2.4%, -13.4%, 8.8%) and (150, 0.0%, 3.6%, -15.7% and 6.8%) for the HVL of
aluminum and copper, respectively. Of the 139 and 150 differences for the HVL of aluminum and
copper, respectively, a total of 24 differences were above +/-5% and only four differences were
above +/-10%. Likewise, the corresponding statistics for SpekPy legacy mode (i.e. SpekCalc
equivalent) were: (n, mean, SD, range) = (139, 0.2%, 4.8%, -13.9%, 33.6%) and (150, -0.2%, 3.4%, -
16.3%, 8.9%) for the HVL of aluminum and copper, respectively. Note that, when calculating the HVL
values that are presented in figure 6, a Python script was written that utilized the SpekPy toolkit. The
script took approximately 8 minutes on a standard laptop computer to loop through all 192
configurations, apply filtrations and calculate the HVL of aluminum and/or copper.
20
Figure 6: Visual representation of how well estimates of HVL ranging across different tube voltages
and filtrations compare to reference values.
21
Table 6: Tabulation of the mean percent difference of HVL in aluminum estimated with SpekPy
compared to HVL references for standard radiation qualities from the National Institute of Standards
and Technology (NIST), National Metrology Institute of Germany (PTB) and the Swedish Radiation
Safety Authority (SSM). The standard radiation qualities cover beam specifications from the
22
DISCUSSION
A new user-friendly Python toolkit was introduced for calculating central and off-axis x-ray spectra
from a tungsten-anode x-ray tube. SpekPy is based on the established theoretical framework utilized
by the popular SpekCalc software.[16, 17] In SpekPy, the implementation has been improved with
more exhaustive electron penetration data, the use of NIST bremsstrahlung cross-sections, the
The SpekPy toolkit comes equipped with a raft of methods that can be used to manipulate x-ray
spectra and generate predictions of parameters useful to medical physicists. Each of the radiation
qualities from the different standard laboratories shown in the Results section are part of the
package and are easily loaded. Further, there are over 400 predefined material compositions
available.
The toolkit has undergone an extensive validation in this work. The first stage of the validation
comprised comparing x-ray spectra generated in SpekPy against those simulated with the MC
method and other spectrum estimation software applications. The MC simulated spectra provided
HVLs that closely matched the reference values from NIST for each radiation quality (see table 4).
This indicates that the MC simulations provide good predictions of experimental spectra. Figures 2-4
show that the SpekPy model predictions also match MC, showing improvements over SpekCalc in the
inclusion of characteristic L-line emissions. Table 4 shows that SpekPy, in general, outperforms
SpekCalc in terms of HVL predictions across the NIST L- and M-series. The worst agreement between
SpekPy and MC are for the M80-M150 radiation qualities (see table 4). Note, however, that SpekPy
agrees closely with the reference values from NIST for those radiation qualities. It is worth pointing
out that the M80-M150 radiation qualities are specified for a different x-ray tube to the others (see
SpekPy in legacy mode closely matches SpekCalc, as demonstrated in figures 2-4 and table 4, as
intended. This means that if a SpekCalc user has validated that software for their own purposes, or is
23
cautious in moving to a new model, they can still take advantage of the power of the SpekPy toolkit
but operate it in a mode (legacy) that gives essentially identical predictions to SpekCalc. We observe
that the performance of SpekCalc/SpekPy-legacy in the validations was not substantially worse than
SpekPy, except in cases where the L-line contributions were important (low kVp and low filtration).
Therefore, the SpekCalc model should not be considered obsolete, especially given the popularity of
The second stage of validation of SpekPy was a comparison of predictions of the HVL in aluminum or
copper for 192 different radiation qualities, using configurations from three different standard
laboratories over a wide range of tube voltages. It is worth noting that there was good agreement
between SpekPy and the radiation qualities from standard laboratories across all tube voltages (20 –
A limitation of the validation against standard spectra is that the configurations used for the different
radiation qualities from the standard laboratories specify an anode angle of 20 or 21 degrees.
Although typical for standard laboratories and some applications in mammography, this anode angle
is uncommon for other clinical situations where the anode angles can typically vary between 7 and
15 degrees. An attempt to address this issue was made through using RQR configurations from SSM
and changing the anode angle to 12 degrees (the fixed anode angle for Spektr 3.0). A more closely
clinically relevant comparison between the predictions of SpekPy and other spectrum models could
then be made. Figure 5 and table 5 show that SpekPy is, in general, in good agreement with SpekCalc
and Spektr 3.0 for the IEC RQR radiation qualities. Note, that the improvements of SpekPy over
SpekCalc were more apparent for low and medium filtered radiation qualities at low tube voltages
(e.g., figure 2) than for the RQR spectra. Spectra estimated with the IPEM78 application did not agree
closely with SpekPy, nor with the other two models. However, it has also been observed elsewhere
that IPEM78 typically produces harder spectra predictions than a number of other models.[16]
24
The accuracy of off-axis spectra has not been validated in this work. The “heel effect” is of particular
Conclusion
A toolkit was developed with an improved semi-empirical model of photon emission from a tungsten
anode. The SpekPy toolkit provides convenient methods to filter spectra and calculate important
radiation quality metrics and comes with a large library of predefined standard radiation qualities
and material definitions, with the ability to define new ones. The toolkit can also be run in a legacy
mode which generates spectra that closely match those of SpekCalc. The toolkit underwent an
exhaustive validation against spectra estimated with the Monte Carlo method as well as with other x-
ray spectral generator software applications and experimental results from standard laboratories.
Acknowledgements
We would like to thank Michelle O’Brien at the calibration laboratory at NIST for providing valuable
information about the x-ray tube configurations associated with the standard radiation qualities that
Conflicts of Interest
References
[1] ICRU. Report 74: Patient dosimetry for X-rays used in medical imaging. J ICRU. 2005;5.
[2] ICRU. Report 70: Image Quality in Chest Radiography. J ICRU. 2003;3.
[3] ICRU. Report 82: Mammography - Assesment of Image Quality. J ICRU. 2009;9.
[4] ICRU. Report 87: Radiation Dose and Image-Quality Assesment in Computed Tomography. J ICRU.
2012;12.
[5] Peaple LH, Burt AK. The measurement of spectra from x-ray machines. Phys Med Biol.
1969;14:73-85.
[6] Waggener RG, Levy LB, Rogers LF, Zanca P. Measured x-ray spectra from 25 to 110 kVp for a
typical diagnostic unit. Radiology. 1972;105:169-75.
25
[7] Ay MR, Shahriari M, Sarkar S, Adib M, Zaidi H. Monte Carlo simulation of x-ray spectra in
diagnostic radiology and mammography using MCNP4C. Physics in Medicine and Biology.
2004;49:4897-917.
[8] Bazalova M, Verhaegen F. Monte Carlo simulation of a computed tomography x-ray tube. Physics
in Medicine and Biology. 2007;52:5945-55.
[9] Boone JM, Seibert JA. An accurate method for computer-generating tungsten anode x-ray spectra
from 30 to 140 kV. Med Phys. 1997;24:1661-70.
[10] Hernandez AM, Boone JM. Tungsten anode spectral model using interpolating cubic splines:
Unfiltered x-ray spectra from 20 kV to 640 kV. Medical Physics. 2014;41.
[11] Siewerdsen JH, Waese AM, Moseley DJ, Richard S, Jaffray DA. Spektr: a computational tool for x-
ray spectral analysis and imaging system optimization. Med Phys. 2004;31:3057-67.
[12] Punnoose J, Xu J, Sisniega A, Zbijewski W, Siewerdsen JH. Technical Note: spektr 3.0-A
computational tool for x-ray spectrum modeling and analysis. Med Phys. 2016;43:4711.
[13] Birch R, Marshall M. Computation of bremsstrahlung X-ray spectra and comparison with spectra
measured with a Ge(Li) detector. Phys Med Biol. 1979;24:505-17.
[14] Birch RM, M.; Ardran, G. M.;. Catalogue of spectral data for diagnostic X-rays. Report series; v
30: Hospital Physicists' Association. Diagnostic Radiology Topic Group; 1979.
[15] Cranley K, Gilmore, B. J., Fogarty, G. W. A., Deponds, L. IPEM Report 78: Catalogue of diagnostic
x-ray spectra and other data. The Institute of Physics and Engineering in Medicine; 1997.
[16] Poludniowski GG. Calculation of x-ray spectra emerging from an x-ray tube. Part II. X-ray
production and filtration in x-ray targets. Med Phys. 2007;34:2175-86.
[17] Poludniowski GG, Evans PM. Calculation of x-ray spectra emerging from an x-ray tube. Part I.
electron penetration characteristics in x-ray targets. Med Phys. 2007;34:2164-74.
[18] Poludniowski G, Landry G, DeBlois F, Evans PM, Verhaegen F. SpekCalc: a program to calculate
photon spectra from tungsten anode x-ray tubes. Phys Med Biol. 2009;54:N433-8.
[19] Landry G, deBlois F, Verhagen F. ImaSim, a software tool for basic education of medical X-ray
imaging in radiotherapy and radiology. Frontiers in Physics. 2013;1:22.
[20] Hernandez G, Fernandez F. A model of tungsten anode x-ray spectra. Med Phys. 2016;43:4655.
[21] Seltzer SM, Berger MJ. Bremsstrahlung spectra from electron interactions with screened atomic
nuclei and orbital electrons. Nuclear Instruments and Methods in Physics Research Section B: Beam
Interactions with Materials and Atoms. 1985;12:95-134.
[22] Poludniowski G. Calculation of X-ray Spectra. Handbook of X-ray Imaging: Physics and
Technology. 2017:185.
[23] Persson M, Bujila R, Nowik P, Andersson H, Kull L, Andersson J, et al. Upper limits of the photon
fluence rate on CT detectors: Case study on a commercial scanner. Med Phys. 2016;43:4398.
[24] Oden J, Zimmerman J, Poludniowski G. Comparison of CT-number parameterization models for
stoichiometric CT calibration in proton therapy. Phys Med. 2018;47:42-9.
[25] Ali ES, Rogers DW. Quantifying the effect of off-focal radiation on the output of kilovoltage x-ray
systems. Med Phys. 2008;35:4149-60.
[26] Rogers D, Walters B, Kawrakow I. BEAMnrc users manual. Nrc Report Pirs. 2009;509:12.
[27] Kawrakow I, Rogers D. The EGSnrc code system. NRC Report PIRS-701, NRC, Ottawa. 2000.
[28] ESTAR N. Estar-Stopping power and range tables for electrons. 2009.
[29] Ma C, Rogers D. BEAMDP users manual. NRC Report PIRS-0509 (D). 1995.
[30] Salvat F, Fernández-Varea JM, Sempau J. PENELOPE-2008: A code system for Monte Carlo
simulation of electron and photon transport. Workshop Proceedings2006. p. 7.
[31] Carlson T. Photoelectron and Auger spectroscopy: Springer Science & Business Media; 2013.
[32] Perkins S, Cullen D, Chen M, Rathkopf J, Scofield J, Hubbell J. Tables and graphs of atomic
subshell and relaxation data derived from the LLNL Evaluated Atomic Data Library (EADL), Z= 1--100.
Lawrence Livermore National Lab., CA (United States); 1991.
[33] Deslattes RD, Kessler Jr EG, Indelicato P, De Billy L, Lindroth E, Anton J. X-ray transition energies:
new approach to a comprehensive evaluation. Reviews of Modern Physics. 2003;75:35.
26
[34] Berger M, Hubbell J, Seltzer S, Chang J, Coursey J, Sukumar R, et al. Xcom: Photon cross sections
database, nist standard reference database 8 (xgam). URL http://physics nist
gov/PhysRefData/Xcom/Text/XCOM html. 2010.
[35] Omar A, Andreo P, Poludniowski G. Performance of different theories for the angular
distribution of bremsstrahlung produced by keV electrons incident upon a target. Radiation Physics
and Chemistry. 2018;148:73-85.
In a Python interpreter, an initial spectrum model for a tube can be estimated by typing a simple
command. For example, a model, s, for a tube potential of 120 kVp and an anode angle of 14
where Spek is the name of the main class for the toolkit and s is a new instance of the Spek class.
There are several keyword arguments available for input when creating a spectrum model instance.
All these arguments are optional and default to predefined values when omitted. The keyword
arguments include: the tube potential, n (default: 100 kVp); the angle of the anode, ℎ (default: 12
degrees); the desired bin width of the energy grid, , in the x-ray spectrum (default: 0.5 keV); the 3-
dimensional spatial coordinates at which the spectrum is specified (default: D, {, and E = 0 cm, 0 cm,
100 cm). Zero value inputs values for D and { constitute the definition of a central-axis spectrum. A
further keyword, obliq (default: True), specifies whether, for off-axis emission angles, the increased
path-length through the filter materials is accounted for. When the keyword argument physics is set
to “legacy”, the software generates spectra with the same model as SpekCalc[18] but with an
updated description of the electron penetration in tungsten (see subsection Electron Penetration
A range of additional tools (also known as class methods) have been developed to provide the user
with, for example, a way of filtering x-ray spectra, calculating different x-ray metrics that can be of
interest and importing and exporting spectrum data. An overview of some important class methods
27
is presented in table A1. For example, the spectrum instance, s, can be filtered by 3 mm of aluminum,
>> s.filter(‘Al’,3.0)
and then:
>> print(s.get_hvl1())
Table A1: Overview of some of the methods that are available in the SpekPy toolkit.
s.filter(’Al’, 0.1) This method is used to filter a spectrum with a specific material and thickness. In
this example, the material is aluminum and the thickness is 0.1 mm.
s.multi_filter([(‘Be’, 1), (‘Al’, 2)]) This method can be used to filter a spectrum with a list of specified materials and
associated thicknesses.
s.get_matl(matl=’Cu’,hvl_matl=’Al’, hvl=6) This method is used to find the thickness of a specific material needed to achieve a
specific hvl in mm or transmission given as a fraction. In this example, the method
will return the amount of copper needed to achieve an HVL of 6 mm aluminium.
Alternatively, the second and third arguments can be replaced by a desired
transmission, e.g., frac=0.8, representing a reduction of air kerma to 80%.
s.get_spectrum() This method returns two arrays; the first contains the energy bins of the spectrum
(keV) and the second contains the corresponding differential fluences (photons
keV-1 mAs-1 cm-2).
s.get_kerma() This method is used to calculate the air Kerma of the current x-ray spectrum. The
air Kerma is calculated as:
* }
k3' = & " + Ψ( ) C ~• ( )F d ,
€ 3'
}~•
where Ψ( ) is the energy fluence of the spectrum and C ( )F is the mass
€ 3'
energy absorption coefficient of air differential in energy [9]. The factor, &,
transfers the energy from keV to Joule (J).
s.get_hvl1(’Al’) This method is used to estimate the first HVL for a specified material, in this
example, for aluminum.
s.get_hvl2(‘Al’) This method is used to estimate the second HVL for a specified material, in this
example, for aluminum.
28
Figure 1: Depiction of the geometry of the model of photon emission in a cross-section of an x-ray
tube where is the anode angle and is the off-axis angle relative to the central axis (z) and the
Figure 2: Visual comparison of x-ray spectra estimated with different models for tube voltages
Figure 3: Visual comparison of x-ray spectra estimated with different models for tube voltages
Figure 4: Visual comparison of x-ray spectra estimated with different models for tube voltages
Figure 5: Visual comparison of different spectrum models for IEC RQR radiation qualities using a 12-
Figure 6: Visual representation of how well estimates of HVL ranging across different tube voltages
z
𝜃
𝐸0
External
𝑇𝑖
Filtration
𝑘
104 NIST_L30 104 NIST_L40
3 3
Photons [keV µGy cm2]-1
2 2
1.5 1.5
1 1
0.5 0.5
0 0
0 5 10 15 20 25 30 0 10 20 30 40
Energy [keV] Energy [keV]
3 2 -1
Photons [keV µGy cm ]
2.5 3
2
2
1.5
1
1 MC
Spekpy
0.5 Spekpy_Legacy
SpekCalc
0 0
0 5 10 15 20 25 30 0 10 20 30 40
Energy [keV] Energy [keV]
104 NIST_L50 104 NIST_L80
3.5 4
Photons [keV µGy cm2]-1
2.5 3
2
2
1.5
1
1
0.5
0 0
0 10 20 30 40 50 0 20 40 60 80
Energy [keV] Energy [keV]
3 4
3
2
2
1 MC
Spekpy
1
Spekpy_Legacy
SpekCalc
0 0
0 10 20 30 40 50 0 20 40 60 80
Energy [keV] Energy [keV]
104 NIST_L100 105 NIST_M120
3.5
12
Photons [keV µGy cm2]-1
2 0.5
0 0
0 20 40 60 80 100 0 20 40 60 80 100 120
Energy [keV] Energy [keV]
2 -1 4 Spekpy_Legacy
Photons [keV µGy cm ] SpekCalc
1.5
3
1
2
0.5 1
0 0
0 20 40 60 80 100 0 50 100 150
Energy [keV] Energy [keV]
104 RQR3 104 RQR5
6
Photons [keV µGy cm2]-1
2
2
1 1
0 0
0 10 20 30 40 50 0 10 20 30 40 50 60 70
Energy [keV] Energy [keV]
2
8
1.5
6
4 1
2 0.5
0 0
0 20 40 60 80 0 20 40 60 80 100 120
Energy [keV] Energy [keV]
NIST Al NIST Cu
25 7
CCRI (BIPM) CCRI (BIPM)
H H
HK (ISO) HK (ISO)
L LK (ISO)
LK (ISO) 6 M
M NS (ISO)
20 NS (ISO) S
S WS (ISO)
Linear Fit (k=1.01, m=-0.02, R^2=1.00 Linear Fit (k=1.03, m=-0.01, R^2=1.00
5
15
4
3
10
a d
0 0
0 5 10 15 20 25 0 1 2 3 4 5 6 7
Estimated HVL [mm Al] Estimated HVL [mm Cu]
PTB Al PTB Cu
25 7
A (DIN) A (DIN)
B (DIN) B (DIN)
C (DIN) C (DIN)
H (ISO) H (ISO)
L (ISO) 6 L (ISO)
N (ISO) N (ISO)
20 RQA (IEC) RQA (IEC)
RQR (IEC) RQR (IEC)
RQT (IEC) RQT (IEC)
W (ISO)
5
W (ISO)
Linear Fit (k=0.99, m=-0.06, R^2=1.00 Linear Fit (k=0.98, m=-0.01, R^2=1.00
Reference HVL [mm Cu]
Reference HVL [mm Al]
15
4
3
10
0
b 0
e
0 5 10 15 20 25 0 1 2 3 4 5 6 7
Estimated HVL [mm Al] Estimated HVL [mm Cu]
SSM Al SSM Cu
14 7
CCRI (BIPM) CCRI (BIPM)
RQA (IEC) L (ISO)
RQR (IEC) N (ISO)
RQT (IEC) Linear Fit (k=1.01, m=-0.02, R^2=1.00
12 Linear Fit (k=0.99, m=0.04, R^2=1.00 6
10 5
Reference HVL [mm Cu]
Reference HVL [mm Al]
8 4
6 3
4 2
2 1
c f
0 0
0 2 4 6 8 10 12 14 0 1 2 3 4 5 6 7
Estimated HVL [mm Al] Estimated HVL [mm Cu]
Table 1: Empirical normalization factors that are used in the spectrum model.
Table 2: Configurations that were used to simulate x-ray tubes with Monte Carlo where FDD is the
models.
Table 5: Comparison of HVL values between different spectrum models for IEC RQR radiation
qualities.
1st HVL [mm Al] (Difference [%]) 2nd HVL [mm] (Difference [%])
Quality SpekPy SpekCalc IPEM78 Spektr 3.0 SpekPy SpekCalc IPEM78 Spektr 3.0
RQR3 1.82 1.77 (-2.7) 1.83 (+0.5) 1.80 (-1.1) 2.41 2.34 (-2.9) 2.37 (-1.7) 2.37 (-1.9)
RQR5 2.65 2.56 (-3.4) 2.71 (+2.3) 2.63 (-0.8) 3.76 3.64 (-3.2) 3.76 (0.0) 3.69 (-1.8)
RQR7 3.55 3.41 (-3.9) 3.70 (+4.2) 3.47 (-2.3) 5.28 5.10 (-3.4) 5.35 (+1.3) 5.10 (-3.5)
RQR9 5.39 5.26 (-2.4) 5.64 (+4.6) 5.23 (-3.0) 7.73 7.61 (-1.6) 7.84 (+1.4) 7.48 (-3.4)
Table 6: Tabulation of the mean percent difference of HVL in aluminum estimated with SpekPy
compared to HVL references for standard radiation qualities from the National Institute of Standards
and Technology (NIST), National Metrology Institute of Germany (PTB) and the Swedish Radiation
Safety Authority (SSM). The standard radiation qualities cover beam specifications from the
s.filter(’Al’, 0.1) This method is used to filter a spectrum with a specific material and thickness. In
this example, the material is aluminum and the thickness is 0.1 mm.
s.multi_filter([(‘Be’, 1), (‘Al’, 2)]) This method can be used to filter a spectrum with a list of specified materials and
associated thicknesses.
s.get_matl(matl=’Cu’,hvl_matl=’Al’, hvl=6) This method is used to find the thickness of a specific material needed to achieve a
specific hvl in mm or transmission given as a fraction. In this example, the method
will return the amount of copper needed to achieve an HVL of 6 mm aluminium.
Alternatively, the second and third arguments can be replaced by a desired
transmission, e.g., frac=0.8, representing a reduction of air kerma to 80%.
s.get_spectrum() This method returns two arrays; the first contains the energy bins of the spectrum
(keV) and the second contains the corresponding differential fluences (photons
keV-1 mAs-1 cm-2).
s.get_kerma() This method is used to calculate the air Kerma of the current x-ray spectrum. The
air Kerma is calculated as:
= Ψ d ,
s.get_hvl1(’Al’) This method is used to estimate the first HVL for a specified material, in this
example, for aluminum.
s.get_hvl2(‘Al’) This method is used to estimate the second HVL for a specified material, in this
example, for aluminum.