diff --git a/Notebooks/Accelerated Imaging Methods.ipynb b/Notebooks/Accelerated Imaging Methods.ipynb index 4195fdc..3935fbb 100644 --- a/Notebooks/Accelerated Imaging Methods.ipynb +++ b/Notebooks/Accelerated Imaging Methods.ipynb @@ -70,7 +70,11 @@ { "cell_type": "code", "execution_count": 11, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -175,7 +179,11 @@ { "cell_type": "code", "execution_count": 17, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Advanced SNR.ipynb b/Notebooks/Advanced SNR.ipynb index e76a5c5..17fb591 100644 --- a/Notebooks/Advanced SNR.ipynb +++ b/Notebooks/Advanced SNR.ipynb @@ -33,7 +33,11 @@ "cell_type": "code", "execution_count": 1, "id": "2f8f0e3f", - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -137,7 +141,11 @@ "cell_type": "code", "execution_count": 2, "id": "dad9e1c5", - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Artifacts.ipynb b/Notebooks/Artifacts.ipynb index 0f22473..e00d5cb 100644 --- a/Notebooks/Artifacts.ipynb +++ b/Notebooks/Artifacts.ipynb @@ -56,7 +56,11 @@ { "cell_type": "code", "execution_count": 29, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -130,7 +134,11 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -177,7 +185,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -399,7 +411,11 @@ { "cell_type": "code", "execution_count": 37, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -446,7 +462,11 @@ { "cell_type": "code", "execution_count": 38, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Basic Contrast Mechanisms.ipynb b/Notebooks/Basic Contrast Mechanisms.ipynb index e3699f6..44af9e4 100644 --- a/Notebooks/Basic Contrast Mechanisms.ipynb +++ b/Notebooks/Basic Contrast Mechanisms.ipynb @@ -112,7 +112,10 @@ "metadata": { "jupyter": { "source_hidden": true - } + }, + "tags": [ + "hide-input" + ] }, "outputs": [ { @@ -181,7 +184,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -250,7 +257,11 @@ { "cell_type": "code", "execution_count": 4, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -287,7 +298,11 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -355,7 +370,11 @@ { "cell_type": "code", "execution_count": 6, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -394,7 +413,11 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -475,7 +498,11 @@ { "cell_type": "code", "execution_count": 8, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -524,7 +551,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -607,7 +638,11 @@ { "cell_type": "code", "execution_count": 10, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Bloch Equation.ipynb b/Notebooks/Bloch Equation.ipynb index 282f715..c33908f 100644 --- a/Notebooks/Bloch Equation.ipynb +++ b/Notebooks/Bloch Equation.ipynb @@ -92,7 +92,11 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -234,7 +238,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -306,7 +314,11 @@ { "cell_type": "code", "execution_count": 28, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -344,7 +356,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -464,7 +480,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/FOV and Resolution.ipynb b/Notebooks/FOV and Resolution.ipynb index 8ef5d65..44a54f8 100644 --- a/Notebooks/FOV and Resolution.ipynb +++ b/Notebooks/FOV and Resolution.ipynb @@ -33,7 +33,11 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -155,7 +159,11 @@ { "cell_type": "code", "execution_count": 13, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Fast Imaging Pulse Sequences.ipynb b/Notebooks/Fast Imaging Pulse Sequences.ipynb index c26f142..a287569 100644 --- a/Notebooks/Fast Imaging Pulse Sequences.ipynb +++ b/Notebooks/Fast Imaging Pulse Sequences.ipynb @@ -158,7 +158,11 @@ { "cell_type": "code", "execution_count": 22, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Image Contrast Examples.ipynb b/Notebooks/Image Contrast Examples.ipynb index 35c4fda..f8d2577 100644 --- a/Notebooks/Image Contrast Examples.ipynb +++ b/Notebooks/Image Contrast Examples.ipynb @@ -59,7 +59,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Image Reconstruction.ipynb b/Notebooks/Image Reconstruction.ipynb index 72a251f..1453fdf 100644 --- a/Notebooks/Image Reconstruction.ipynb +++ b/Notebooks/Image Reconstruction.ipynb @@ -74,7 +74,11 @@ { "cell_type": "code", "execution_count": 11, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/K-space.ipynb b/Notebooks/K-space.ipynb index bcf1e0a..bc7d5ba 100644 --- a/Notebooks/K-space.ipynb +++ b/Notebooks/K-space.ipynb @@ -129,7 +129,11 @@ { "cell_type": "code", "execution_count": 11, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -274,7 +278,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -382,7 +390,11 @@ { "cell_type": "code", "execution_count": 6, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -474,7 +486,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [], "source": [] } diff --git a/Notebooks/MRI Math Concepts.ipynb b/Notebooks/MRI Math Concepts.ipynb index a2fae2e..4a91241 100644 --- a/Notebooks/MRI Math Concepts.ipynb +++ b/Notebooks/MRI Math Concepts.ipynb @@ -68,7 +68,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -109,7 +113,11 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -227,7 +235,11 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Magnetic Fields in MRI.ipynb b/Notebooks/Magnetic Fields in MRI.ipynb index fa62fda..0103da0 100644 --- a/Notebooks/Magnetic Fields in MRI.ipynb +++ b/Notebooks/Magnetic Fields in MRI.ipynb @@ -164,7 +164,11 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -290,7 +294,11 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -322,7 +330,11 @@ { "cell_type": "code", "execution_count": 4, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -351,7 +363,11 @@ { "cell_type": "code", "execution_count": 5, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Point Spread Function Analysis.ipynb b/Notebooks/Point Spread Function Analysis.ipynb index ac4000c..7753e43 100644 --- a/Notebooks/Point Spread Function Analysis.ipynb +++ b/Notebooks/Point Spread Function Analysis.ipynb @@ -112,7 +112,11 @@ { "cell_type": "code", "execution_count": 15, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -207,7 +211,11 @@ { "cell_type": "code", "execution_count": 18, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -383,7 +391,11 @@ { "cell_type": "code", "execution_count": 20, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/RF Pulse Design.ipynb b/Notebooks/RF Pulse Design.ipynb index e462de5..e579a57 100644 --- a/Notebooks/RF Pulse Design.ipynb +++ b/Notebooks/RF Pulse Design.ipynb @@ -28,7 +28,11 @@ { "cell_type": "code", "execution_count": 18, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -132,7 +136,11 @@ { "cell_type": "code", "execution_count": 21, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -209,7 +217,11 @@ { "cell_type": "code", "execution_count": 12, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -268,7 +280,11 @@ { "cell_type": "code", "execution_count": 22, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -381,7 +397,11 @@ { "cell_type": "code", "execution_count": 23, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/RF Pulses.ipynb b/Notebooks/RF Pulses.ipynb index 311cf3f..c29d1ac 100644 --- a/Notebooks/RF Pulses.ipynb +++ b/Notebooks/RF Pulses.ipynb @@ -132,7 +132,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Spatial Encoding.ipynb b/Notebooks/Spatial Encoding.ipynb index df1a57c..ae84b3e 100644 --- a/Notebooks/Spatial Encoding.ipynb +++ b/Notebooks/Spatial Encoding.ipynb @@ -73,7 +73,11 @@ { "cell_type": "code", "execution_count": 6, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -198,7 +202,11 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { diff --git a/Notebooks/Spectral-Spatial RF Pulses.ipynb b/Notebooks/Spectral-Spatial RF Pulses.ipynb index 7fff401..7760d2a 100644 --- a/Notebooks/Spectral-Spatial RF Pulses.ipynb +++ b/Notebooks/Spectral-Spatial RF Pulses.ipynb @@ -34,7 +34,11 @@ { "cell_type": "code", "execution_count": 9, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "name": "stdout", @@ -57,7 +61,11 @@ { "cell_type": "code", "execution_count": 4, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -128,7 +136,11 @@ { "cell_type": "code", "execution_count": 17, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [], "source": [ "% Design parameters\n", @@ -157,7 +169,11 @@ { "cell_type": "code", "execution_count": 15, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -195,7 +211,11 @@ { "cell_type": "code", "execution_count": 25, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -247,7 +267,11 @@ { "cell_type": "code", "execution_count": 33, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -320,7 +344,11 @@ { "cell_type": "code", "execution_count": 32, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -362,7 +390,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [], "source": [] } diff --git a/Notebooks/_config.yml b/Notebooks/_config.yml index de91b1f..c3dd243 100644 --- a/Notebooks/_config.yml +++ b/Notebooks/_config.yml @@ -25,6 +25,9 @@ latex: sphinx: extra_extensions: - sphinx.ext.imgconverter + local_extensions: + # Removes code source in PDF builds; HTML uses collapsible hide-input cells + hide_code_latex: . # Information about where the book exists on the web repository: @@ -60,10 +63,6 @@ html: description: >- # this means to ignore newlines until "baseurl:" This provides an introduction to the principles of magnetic resonance imaging (MRI) -jupyter: - hide-input: true - - # # the name of your GitHub Repo. # # If there is no subpath for your site, use an empty string "" # baseurl: "/MRI-education-resouces" diff --git a/Notebooks/hide_code_latex.py b/Notebooks/hide_code_latex.py new file mode 100644 index 0000000..c62a408 --- /dev/null +++ b/Notebooks/hide_code_latex.py @@ -0,0 +1,14 @@ +"""Remove code-cell source from LaTeX/PDF builds only. + +HTML keeps the source behind a toggle via the `hide-input` cell tag. +""" + + +def _on_builder_inited(app): + if app.builder.name in ("latex", "pdflatex"): + app.config.nb_remove_code_source = True + + +def setup(app): + app.connect("builder-inited", _on_builder_inited, priority=900) + return {"parallel_read_safe": True}