-
Notifications
You must be signed in to change notification settings - Fork 9
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 #5 from OSIPI/dev
Added Tofts and Ext. Tofts
- Loading branch information
Showing
132 changed files
with
1,476 additions
and
652 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Binary file not shown.
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
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
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 |
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.
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
Binary file not shown.
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,18 @@ | ||
osipi.extended\_tofts | ||
===================== | ||
|
||
|
||
.. currentmodule:: osipi | ||
|
||
|
||
|
||
.. autofunction:: extended_tofts | ||
|
||
|
||
|
||
|
||
|
||
.. minigallery:: osipi.extended_tofts | ||
:add-heading: | ||
|
||
|
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,18 @@ | ||
osipi.tofts | ||
=========== | ||
|
||
|
||
.. currentmodule:: osipi | ||
|
||
|
||
|
||
.. autofunction:: tofts | ||
|
||
|
||
|
||
|
||
|
||
.. minigallery:: osipi.tofts | ||
:add-heading: | ||
|
||
|
Empty file modified
0
docs/source/generated/backreferences/osipi.aif_georgiou.examples
100644 → 100755
Empty file.
Oops, something went wrong.