FBP Overview

This example illustrates how to perform filtered back-projection (FBP) image reconstruction in CT using the Julia language.

This is under construction. See the demos in the Sinograms.jl package instead.

This page comes from a single Julia file: 1-fbp.jl.

You can access the source code for such Julia documentation using the 'Edit on GitHub' link in the top right. You can view the corresponding notebook in nbviewer here: 1-fbp.ipynb, or open it in binder here: 1-fbp.ipynb.

First we add the Julia packages that are need for these examples. Change false to true in the following code block if you are using any of the following packages for the first time.

if false
    import Pkg
    Pkg.add([
        "ImagePhantoms"
        "Unitful"
        "Plots"
        "LaTeXStrings"
        "MIRTjim"
        "MIRT"
        "Sinograms"
        "InteractiveUtils"
    ])
end

Now tell this Julia session to use the following packages for this example. Run Pkg.add() in the preceding code block first, if needed.

using ImagePhantoms: shepplogan, SheppLogan, radon, phantom using Unitful: mm using Plots; default(label="", markerstrokecolor=:auto) using LaTeXStrings using MIRT: difflmap, ncg using Sinograms: todo

using MIRTjim: jim, prompt
using InteractiveUtils: versioninfo

The following line is helpful when running this jl-file as a script; this way it will prompt user to hit a key after each image is displayed.

isinteractive() && jim(:prompt, true);
isinteractive() && prompt();

Get the ellipse parameters for a CT-suitable version of the Shepp-Logan phantom and calculate (analytically) its sinogram.

if false object = shepplogan(SheppLogan(); fovs=(FOV,FOV)) sino = radon(object).(r,ϕ') data = data / oneunit(eltype(data)) # abandon units at this point jim(kr, kϕ, abs.(data), title="k-space data magnitude", xlabel=L"kr", ylabel=L"k{\phi}", xticks = (-1:1) .* maximum(abs, kr), yticks = (0,π), ylims = (0,π), aspectratio = :none, ) end

Reproducibility

This page was generated with the following version of Julia:

using InteractiveUtils: versioninfo
io = IOBuffer(); versioninfo(io); split(String(take!(io)), '\n')
10-element Vector{SubString{String}}:
 "Julia Version 1.9.1"
 "Commit 147bdf428cd (2023-06-07 08:27 UTC)"
 "Platform Info:"
 "  OS: Linux (x86_64-linux-gnu)"
 "  CPU: 2 × Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz"
 "  WORD_SIZE: 64"
 "  LIBM: libopenlibm"
 "  LLVM: libLLVM-14.0.6 (ORCJIT, broadwell)"
 "  Threads: 1 on 2 virtual cores"
 ""

And with the following package versions

import Pkg; Pkg.status()
Status `~/work/Examples/Examples/docs/Project.toml`
  [e30172f5] Documenter v0.27.24
  [940e8692] Examples v0.0.1 `~/work/Examples/Examples`
  [7a1cc6ca] FFTW v1.7.0
  [9ee76f2b] ImageGeoms v0.10.0
  [787d08f9] ImageMorphology v0.4.4
  [71a99df6] ImagePhantoms v0.7.2
  [b964fa9f] LaTeXStrings v1.3.0
  [7031d0ef] LazyGrids v0.5.0
  [599c1a8e] LinearMapsAA v0.11.0
  [98b081ad] Literate v2.14.0
  [23992714] MAT v0.10.5
  [7035ae7a] MIRT v0.17.0
  [170b2178] MIRTjim v0.22.0
  [efe261a4] NFFT v0.13.3
  [91a5bcdd] Plots v1.38.16
  [2913bbd2] StatsBase v0.34.0
  [1986cc42] Unitful v1.14.0
  [b77e0a4c] InteractiveUtils
  [37e2e46d] LinearAlgebra
  [44cfe95a] Pkg v1.9.0
  [9a3f8284] Random

This page was generated using Literate.jl.