Simulations
MartaCT.Simulations.generate_photons
— Methodgenerate_photons(n::Integer, nx::Integer, nϕ::Integer)
Generate $⟨n⟩$ Poisson distributed photons per projection angle over an array of nx
detectors.
Return a nd × nϕ
matrix with the generated photons. ```
MartaCT.Simulations.sample_sinogram_external
— Methodsample_sinogram_external(sinog::AbstractMatrix; <keyword arguments>)
Simulate a low dose CT scan. This Resample sinog
with n
photons.
Arguments
sinog
: sinogram data.sinog_path='_tmp_sinog.dat'
: path to a file where to write the sinogram to.resampled_path='_tmp_resampled.dat'
: path to a file where to read the resampled sinogram from.n=10000
: mean number of photons.ϵ=1
: detectors quantum efficiency.take_log=true
: whether to take the logarithm of the resampled intensities to obtain the corresponding sinogram.verbosity=0
: set verbosity level.progress=false
: show progress bar.options=[]
: Additional options to be passed to the program.
MartaCT.Simulations.simulate
— Methodsimulate(sim::CTSimulation, sinog::AbstractMatrix; <keyword arguments>)
Simulate a CT scan by generating sim.nphotons
Poisson-distributed photons for each angle, which are then detected with a probability given by $p_{ϕ_j}(x_i) = exp(-s_{i,j})$, where $s_{i,j}$ is sinog[i,j]
.
The keyword arguments are the same as those for simulate_ct
.
See also: simulate_ct
MartaCT.Simulations.simulate_ct
— Methodsimulate_ct(sinog::AbstractMatrix; <keyword arguments>) where {T}
Simulate a low dose CT scan. This samples sinog
with $⟨n⟩$ random photons per projection angle.
Arguments
sinog
: sinogram data.nphotons::Integer=10000
: mean number of photons.ϵ::Real=1
: detectors quantum efficiency.take_log::Bool=false
: whether to take the logarithm of the resampled intensities to obtain the corresponding sinogram.
StatsBase.sample
— MethodStatsBase.sample(data::AbstractMatrix, xs::AbstractVector[; nsamples=1000, nblks=1, nbins=nothing])
Compute nsamples
from xs
according to the distribution given by each column of data
. Optionally, if nblks > 1
, nblks × nsamples
samples are computed. The sampled data are collected into a histogram of length nbins
for each column in data
. The resulting data have size (nbins, size(data, 2), nblks)
.