DEBISim decomposer modules


Contents:


Compton-PE Basis Decomposition Module, CDMDecomposer

See Decomposer for the description and usage of the module.

Methods:

__init__() Constructor
decompose_dect_sinograms() function to decompose the input projection pair
set_basis_functions() function to specify new basis functions other Compton-PE bases
cdm_worker() CDM decomposer worker function for multi-threading
cost_calc() function to calculate CDM quadratic cost

Attributes:

init_val: 2D ndarray value for initialization of the DE optimization operation, default value is array([0.1, 0.1])
pix_no: int Current pixel being processed

Methods Description:

Desc. Constructor for CDMDecomposer()
Args. spctr_h_fname, spctr_l_fname: str - *file locations for high/low energy source spectrum
photon_count_low, photon_count_high: float - photon count for the high/low energy source (Number of photons emitted by the Xray source)
nangs: int - number of views in the input sinogram
nbins: int - number of channels for sinogram
projector: {gpu, cpu}, str - use gpu for faster operation; use ‘cpu’ if CUDA support is not available
out_dir: str - directory for saving the output images and logs
Return -

*These point to .txt files representing the spectral distribution of the X-ray sources, i.e., a 2D array of keV values and corresponding normalized spectra pdf. See /include/spectra/ for examples.

Desc. Function to calculate the residual cost for a given dual energy CT array pair.
Args. plrow: - row of p_l values
phrow: - row of p_h values
w_0: - initial w
p_0: -
Return calculated cost
Desc. Function to carry out CDM Dual Energy Decomposition on the input sinogram pair. The proper operation of the function depends heavily on the input arguments provided during the initialization of CDMDecomposer() and the function parameters solver, method, type. The input sinograms sino_h, sino_l must correspond to the respective spectra spctrm_l, spctrm_h and also to the repsective photon count. The choice of the parameter, solver determines the operation of the decomposition operation - CDM is performed elementwise on each pixel of the sinogram hence using parallelizing option for solver is important. Choosing solver=‘vec’ may cause long operation times for large sinograms while multithreading by solver=‘cpu’ only speeds up the process by the number of CPU on the machine. Using solver=‘gpu’ allows very high speeds through use of GPUs but requires CUDA support and the Gpufit library - see installation instructions. The choice of method decides the optimization technique used for CDM - by default, ‘lsq’ is chosen which uses the dogBox method in scip.optimze.least_squares for estimation Compton, PE values while choosing method=‘lm’ makes use of the Levenberg-Marquardt algorithm for optimization. Selecting type=‘mbd’ allows adjusting the operation for material basis decompostion as descirbed in [1] - using this option requires calling the self.set_basis_functions() functions to adjust for the material bases.
Args. sino_h: ndarray of float - high energy sinogram (log projection)
sino_lndarray of float - low energy sinogram (log projection)
solver: {gpu, cpu, vec}, str - one of multi-threaded ‘cpu’, LM on ‘gpu’ or ‘vec’
method: {lsq, lm}, str - ‘lsq’ for using scipy’s bounded least squares optimizer; otherwise exactly follows the paper
type: {cpd, mbd}, str - ‘cpd’ - Compton-PE basis decomposition;‘mbd’ - Material Basis Decomposition (requires calling set_basis_functions to change the bases from Compton-PE to the material bases)
Return sino_p, sino_c: ndarray of float - sinogram for Photoelectric/Compton image
  1. Johnson, Thorsten RC, et al. “Material differentiation by dual energy CT: initial experience.” European radiology 17.6 (2007): 1510-1517.