Skip to content

Commit

Permalink
Add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Feb 14, 2024
1 parent 0a3ac9a commit 9caff71
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ On CUDA it is faster much than Matlab and it offers the same or faster speed tha

#### ⚠️ This package is still very young. I would be happy to receive any feedback or if we can improve anything, just open an issue! ⚠️

<a href="docs/src/assets/RadonKA_logo.png"><img src="docs/src/assets/RadonKA_logo.png" width="200"></a>
<a href="docs/src/assets/logo.png"><img src="docs/src/assets/logo.png" width="200"></a>

[![Build Status](https://github.com/roflmaostc/RadonKA.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/roflmaostc/RadonKA.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/roflmaostc/RadonKA.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/roflmaostc/RadonKA.jl) [![Documentation for stable version](https://img.shields.io/badge/docs-stable-blue.svg)](https://roflmaostc.github.io/RadonKA.jl/stable) [![Documentation for development version](https://img.shields.io/badge/docs-main-blue.svg)](https://roflmaostc.github.io/RadonKA.jl/dev)
Expand Down
83 changes: 82 additions & 1 deletion docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "eddb71d2ac352012abcf8111e85f5032b7826df9"
project_hash = "ec8417e1987672fc4f1e9bea30b845240bbe0375"

[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
Expand Down Expand Up @@ -51,6 +51,23 @@ version = "0.1.0"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.BibInternal]]
git-tree-sha1 = "0c62b284a52ec39ee831e10bf62c17d587dde75f"
uuid = "2027ae74-3657-4b95-ae00-e2f7d55c3e64"
version = "0.3.5"

[[deps.BibParser]]
deps = ["BibInternal", "DataStructures", "Dates", "JSONSchema", "YAML"]
git-tree-sha1 = "f24884311dceb5f8eafe11809b6f1d867b489a46"
uuid = "13533e5b-e1c2-4e57-8cef-cac5e52f6474"
version = "0.2.1"

[[deps.Bibliography]]
deps = ["BibInternal", "BibParser", "DataStructures", "Dates", "FileIO", "YAML"]
git-tree-sha1 = "520c679daed011ce835d9efa7778863aad6687ed"
uuid = "f1be7e48-bf82-45af-a471-ae754a193061"
version = "0.2.20"

[[deps.CEnum]]
git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down Expand Up @@ -81,6 +98,12 @@ deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.5+1"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "ac67408d9ddf207de5cfa9a97e114352430f01ed"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.16"

[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -97,6 +120,12 @@ git-tree-sha1 = "2613dbec8f4748273bbe30ba71fd5cb369966bac"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "1.2.1"

[[deps.DocumenterCitations]]
deps = ["AbstractTrees", "Bibliography", "Dates", "Documenter", "Logging", "Markdown", "MarkdownAST", "OrderedCollections", "Unicode"]
git-tree-sha1 = "848c180c853afcfed0604b9cc1204a723957ee74"
uuid = "daee34ce-89f3-4625-b898-19384cb65244"
version = "1.3.2"

[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand All @@ -120,6 +149,12 @@ git-tree-sha1 = "c6033cc3892d0ef5bb9cd29b7f2f0331ea5184ea"
uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a"
version = "3.3.10+0"

[[deps.FileIO]]
deps = ["Pkg", "Requires", "UUIDs"]
git-tree-sha1 = "c5c28c245101bd59154f649e19b038d15901b5dc"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.16.2"

[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

Expand Down Expand Up @@ -169,6 +204,24 @@ git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.4"

[[deps.JSON3]]
deps = ["Dates", "Mmap", "Parsers", "PrecompileTools", "StructTypes", "UUIDs"]
git-tree-sha1 = "eb3edce0ed4fa32f75a0a11217433c31d56bd48b"
uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
version = "1.14.0"

[deps.JSON3.extensions]
JSON3ArrowExt = ["ArrowTypes"]

[deps.JSON3.weakdeps]
ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd"

[[deps.JSONSchema]]
deps = ["Downloads", "JSON", "JSON3", "URIs"]
git-tree-sha1 = "5f0bd0cd69df978fa64ccdcb5c152fbc705455a1"
uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "1.3.0"

[[deps.KernelAbstractions]]
deps = ["Adapt", "Atomix", "InteractiveUtils", "LinearAlgebra", "MacroTools", "PrecompileTools", "Requires", "SparseArrays", "StaticArrays", "UUIDs", "UnsafeAtomics", "UnsafeAtomicsLLVM"]
git-tree-sha1 = "4e0cb2f5aad44dcfdc91088e85dee4ecb22c791c"
Expand Down Expand Up @@ -297,6 +350,11 @@ git-tree-sha1 = "60e3045590bd104a16fefb12836c00c0ef8c7f8c"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.0.13+0"

[[deps.OrderedCollections]]
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.6.3"

[[deps.PCRE2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
Expand Down Expand Up @@ -394,6 +452,18 @@ git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d"
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
version = "1.4.2"

[[deps.StringEncodings]]
deps = ["Libiconv_jll"]
git-tree-sha1 = "b765e46ba27ecf6b44faf70df40c57aa3a547dcb"
uuid = "69024149-9ee7-55f6-a4c4-859efe599b68"
version = "0.3.7"

[[deps.StructTypes]]
deps = ["Dates", "UUIDs"]
git-tree-sha1 = "ca4bccb03acf9faaf4137a9abc1881ed1841aa70"
uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
version = "1.10.0"

[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
Expand All @@ -413,6 +483,11 @@ version = "1.10.0"
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[deps.URIs]]
git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.5.1"

[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Expand All @@ -431,6 +506,12 @@ git-tree-sha1 = "323e3d0acf5e78a56dfae7bd8928c989b4f3083e"
uuid = "d80eeb9a-aca5-4d75-85e5-170c8b632249"
version = "0.1.3"

[[deps.YAML]]
deps = ["Base64", "Dates", "Printf", "StringEncodings"]
git-tree-sha1 = "e6330e4b731a6af7959673621e91645eb1356884"
uuid = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
version = "0.4.9"

[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
RadonKA = "86de8297-835b-47df-b249-c04e8db91db5"
10 changes: 9 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
using RadonKA, Documenter
using RadonKA, Documenter, DocumenterCitations

bib = CitationBibliography(
joinpath(@__DIR__, "src", "ref.bib");
style=:numeric
)

DocMeta.setdocmeta!(RadonKA, :DocTestSetup, :(using RadonKA); recursive=true)
makedocs(modules = [RadonKA],
sitename = "RadonKA.jl",
pages = Any[
"RadonKA.jl" => "index.md",
"Mathematical Background" => "mathematical.md",
"Simple Tutorial" => "tutorial.md",
"Specifying different geometries and absorption" => "geometries.md",
"Benchmark with Matlab and Astra" => "benchmark.md",
"Function Docstrings" => "functions.md"
],
warnonly=true,
plugins=[bib,]
)

deploydocs(repo = "github.com/roflmaostc/RadonKA.jl.git", devbranch="main")

Binary file added docs/src/assets/geometry.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A simple yet sufficiently fast Radon and adjoint Radon (backproject) transform implementation using [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl).

```@raw html
<a href="assets/RadonKA_logo.png"><img src="assets/RadonKA_logo.png" width="200"></a>
<a href="assets/logo.png"><img src="assets/logo.png" width="200"></a>
```

[![Build Status](https://github.com/roflmaostc/RadonKA.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/roflmaostc/RadonKA.jl/actions/workflows/CI.yml?query=branch%3Amain)
Expand Down
56 changes: 56 additions & 0 deletions docs/src/mathematical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Mathematial background
## Introduction
The Radon transform [radon1917uber](@cite) is an integral transform which is the foundation
behind computed tomography (CT).
It projects the values of a function along straight lines onto a detector.
These projections are calculated for a set of different observation angles around the function.
Such a dataset allows to reconstruct the original function distribution.



## Definition
The general definition of the parallel attenuated Radon transform (ART) $\mathcal{R}_{\mu}$ is

$$g(s, \theta) = (\mathcal{R}_{\mu} f)(s, \theta) = \int_{-\infty}^{\infty} f(s\,\pmb{\omega} + t\,\pmb{\omega}^{\perp}) \exp\left(- \int_t^{\infty} \mu\left(s\,\pmb{\omega} + \tau\,\pmb{\omega}^{\perp}\right)\,\,\mathrm{d}\tau\right)\,\, \mathrm{d}t$$

where $\mu$ is the position dependent absorption coefficient. The vectors are defined as $\omega=(\cos \theta, \sin \theta)$ and
$\omega^{\perp}=(-\sin \theta, \cos \theta)$.

In case of zero absorption ($\mu=0$) the ART reduces to the ordinary Radon transform.
## Adjoint
If $\mu$ is known, the adjoint of the ART with respect to $f$ is given by

$$(\mathcal{R}_{\mu}^* g)(x, y) = \int_{0}^{2\pi} g( \pmb{\omega} \cdot [x,y]^{\intercal}, \theta) \exp\left(- \int_{[x,y]^{\intercal} \cdot \pmb{\omega}^{\perp}}^{\infty} \mu\left([x,y]^{\intercal} \cdot \pmb{\omega} + \tau\,\pmb{\omega}^{\perp}\right)\,\,\mathrm{d}\tau\right)\,\, \mathrm{d}\theta$$

where $\mu$ is the position dependent absorption coefficient.
Qualitatively, the Radon transform calculates the _shadow_ of a sample if illuminated with plane waves.


## Discretization
On the other hand, the adjoint Radon transform _smears_ the _shadows_ (projection patterns) back into space and deposits values at each point.
The pair of $\mathcal{R}_{\mu}$ and $\mathcal{R}_{\mu}^*$ can be used in gradient descent based optimizers.

In the figure below we show the geometry to the presented equations. Further, we show how the grid is discretized.
`RadonKA.jl` traces a ray through the pixel grid.
The function value it accumulates (Radon transform) or deposits (adjoint Radon transform) depends on the intersection length with each pixel.

```@raw html
<img src="../assets/geometry.png" alt="The geometry of the Radon transform." width="500"/>
```


## Applications
The ordinary Radon transform is the mathematical concept behind CT [Buzug2011](@cite). CT allows to recover a 3D absorption map of objects such as human bodies.
One application of the ART is single photon emission computerized tomography (SPECT) [spect](@cite).
In SPECT a tracer is injected in the specimen (e.g. blood of human bodies). The trace is radioactive and emits gamma rays which are detected.
Since the gamma rays are created inside the body, its intensity is weakened from the starting point of the emission until hitting the detector.
A more recent usage of the ART is within the context of Tomographic Volumetric Additive Manufacturing (TVAM) [Kelly_Bhattacharya_Heidari_Shusteff_Spadaccini_Taylor_2019](@cite), [Loterie_Delrot_Moser_2020](@cite).

In TVAM a photosensitive resin is illuminated with projection patterns from different angular positions.
The light is absorbed while propagating through that medium and reacting with the photo-initiator. Once a certain voxel in space received a
sufficient energy dose, it is going to polymerize. The mathematical process behind this printer is given by the adjoint of the ART.

## References

```@bibliography
```
52 changes: 52 additions & 0 deletions docs/src/ref.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@Inbook{Buzug2011,
author="Buzug, Thorsten M.",
editor="Kramme, R{\"u}diger
and Hoffmann, Klaus-Peter
and Pozos, Robert S.",
title="Computed Tomography",
bookTitle="Springer Handbook of Medical Technology",
year="2011",
publisher="Springer Berlin Heidelberg",
address="Berlin, Heidelberg",
pages="311--342",
abstract="In this chapter, historical milestones of computed tomography (CT) (Sect. 16.2), recent technology with a focus on generation and detection of x-rays (Sect. 16.3), as well as image reconstruction (Sect. 16.4) are discussed. Furthermore, the chapter includes aspects of applications (Sect.16.5), dose exposure in computed tomography (Sect. 16.6), and a brief overview on special CT developments (Sect. 16.7). Since this chapter gives a review, the interested reader is referred to recent literature on computed tomography including a detailed discussion of CT technology in the references section.",
isbn="978-3-540-74658-4",
doi="10.1007/978-3-540-74658-4_16",
url="https://doi.org/10.1007/978-3-540-74658-4_16"
}

@inbook{spect,
title = {7. The Inversion of the Attenuated Radon Transform and Medical Imaging},
booktitle = {A Unified Approach to Boundary Value Problems},
author={Fokas, Athanassios Spyridon},
year = {2012},
pages = {103-111},
doi = {10.1137/1.9780898717068.ch7},
URL = {https://epubs.siam.org/doi/abs/10.1137/1.9780898717068.ch7},
eprint = {https://epubs.siam.org/doi/pdf/10.1137/1.9780898717068.ch7},
abstract = { The celebrated Radon transform provides the mathematical basis of computerized tomography (CT). Similarly, the attenuated Radon transform provides the mathematical basis of a new imaging technique of great significance, namely single photon emission computerized tomography (SPECT). Before discussing the mathematics of CT and SPECT we first present a brief introduction of these remarkable imaging techniques. 7.1 Computerized Tomography In brain imaging, CT is the computer aided reconstruction of a mathematical function that represents the X-ray attenuation coefficient of the brain tissue (and is therefore related to its density). Let f(x1, x2) denote the X-ray attenuation coefficient at the point (x1, x2). This means that X-rays transversing a small distance Δτ at (x1, x2) suffer a relative intensity loss ΔI/I = −FΔτ. Taking the limit and solving the resulting ODE we find I1/I0 = exp[− ∫L fdτ], where L denotes the part of the line that transverses the tissue. Since I1/I0 is known from the measurements, the basic mathematical problem of CT is to reconstruct a function from the knowledge of its line integrals. The line integral of a function is called its Radon transform. In order to define this transform we introduce local coordinates: Let the line L make an angle θ with the positive x1-axis. A point (x1, x2) on this line can be specified by the variables (ρ, τ), where ρ is the distance from the origin and τ is aparameter along the line; see Figure 7.1. A unit vector ḵ along L is given by (cos θ, sin θ), and thus ( x1 , x2 ) =τ ( cos θ , sin θ )+ρ (−sin θ ,cos θ). Hence, the variables (x1, x2) and (τ, ρ), for fixed θ, are related by the equations x1 =τ cos θ−ρ sin θ, x2 =τ sin θ +ρ cos θ . 7.1 }
}


@article{Kelly_Bhattacharya_Heidari_Shusteff_Spadaccini_Taylor_2019, title={Volumetric additive manufacturing via tomographic reconstruction}, volume={363}, DOI={10.1126/science.aau7114}, abstractNote={Additive manufacturing promises enormous geometrical freedom and the potential to combine materials for complex functions. The speed, geometry, and surface quality limitations of additive processes are linked to their reliance on material layering. We demonstrated concurrent printing of all points within a three-dimensional object by illuminating a rotating volume of photosensitive material with a dynamically evolving light pattern. We printed features as small as 0.3 millimeters in engineering acrylate polymers and printed soft structures with exceptionally smooth surfaces into a gelatin methacrylate hydrogel. Our process enables us to construct components that encase other preexisting solid objects, allowing for multimaterial fabrication. We developed models to describe speed and spatial resolution capabilities and demonstrated printing times of 30 to 120 seconds for diverse centimeter-scale objects.}, number={6431}, journal={Science}, publisher={American Association for the Advancement of Science}, author={Kelly, Brett E. and Bhattacharya, Indrasen and Heidari, Hossein and Shusteff, Maxim and Spadaccini, Christopher M. and Taylor, Hayden K.}, year={2019}, month=mar, pages={1075–1079} }


@article{Loterie_Delrot_Moser_2020, title={High-resolution tomographic volumetric additive manufacturing}, volume={11}, rights={2020 The Author(s)}, ISSN={2041-1723}, DOI={10.1038/s41467-020-14630-4}, abstractNote={In tomographic volumetric additive manufacturing, an entire three-dimensional object is simultaneously solidified by irradiating a liquid photopolymer volume from multiple angles with dynamic light patterns. Though tomographic additive manufacturing has the potential to produce complex parts with a higher throughput and a wider range of printable materials than layer-by-layer additive manufacturing, its resolution currently remains limited to 300 µm. Here, we show that a low-étendue illumination system enables the production of high-resolution features. We further demonstrate an integrated feedback system to accurately control the photopolymerization kinetics over the entire build volume and improve the geometric fidelity of the object solidification. Hard and soft centimeter-scale parts are produced in less than 30 seconds with 80 µm positive and 500 µm negative features, thus demonstrating that tomographic additive manufacturing is potentially suitable for the ultrafast fabrication of advanced and functional constructs.}, number={11}, journal={Nature Communications}, publisher={Nature Publishing Group}, author={Loterie, Damien and Delrot, Paul and Moser, Christophe}, year={2020}, month=feb, pages={852}, language={en} }

@article{radon1917uber,
added-at = {2010-08-20T12:09:24.000+0200},
author = {Radon, J.},
biburl = {https://www.bibsonomy.org/bibtex/2b0128caaef39bf1265503f99b560dbfb/haggis79},
interhash = {fdcf4d741dfedba3c56a3a942ecc463b},
intrahash = {b0128caaef39bf1265503f99b560dbfb},
journal = {Akad. Wiss.},
keywords = {imported},
owner = {schohaad},
pages = {262-277},
timestamp = {2010-08-20T12:09:25.000+0200},
title = {{\"U}ber die {B}estimmung von {F}unktionen durch ihre {I}ntegralwerte
l\"angs gewisser {M}annigfaltigkeiten},
volume = 69,
year = 1917
}

0 comments on commit 9caff71

Please sign in to comment.