GPU-portable polychromatic CT simulator in Julia. Runs on Metal, CUDA, ROCm, or CPU via AcceleratedKernels.jl. Models energy-integrating and photon-counting detectors, single- and dual-kVp acquisitions, and reconstructs with FBP (FDK), Hybrid IR, and material-basis VMI.
using Pkg
Pkg.add(url="https://github.com/MolloiLab/BasisSimulator.jl")For GPU support, also add your backend:
Pkg.add("Metal") # Apple Silicon
Pkg.add("CUDA") # NVIDIA
Pkg.add("AMDGPU") # AMDimport BasisSimulator as BS
using Metal # or CUDA / AMDGPU; omit for CPU
phantom_cpu = BS.create_gammex_472(n_voxels=256)
phantom = BS.Phantom(MtlArray(phantom_cpu.mask),
phantom_cpu.materials,
phantom_cpu.voxel_size)
scanner = BS.Scanner(
source_to_isocenter = 626.0, # mm
source_to_detector = 1097.0,
detector_rows = 64,
detector_cols = 832,
detector_row_size = 0.625,
detector_col_size = 1.053,
)
protocol = BS.CTProtocol(kVp=120.0, mA=200.0, views=984)
sim_opts = BS.SimOptions(fidelity=:eict)
rec_opts = BS.ReconOptions(matrix_size=(512, 512, 64), fov_cm=35.0)
ws = BS.create_eict_workspace(scanner, protocol, sim_opts, rec_opts, phantom)
BS.simulate!(ws, phantom, scanner, protocol, sim_opts, rec_opts)
ws_fdk = BS.create_fdk_recon_workspace(ws.sino_noisy_out, ws.geom, rec_opts.matrix_size)
hu = BS.to_hounsfield(
Array(BS.reconstruct!(ws_fdk, ws.sino_noisy_out, ws.geom, rec_opts.matrix_size));
μ_water = BS.get_reference_μ_water(70.0),
)Full API reference, physics overview, and worked examples: docs link TBD (Documenter site
in preparation). Until then, see docstrings via ?Function in the Julia REPL.
MIT. Core ray tracing ported from TIGRE; calibration workflow follows CatSim/XCIST.