Python plugins#

Optional parts of TIGRE; compiled plugins must be built first (see Plugins).

Proton CT#

Built with TIGRE_PLUGINS=pct. See Proton CT.

tigre.plugins.pct.pCTCubicSpline(posIn, posOut, dirIn, dirOut, Wepl, eIn, geo)#

Optimised proton radiography from single-proton data.

Estimates each proton’s path through the object with a cubic spline and bins its water-equivalent path length (WEPL) along it (Collins-Fekete et al., Phys. Med. Biol. 61 (2016) 8232). Same function and arguments as MATLAB pCTCubicSpline.

Parameters:
  • posIn (array_like, shape (2, N) or (2*N,)) – Entry and exit positions in mm: x of every proton, then y.

  • posOut (array_like, shape (2, N) or (2*N,)) – Entry and exit positions in mm: x of every proton, then y.

  • dirIn (array_like, shape (2, N) or (2*N,)) – Entry and exit directions (x and y, with the z component equal to 1).

  • dirOut (array_like, shape (2, N) or (2*N,)) – Entry and exit directions (x and y, with the z component equal to 1).

  • Wepl (array_like, shape (N,)) – WEPL of each proton, in mm.

  • eIn (float) – Initial beam energy, in MeV.

  • geo (object) – With dDetector (pixel size) and sDetector (size of the radiography), both in (y, x) order like other TIGRE detector fields in Python (MATLAB: [x; y]); DSO, DSID (source to entry detector), DSD (source to exit detector); hull = [a, b, alpha, h] (h = 0: no hull); mode, "parallel" or "cone". Lengths in mm.

Returns:

numpy.ndarray, float32, shape (ny, nx) – The radiography, indexed [y, x] (MATLAB: proj(y, x)). Pixels no proton crossed are NaN.

Dual energy#

Always installed. See Dual-energy CBCT.

tigre.plugins.dual_energy.DeDecompose(proj_l, angles_l, proj_h, angles_h, scanner=None, kVl=80, kVh=140, material1=None, material2=None, interpolation='nearest', tolerance=None)#

Map CBCT projections taken at two kV settings to equivalent thicknesses of two materials.

For each high-kV projection, the low-kV projection at the same angle is found (see interpolation), and every pixel pair (L, H) is mapped to two thicknesses with third-degree transfer functions whose coefficients come from the scanner’s calibration (Common/data/dual_energy_calibrations.json). Other scanners, kV pairs or basis materials need calibration data added there.

Method: Keeler A. et al., Technical note: TIGRE-DE for the creation of virtual monoenergetic images from dual-energy cone-beam CT, Med Phys 2024, https://doi.org/10.1002/mp.17002 (BibTeX: entry TIGRE-DE in tigre/utilities/TIGRE.bib).

Parameters:
  • proj_l – projections (angle, v, u) and angles (radians) of the low-kV scan.

  • angles_l – projections (angle, v, u) and angles (radians) of the low-kV scan.

  • proj_h – the same for the high-kV scan. Both scans must have the same detector size.

  • angles_h – the same for the high-kV scan. Both scans must have the same detector size.

  • scanner (str) – calibration to use. Default "VarianTrueBeam", with a warning: results are only quantitative with your own scanner’s calibration.

  • kVl (float) – kV of the low- and high-kV scans. Default 80 and 140.

  • kVh (float) – kV of the low- and high-kV scans. Default 80 and 140.

  • material1 (str) – default "Al".

  • material2 (str) – default "PMMA".

  • interpolation (str) – how to get the low-kV projection at a high-kV angle: "nearest" (default) the low-kV projection with the closest angle; "linear" linear interpolation between the low-kV projections either side; "skip" like "nearest", but high-kV projections with no low-kV projection within tolerance are skipped.

  • tolerance (float) – for "skip", the largest angle difference in radians. Default: half the low-kV angular step.

Returns:

tuple – (material1_proj, material2_proj, angles): the thicknesses of material1 and material2, (angle, v, u), at angles (the high-kV angles, minus any skipped).

tigre.plugins.dual_energy.MakeVMproj(material1_proj, material2_proj, energy, material1=None, material2=None)#

Virtual monoenergetic (VM) projections from basis material thickness projections.

VM_proj = mu1(energy) * material1_proj + mu2(energy) * material2_proj, with the attenuation coefficients mu from Common/data/NIST_material_attenuation.json, interpolated with a cubic spline (as MATLAB’s spline). Reconstruct VM_proj with any TIGRE algorithm to get a VM image.

Method: Keeler A. et al., Technical note: TIGRE-DE for the creation of virtual monoenergetic images from dual-energy cone-beam CT, Med Phys 2024, https://doi.org/10.1002/mp.17002.

Parameters:
  • material1_proj – thickness projections from DeDecompose().

  • material2_proj – thickness projections from DeDecompose().

  • energy (float) – energy in keV.

  • material1 (str) – default "Al".

  • material2 (str) – default "PMMA".

Returns:

The VM projections, the same shape as material1_proj.