Skip to content

Commit b35acbc

Browse files
author
Documenter.jl
committed
build based on f5ca05a
1 parent 1de9aaf commit b35acbc

29 files changed

+580
-3
lines changed

dev/.documenter-siteinfo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-06T16:26:31","documenter_version":"1.7.0"}}
1+
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-09T06:25:32","documenter_version":"1.7.0"}}
+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"source": [
6+
"# Compressed-sensing reconstruction"
7+
],
8+
"metadata": {}
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"source": [
13+
"## Description\n",
14+
"\n",
15+
"This example describes how to perform a compressed-sensingreconstruction of a CS-2 accelerated acquisition."
16+
],
17+
"metadata": {}
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"source": [
22+
"## Loading Package"
23+
],
24+
"metadata": {}
25+
},
26+
{
27+
"outputs": [],
28+
"cell_type": "code",
29+
"source": [
30+
"using LazyArtifacts # loading data\n",
31+
"using SEQ_BRUKER_a_MP2RAGE_CS_360\n",
32+
"using CairoMakie # plotting"
33+
],
34+
"metadata": {},
35+
"execution_count": null
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"source": [
40+
"In addition we load the package internally used to perform the reconstruction"
41+
],
42+
"metadata": {}
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"source": [
47+
"## Loading Package"
48+
],
49+
"metadata": {}
50+
},
51+
{
52+
"outputs": [],
53+
"cell_type": "code",
54+
"source": [
55+
"using LazyArtifacts # loading data\n",
56+
"using SEQ_BRUKER_a_MP2RAGE_CS_360\n",
57+
"using CairoMakie # plotting\n",
58+
"\n",
59+
"datadir = Main.MP2_artifacts\n",
60+
"@info \"The test data is located at $datadir.\""
61+
],
62+
"metadata": {},
63+
"execution_count": null
64+
},
65+
{
66+
"cell_type": "markdown",
67+
"source": [
68+
"If you want to perform your own reconstruction, you can change the following line in order to point to another a bruker dataset"
69+
],
70+
"metadata": {}
71+
},
72+
{
73+
"outputs": [],
74+
"cell_type": "code",
75+
"source": [
76+
"path_bruker = joinpath(datadir, \"MP2RAGE_CS2\")"
77+
],
78+
"metadata": {},
79+
"execution_count": null
80+
},
81+
{
82+
"cell_type": "markdown",
83+
"source": [
84+
"## Compressed-sensing reconstruction\n",
85+
"In order to use an advanced reconstruction we will pass some parameters that will be used by the reconstruction package MRIReco.jl"
86+
],
87+
"metadata": {}
88+
},
89+
{
90+
"outputs": [],
91+
"cell_type": "code",
92+
"source": [
93+
"using SEQ_BRUKER_a_MP2RAGE_CS_360.MRIReco\n",
94+
"using SEQ_BRUKER_a_MP2RAGE_CS_360.MRIReco.RegularizedLeastSquares"
95+
],
96+
"metadata": {},
97+
"execution_count": null
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"source": [
102+
"We have to create a parameter dictionnary that will be used. If you need more information about it take a look at [MRIReco.jl](https://github.com/MagneticResonanceImaging/MRIReco.jl)"
103+
],
104+
"metadata": {}
105+
},
106+
{
107+
"outputs": [],
108+
"cell_type": "code",
109+
"source": [
110+
"CS = Dict{Symbol,Any}()\n",
111+
"CS[:sparseTrafo] = \"Wavelet\" #sparse trafo\n",
112+
"CS[:reg] = L1Regularization(100.) # regularization\n",
113+
"CS[:solver] = FISTA # solver\n",
114+
"CS[:iterations] = 30\n",
115+
"\n",
116+
"d = reconstruction_MP2RAGE(path_bruker; mean_NR=true,paramsCS = CS)"
117+
],
118+
"metadata": {},
119+
"execution_count": null
120+
},
121+
{
122+
"cell_type": "markdown",
123+
"source": [
124+
"for comparison purpose let's perform the undersampled reconstruction (without the paramCS keyword)"
125+
],
126+
"metadata": {}
127+
},
128+
{
129+
"outputs": [],
130+
"cell_type": "code",
131+
"source": [
132+
"d_under = reconstruction_MP2RAGE(path_bruker; mean_NR=true)"
133+
],
134+
"metadata": {},
135+
"execution_count": null
136+
},
137+
{
138+
"cell_type": "markdown",
139+
"source": [
140+
"We can check the results"
141+
],
142+
"metadata": {}
143+
},
144+
{
145+
"outputs": [],
146+
"cell_type": "code",
147+
"source": [
148+
"begin\n",
149+
" f = Figure(size=(500,400))\n",
150+
" ax=Axis(f[1,1],title=\"TI₁ undersampled\")\n",
151+
" h=heatmap!(ax,abs.(d_under[\"im_reco\"][:,:,60,1,1,1]),colormap=:grays)\n",
152+
"\n",
153+
" ax=Axis(f[1,2],title=\"TI₁ CS\")\n",
154+
" h=heatmap!(ax,abs.(d[\"im_reco\"][:,:,60,1,1,1]),colormap=:grays)\n",
155+
"\n",
156+
"\n",
157+
" ax=Axis(f[2,1],title=\"UNIT1 undersampled\")\n",
158+
" h=heatmap!(ax,d_under[\"T1map\"][:,:,60,1,1],colorrange = (500,2000))\n",
159+
"\n",
160+
" ax=Axis(f[2,2],title=\"UNIT1 CS\")\n",
161+
" h=heatmap!(ax,d[\"T1map\"][:,:,60,1,1],colorrange = (500,2000))\n",
162+
"\n",
163+
" for ax in f.content # hide decoration befor adding colorbar\n",
164+
" hidedecorations!(ax)\n",
165+
" end\n",
166+
"\n",
167+
" Colorbar(f[2,3],h,label = \"T₁ [ms]\", flip_vertical_label=true)\n",
168+
" f\n",
169+
"end"
170+
],
171+
"metadata": {},
172+
"execution_count": null
173+
},
174+
{
175+
"cell_type": "markdown",
176+
"source": [
177+
"## Write results in BIDS format\n",
178+
"Results can be written following most of the [qBIDS format recommandation](https://bids-specification.readthedocs.io/en/stable/appendices/qmri.html)"
179+
],
180+
"metadata": {}
181+
},
182+
{
183+
"outputs": [],
184+
"cell_type": "code",
185+
"source": [
186+
"subject_name = \"sub_01_cs\"\n",
187+
"dir_path = \"\" # directory path where the files will be create\n",
188+
"write_bids_MP2RAGE(d,subject_name,dir_path)"
189+
],
190+
"metadata": {},
191+
"execution_count": null
192+
},
193+
{
194+
"cell_type": "markdown",
195+
"source": [
196+
"---\n",
197+
"\n",
198+
"*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*"
199+
],
200+
"metadata": {}
201+
}
202+
],
203+
"nbformat_minor": 3,
204+
"metadata": {
205+
"language_info": {
206+
"file_extension": ".jl",
207+
"mimetype": "application/julia",
208+
"name": "julia",
209+
"version": "1.11.1"
210+
},
211+
"kernelspec": {
212+
"name": "julia-1.11",
213+
"display_name": "Julia 1.11.1",
214+
"language": "julia"
215+
}
216+
},
217+
"nbformat": 4
218+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Compressed-sensing reconstruction · SEQ_BRUKER_a_MP2RAGE_CS_360.jl</title><meta name="title" content="Compressed-sensing reconstruction · SEQ_BRUKER_a_MP2RAGE_CS_360.jl"/><meta property="og:title" content="Compressed-sensing reconstruction · SEQ_BRUKER_a_MP2RAGE_CS_360.jl"/><meta property="twitter:title" content="Compressed-sensing reconstruction · SEQ_BRUKER_a_MP2RAGE_CS_360.jl"/><meta name="description" content="Documentation for SEQ_BRUKER_a_MP2RAGE_CS_360.jl."/><meta property="og:description" content="Documentation for SEQ_BRUKER_a_MP2RAGE_CS_360.jl."/><meta property="twitter:description" content="Documentation for SEQ_BRUKER_a_MP2RAGE_CS_360.jl."/><meta property="og:url" content="https://CRMSB.github.io/SEQ_BRUKER_a_MP2RAGE_CS_360.jl/generated/examples/advanced_reco/"/><meta property="twitter:url" content="https://CRMSB.github.io/SEQ_BRUKER_a_MP2RAGE_CS_360.jl/generated/examples/advanced_reco/"/><link rel="canonical" href="https://CRMSB.github.io/SEQ_BRUKER_a_MP2RAGE_CS_360.jl/generated/examples/advanced_reco/"/><script data-outdated-warner src="../../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../../assets/documenter.js"></script><script src="../../../search_index.js"></script><script src="../../../siteinfo.js"></script><script src="../../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../../../">SEQ_BRUKER_a_MP2RAGE_CS_360.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../../">Home</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../simple_reco/">Simple reconstruction</a></li><li class="is-active"><a class="tocitem" href>Compressed-sensing reconstruction</a><ul class="internal"><li><a class="tocitem" href="#Description"><span>Description</span></a></li><li><a class="tocitem" href="#Loading-Package"><span>Loading Package</span></a></li><li><a class="tocitem" href="#Loading-Package-2"><span>Loading Package</span></a></li><li><a class="tocitem" href="#Compressed-sensing-reconstruction"><span>Compressed-sensing reconstruction</span></a></li><li><a class="tocitem" href="#Write-results-in-BIDS-format"><span>Write results in BIDS format</span></a></li></ul></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Examples</a></li><li class="is-active"><a href>Compressed-sensing reconstruction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Compressed-sensing reconstruction</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/CRMSB/SEQ_BRUKER_a_MP2RAGE_CS_360" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/CRMSB/SEQ_BRUKER_a_MP2RAGE_CS_360/blob/main/docs/lit/examples/advanced_reco.jl" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="02-CS_reconstruction"><a class="docs-heading-anchor" href="#02-CS_reconstruction">Compressed-sensing reconstruction</a><a id="02-CS_reconstruction-1"></a><a class="docs-heading-anchor-permalink" href="#02-CS_reconstruction" title="Permalink"></a></h1><h2 id="Description"><a class="docs-heading-anchor" href="#Description">Description</a><a id="Description-1"></a><a class="docs-heading-anchor-permalink" href="#Description" title="Permalink"></a></h2><p>This example describes how to perform a compressed-sensingreconstruction of a CS-2 accelerated acquisition.</p><h2 id="Loading-Package"><a class="docs-heading-anchor" href="#Loading-Package">Loading Package</a><a id="Loading-Package-1"></a><a class="docs-heading-anchor-permalink" href="#Loading-Package" title="Permalink"></a></h2><pre><code class="language-julia hljs">using LazyArtifacts # loading data
3+
using SEQ_BRUKER_a_MP2RAGE_CS_360
4+
using CairoMakie # plotting</code></pre><p>In addition we load the package internally used to perform the reconstruction</p><h2 id="Loading-Package-2"><a class="docs-heading-anchor" href="#Loading-Package-2">Loading Package</a><a class="docs-heading-anchor-permalink" href="#Loading-Package-2" title="Permalink"></a></h2><pre><code class="language-julia hljs">using LazyArtifacts # loading data
5+
using SEQ_BRUKER_a_MP2RAGE_CS_360
6+
using CairoMakie # plotting
7+
8+
datadir = Main.MP2_artifacts
9+
@info &quot;The test data is located at $datadir.&quot;</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr36"><span class="sgr1">[ Info: </span></span>The test data is located at /home/runner/.julia/artifacts/04cd4c29bb9e2aeb5384fbc70a9af0e1a37ca369.</code></pre><p>If you want to perform your own reconstruction, you can change the following line in order to point to another a bruker dataset</p><pre><code class="language-julia hljs">path_bruker = joinpath(datadir, &quot;MP2RAGE_CS2&quot;)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">&quot;/home/runner/.julia/artifacts/04cd4c29bb9e2aeb5384fbc70a9af0e1a37ca369/MP2RAGE_CS2&quot;</code></pre><h2 id="Compressed-sensing-reconstruction"><a class="docs-heading-anchor" href="#Compressed-sensing-reconstruction">Compressed-sensing reconstruction</a><a id="Compressed-sensing-reconstruction-1"></a><a class="docs-heading-anchor-permalink" href="#Compressed-sensing-reconstruction" title="Permalink"></a></h2><p>In order to use an advanced reconstruction we will pass some parameters that will be used by the reconstruction package MRIReco.jl</p><pre><code class="language-julia hljs">using SEQ_BRUKER_a_MP2RAGE_CS_360.MRIReco
10+
using SEQ_BRUKER_a_MP2RAGE_CS_360.MRIReco.RegularizedLeastSquares</code></pre><p>We have to create a parameter dictionnary that will be used. If you need more information about it take a look at <a href="https://github.com/MagneticResonanceImaging/MRIReco.jl">MRIReco.jl</a></p><pre><code class="language-julia hljs">CS = Dict{Symbol,Any}()
11+
CS[:sparseTrafo] = &quot;Wavelet&quot; #sparse trafo
12+
CS[:reg] = L1Regularization(100.) # regularization
13+
CS[:solver] = FISTA # solver
14+
CS[:iterations] = 30
15+
16+
d = reconstruction_MP2RAGE(path_bruker; mean_NR=true,paramsCS = CS)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{Any, Any} with 7 entries:
17+
&quot;LUT&quot; =&gt; Float32[93.0 0.5; 94.0 0.5; … ; 5287.0 -0.5; 5288.0 -0.5]
18+
&quot;params_reco&quot; =&gt; Dict{Symbol, Any}(:iterations=&gt;30, :solver=&gt;FISTA, :reg=&gt;…
19+
&quot;params_MP2RAGE&quot; =&gt; ParamsMP2RAGE(800.0, 2284.1, 7.0, 5000.0, 128, 7.0, 7.0)
20+
&quot;im_reco&quot; =&gt; ComplexF32[20.6719+0.52792im 10.2103+14.8791im … 68.1408-…
21+
&quot;T1map&quot; =&gt; Float32[2686.0 2301.0 … 1311.0 1511.0; 2327.0 1187.0 … 10…
22+
&quot;params_prot&quot; =&gt; BrukerFile: /home/runner/.julia/artifacts/04cd4c29bb9e2ae…
23+
&quot;MP2RAGE&quot; =&gt; Float32[-0.374886 -0.295792 … 0.0963415 -0.00549168; -0.3…</code></pre><p>for comparison purpose let&#39;s perform the undersampled reconstruction (without the paramCS keyword)</p><pre><code class="language-julia hljs">d_under = reconstruction_MP2RAGE(path_bruker; mean_NR=true)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{Any, Any} with 7 entries:
24+
&quot;LUT&quot; =&gt; Float32[93.0 0.5; 94.0 0.5; … ; 5287.0 -0.5; 5288.0 -0.5]
25+
&quot;params_reco&quot; =&gt; Dict{Any, Any}(:iterations=&gt;1, :reconSize=&gt;(128, 128, 96)…
26+
&quot;params_MP2RAGE&quot; =&gt; ParamsMP2RAGE(800.0, 2284.1, 7.0, 5000.0, 128, 7.0, 7.0)
27+
&quot;im_reco&quot; =&gt; ComplexF32[61.552+126.668im 14.7966+115.13im … 53.1283-59…
28+
&quot;T1map&quot; =&gt; Float32[2463.0 2481.0 … 1006.0 1777.0; 1924.0 1701.0 … 12…
29+
&quot;params_prot&quot; =&gt; BrukerFile: /home/runner/.julia/artifacts/04cd4c29bb9e2ae…
30+
&quot;MP2RAGE&quot; =&gt; Float32[-0.333003 -0.33682 … 0.260251 -0.124936; -0.18115…</code></pre><p>We can check the results</p><pre><code class="language-julia hljs">begin
31+
f = Figure(size=(500,400))
32+
ax=Axis(f[1,1],title=&quot;TI₁ undersampled&quot;)
33+
h=heatmap!(ax,abs.(d_under[&quot;im_reco&quot;][:,:,60,1,1,1]),colormap=:grays)
34+
35+
ax=Axis(f[1,2],title=&quot;TI₁ CS&quot;)
36+
h=heatmap!(ax,abs.(d[&quot;im_reco&quot;][:,:,60,1,1,1]),colormap=:grays)
37+
38+
39+
ax=Axis(f[2,1],title=&quot;UNIT1 undersampled&quot;)
40+
h=heatmap!(ax,d_under[&quot;T1map&quot;][:,:,60,1,1],colorrange = (500,2000))
41+
42+
ax=Axis(f[2,2],title=&quot;UNIT1 CS&quot;)
43+
h=heatmap!(ax,d[&quot;T1map&quot;][:,:,60,1,1],colorrange = (500,2000))
44+
45+
for ax in f.content # hide decoration befor adding colorbar
46+
hidedecorations!(ax)
47+
end
48+
49+
Colorbar(f[2,3],h,label = &quot;T₁ [ms]&quot;, flip_vertical_label=true)
50+
f
51+
end</code></pre><img src="56f999b1.png" alt="Example block output"/><h2 id="Write-results-in-BIDS-format"><a class="docs-heading-anchor" href="#Write-results-in-BIDS-format">Write results in BIDS format</a><a id="Write-results-in-BIDS-format-1"></a><a class="docs-heading-anchor-permalink" href="#Write-results-in-BIDS-format" title="Permalink"></a></h2><p>Results can be written following most of the <a href="https://bids-specification.readthedocs.io/en/stable/appendices/qmri.html">qBIDS format recommandation</a></p><pre><code class="language-julia hljs">subject_name = &quot;sub_01_cs&quot;
52+
dir_path = &quot;&quot; # directory path where the files will be create
53+
write_bids_MP2RAGE(d,subject_name,dir_path)</code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../simple_reco/">« Simple reconstruction</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Saturday 9 November 2024 06:25">Saturday 9 November 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

0 commit comments

Comments
 (0)