-
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.
- Loading branch information
0 parents
commit d90e429
Showing
189 changed files
with
39,732 additions
and
0 deletions.
There are no files selected for viewing
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,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: eaa0ad5ca0bd25f09aacf9b29be85885 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
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,48 @@ | ||
""" | ||
============== | ||
A dummy script | ||
============== | ||
Dummy script to illustrate structure of examples folder | ||
""" | ||
|
||
# %% | ||
# Import necessary packages | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import osipi | ||
|
||
# %% | ||
# Generate synthetic AIF with default settings and plot the result. | ||
|
||
# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes. | ||
t = np.arange(0, 6*60, 0.5) | ||
|
||
# Create an AIF with default settings | ||
ca = osipi.aif_parker(t) | ||
|
||
# Plot the AIF over the full range | ||
plt.plot(t, ca, 'r-') | ||
plt.plot(t, 0*t, 'k-') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Plasma concentration (mM)') | ||
plt.show() | ||
|
||
# %% | ||
# The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s: | ||
|
||
ca = osipi.aif_parker(t, BAT=0) | ||
plt.plot(t, ca, 'b-', label='BAT = 0s') | ||
ca = osipi.aif_parker(t, BAT=30) | ||
plt.plot(t, ca, 'r-', label='BAT = 30s') | ||
ca = osipi.aif_parker(t, BAT=60) | ||
plt.plot(t, ca, 'g-', label='BAT = 60s') | ||
ca = osipi.aif_parker(t, BAT=90) | ||
plt.plot(t, ca, 'm-', label='BAT = 90s') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Plasma concentration (mM)') | ||
plt.legend() | ||
plt.show() | ||
|
||
# Choose the last image as a thumbnail for the gallery | ||
# sphinx_gallery_thumbnail_number = -1 |
48 changes: 48 additions & 0 deletions
48
_downloads/6794ff0fe2ebfd1be519862fb198ceb5/plot_aif_parker.py
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,48 @@ | ||
""" | ||
====================================== | ||
The Parker AIF - a play with variables | ||
====================================== | ||
Simulating a Parker AIF with different settings. | ||
""" | ||
|
||
# %% | ||
# Import necessary packages | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import osipi | ||
|
||
# %% | ||
# Generate synthetic AIF with default settings and plot the result. | ||
|
||
# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes. | ||
t = np.arange(0, 6*60, 0.5) | ||
|
||
# Create an AIF with default settings | ||
ca = osipi.aif_parker(t) | ||
|
||
# Plot the AIF over the full range | ||
plt.plot(t, ca, 'r-') | ||
plt.plot(t, 0*t, 'k-') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Plasma concentration (mM)') | ||
plt.show() | ||
|
||
# %% | ||
# The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s: | ||
|
||
ca = osipi.aif_parker(t, BAT=0) | ||
plt.plot(t, ca, 'b-', label='BAT = 0s') | ||
ca = osipi.aif_parker(t, BAT=30) | ||
plt.plot(t, ca, 'r-', label='BAT = 30s') | ||
ca = osipi.aif_parker(t, BAT=60) | ||
plt.plot(t, ca, 'g-', label='BAT = 60s') | ||
ca = osipi.aif_parker(t, BAT=90) | ||
plt.plot(t, ca, 'm-', label='BAT = 90s') | ||
plt.xlabel('Time (sec)') | ||
plt.ylabel('Plasma concentration (mM)') | ||
plt.legend() | ||
plt.show() | ||
|
||
# Choose the last image as a thumbnail for the gallery | ||
# sphinx_gallery_thumbnail_number = -1 |
53 changes: 53 additions & 0 deletions
53
_downloads/7aabdb582807b10ab82e2dcfaa256c12/plot_extended_tofts.py
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 |
86 changes: 86 additions & 0 deletions
86
_downloads/9dd8307460a64f1314f28e1650ea27b2/plot_aif_parker.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,86 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# The Parker AIF - a play with variables\n\nSimulating a Parker AIF 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 synthetic AIF with default settings and plot the result.\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 0.5 sec and a total duration of 6 minutes.\nt = np.arange(0, 6*60, 0.5)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)\n\n# Plot the AIF over the full range\nplt.plot(t, ca, 'r-')\nplt.plot(t, 0*t, 'k-')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s:\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ca = osipi.aif_parker(t, BAT=0)\nplt.plot(t, ca, 'b-', label='BAT = 0s')\nca = osipi.aif_parker(t, BAT=30)\nplt.plot(t, ca, 'r-', label='BAT = 30s')\nca = osipi.aif_parker(t, BAT=60)\nplt.plot(t, ca, 'g-', label='BAT = 60s')\nca = osipi.aif_parker(t, BAT=90)\nplt.plot(t, ca, 'm-', label='BAT = 90s')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma 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.9.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
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,52 @@ | ||
""" | ||
==================== | ||
The Tofts model | ||
==================== | ||
Simulating tissue concentrations from 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 transfer rate constants of 0.05, 0.2 and 0.6 /min | ||
Ktrans = [0.05, 0.2, 0.6] # in units of 1/min | ||
ve = 0.2 # volume fraction between 0 and 1 | ||
ct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve) | ||
plt.plot(t, ct, 'b-', label=f'Ktrans = {Ktrans[0]} /min') | ||
ct = osipi.tofts(t, ca, Ktrans[1], ve) | ||
plt.plot(t, ct, 'g-', label=f'Ktrans = {Ktrans[1]} /min') | ||
ct = osipi.tofts(t, ca, Ktrans[2], ve) | ||
plt.plot(t, ct, 'm-', label=f'Ktrans = {Ktrans[2]} /min') | ||
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 and Ktrans of 0.2 /min | ||
ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve) # Defaults to Convolution | ||
plt.plot(t, ct, 'b-', label='Convolution') | ||
ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve, discretization_method='exp') | ||
plt.plot(t, ct, 'g-', label='Exponential Convolution') | ||
plt.title(f'Ktrans = {Ktrans[1]} /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 |
86 changes: 86 additions & 0 deletions
86
_downloads/d7fc8c919b404352d2799a152138fb85/plot_dummy.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,86 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# A dummy script\n\nDummy script to illustrate structure of examples folder \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 synthetic AIF with default settings and plot the result.\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 0.5 sec and a total duration of 6 minutes.\nt = np.arange(0, 6*60, 0.5)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)\n\n# Plot the AIF over the full range\nplt.plot(t, ca, 'r-')\nplt.plot(t, 0*t, 'k-')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s:\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ca = osipi.aif_parker(t, BAT=0)\nplt.plot(t, ca, 'b-', label='BAT = 0s')\nca = osipi.aif_parker(t, BAT=30)\nplt.plot(t, ca, 'r-', label='BAT = 30s')\nca = osipi.aif_parker(t, BAT=60)\nplt.plot(t, ca, 'g-', label='BAT = 60s')\nca = osipi.aif_parker(t, BAT=90)\nplt.plot(t, ca, 'm-', label='BAT = 90s')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma 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.9.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.