{ "cells": [ { "cell_type": "markdown", "source": [ "# FBP Overview\n", "\n", "This example illustrates how to perform filtered back-projection (FBP)\n", "image reconstruction in CT\n", "using the Julia language.\n", "\n", "This is under construction.\n", "See the demos in the Sinograms.jl package instead." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "First we add the Julia packages that are need for these examples.\n", "Change `false` to `true` in the following code block\n", "if you are using any of the following packages for the first time." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "if false\n", " import Pkg\n", " Pkg.add([\n", " \"ImagePhantoms\"\n", " \"Unitful\"\n", " \"Plots\"\n", " \"LaTeXStrings\"\n", " \"MIRTjim\"\n", " \"MIRT\"\n", " \"Sinograms\"\n", " \"InteractiveUtils\"\n", " ])\n", "end" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Now tell this Julia session to use the following packages for this example.\n", "Run `Pkg.add()` in the preceding code block first, if needed." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "using ImagePhantoms: shepp_logan, SheppLogan, radon, phantom\n", "using Unitful: mm\n", "using Plots; default(label=\"\", markerstrokecolor=:auto)\n", "using LaTeXStrings\n", "using MIRT: diffl_map, ncg\n", "using Sinograms: todo" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using MIRTjim: jim, prompt\n", "using InteractiveUtils: versioninfo" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The following line is helpful when running this jl-file as a script;\n", "this way it will prompt user to hit a key after each image is displayed." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "isinteractive() && jim(:prompt, true);" ], "metadata": {}, "execution_count": null }, { "outputs": [], "cell_type": "code", "source": [ "isinteractive() && prompt();" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Get the ellipse parameters for a CT-suitable version of the Shepp-Logan phantom\n", "and calculate (analytically) its sinogram." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "if false\n", "object = shepp_logan(SheppLogan(); fovs=(FOV,FOV))\n", "sino = radon(object).(r,ϕ')\n", "data = data / oneunit(eltype(data)) # abandon units at this point\n", "jim(kr, kϕ, abs.(data), title=\"k-space data magnitude\",\n", " xlabel=L\"k_r\",\n", " ylabel=L\"k_{\\phi}\",\n", " xticks = (-1:1) .* maximum(abs, kr),\n", " yticks = (0,π),\n", " ylims = (0,π),\n", " aspect_ratio = :none,\n", ")\n", "end" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "---\n", "\n", "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" ], "metadata": {} } ], "nbformat_minor": 3, "metadata": { "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.9.1" }, "kernelspec": { "name": "julia-1.9", "display_name": "Julia 1.9.1", "language": "julia" } }, "nbformat": 4 }