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')
12-element Vector{SubString{String}}:
 "Julia Version 1.10.3"
 "Commit 0b4590a5507 (2024-04-30 10:59 UTC)"
 "Build Info:"
 "  Official https://julialang.org/ release"
 "Platform Info:"
 "  OS: Linux (x86_64-linux-gnu)"
 "  CPU: 4 × AMD EPYC 7763 64-Core Processor"
 "  WORD_SIZE: 64"
 "  LIBM: libopenlibm"
 "  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)"
 "Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)"
 ""

And with the following package versions

import Pkg; Pkg.status()
Status `~/work/Examples/Examples/docs/Project.toml`
  [e30172f5] Documenter v1.4.1
  [940e8692] Examples v0.0.1 `~/work/Examples/Examples`
  [7a1cc6ca] FFTW v1.8.0
  [9ee76f2b] ImageGeoms v0.11.1
  [787d08f9] ImageMorphology v0.4.5
  [71a99df6] ImagePhantoms v0.8.1
  [b964fa9f] LaTeXStrings v1.3.1
  [7031d0ef] LazyGrids v1.0.0
  [599c1a8e] LinearMapsAA v0.12.0
  [98b081ad] Literate v2.18.0
  [23992714] MAT v0.10.7
  [7035ae7a] MIRT v0.18.1
  [170b2178] MIRTjim v0.25.0
  [efe261a4] NFFT v0.13.3
  [91a5bcdd] Plots v1.40.4
  [2913bbd2] StatsBase v0.34.3
  [1986cc42] Unitful v1.20.0
  [b77e0a4c] InteractiveUtils
  [37e2e46d] LinearAlgebra
  [44cfe95a] Pkg v1.10.0
  [9a3f8284] Random

This page was generated using Literate.jl.