-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from LucyKershaw/LEK_development
Added extended Tofts
- Loading branch information
Showing
132 changed files
with
679 additions
and
73 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
==================== | ||
The Extended Tofts model | ||
==================== | ||
Simulating tissue concentrations from extended Tofts model with different settings. | ||
""" | ||
|
||
# %% | ||
# Import necessary packages | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import osipi | ||
|
||
# %% | ||
# Generate Parker AIF with default settings. | ||
|
||
# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes. | ||
t = np.arange(0, 6*60, 1) | ||
|
||
# Create an AIF with default settings | ||
ca = osipi.aif_parker(t) | ||
|
||
# %% | ||
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6 | ||
Ktrans = 0.2 # in units of 1/min | ||
ve = 0.2 # volume fraction between 0 and 1 | ||
vp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1 | ||
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) | ||
plt.plot(t, ct, 'b-', label=f'vp = {vp[0]}') | ||
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[1]) | ||
plt.plot(t, ct, 'g-', label=f'vp = {vp[1]}') | ||
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[2]) | ||
plt.plot(t, ct, 'm-', label=f'vp = {vp[2]}') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Tissue concentration (mM)') | ||
plt.legend() | ||
plt.show() | ||
|
||
# %% | ||
# Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05 | ||
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) # Defaults to Convolution | ||
plt.plot(t, ct, 'b-', label='Convolution') | ||
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0], discretization_method='exp') | ||
plt.plot(t, ct, 'g-', label='Exponential Convolution') | ||
plt.title(f'Ktrans = {Ktrans} /min') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Tissue concentration (mM)') | ||
plt.legend() | ||
plt.show() | ||
|
||
# Choose the last image as a thumbnail for the gallery | ||
# sphinx_gallery_thumbnail_number = -1 |
Empty file.
Empty file.
Empty file.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
docs/source/generated/backreferences/osipi.aif_georgiou.examples
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
docs/source/generated/backreferences/osipi.aif_weinmann.examples
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
Examples using ``osipi.extended_tofts`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
.. start-sphx-glr-thumbnails | ||
|
||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbnails"> | ||
|
||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbcontainer" tooltip="Simulating tissue concentrations from extended Tofts model with different settings."> | ||
|
||
.. only:: html | ||
|
||
.. image:: /generated/examples/tissue/images/thumb/sphx_glr_plot_extended_tofts_thumb.png | ||
:alt: | ||
|
||
:ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` | ||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbnail-title">The Extended Tofts model</div> | ||
</div> | ||
|
||
|
||
.. only:: not html | ||
|
||
* :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
Empty file.
Empty file modified
0
docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_001.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_002.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_001.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_002.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
docs/source/generated/examples/aif/plot_aif_parker_codeobj.pickle
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
:orphan: | ||
|
||
.. _sphx_glr_generated_examples_sg_execution_times: | ||
|
||
|
||
Computation times | ||
================= | ||
**00:00.000** total execution time for 0 files **from generated/examples**: | ||
|
||
.. container:: | ||
|
||
.. raw:: html | ||
|
||
<style scoped> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" /> | ||
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" /> | ||
</style> | ||
<script src="https://code.jquery.com/jquery-3.7.0.js"></script> | ||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> | ||
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script> | ||
<script type="text/javascript" class="init"> | ||
$(document).ready( function () { | ||
$('table.sg-datatable').DataTable({order: [[1, 'desc']]}); | ||
} ); | ||
</script> | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:class: table table-striped sg-datatable | ||
|
||
* - Example | ||
- Time | ||
- Mem (MB) | ||
* - N/A | ||
- N/A | ||
- N/A |
Binary file added
BIN
+28.2 KB
docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34 KB
docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_001.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_002.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.3 KB
...e/generated/examples/tissue/images/thumb/sphx_glr_plot_extended_tofts_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
docs/source/generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
docs/source/generated/examples/tissue/plot_extended_tofts.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# The Extended Tofts model\n\nSimulating tissue concentrations from extended Tofts model with different settings.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Import necessary packages\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\nimport matplotlib.pyplot as plt\nimport osipi" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Generate Parker AIF with default settings.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes.\nt = np.arange(0, 6*60, 1)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"Ktrans = 0.2 # in units of 1/min\nve = 0.2 # volume fraction between 0 and 1\nvp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0])\nplt.plot(t, ct, 'b-', label=f'vp = {vp[0]}')\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[1])\nplt.plot(t, ct, 'g-', label=f'vp = {vp[1]}')\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[2])\nplt.plot(t, ct, 'm-', label=f'vp = {vp[2]}')\nplt.xlabel('Time (sec)')\nplt.ylabel('Tissue concentration (mM)')\nplt.legend()\nplt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) # Defaults to Convolution\nplt.plot(t, ct, 'b-', label='Convolution')\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0], discretization_method='exp')\nplt.plot(t, ct, 'g-', label='Exponential Convolution')\nplt.title(f'Ktrans = {Ktrans} /min')\nplt.xlabel('Time (sec)')\nplt.ylabel('Tissue concentration (mM)')\nplt.legend()\nplt.show()\n\n# Choose the last image as a thumbnail for the gallery\n# sphinx_gallery_thumbnail_number = -1" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.