-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Tofts and Ext. Tofts #5
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8ac1b69
Added Tofts model functionality
d12c017
Added Tofts model functionality
4794c8a
Added Tofts functionality and examples
042bb24
Corrected url
2ce1db5
formatted docstring
8135548
updated documentation
57553ae
edited tofts documentation and tests; changed BAT default in aif to 0…
2d71809
edited tofts documentation and tests; changed BAT default in aif to 0…
39410dd
Updated tofts and aif functionality
1ee1a91
Updated tofts model definition
06267dc
Updated aif and tofts
c00146e
exception handling
768b913
Correction of units
316f928
Merge pull request #2 from stadmill/main
plaresmedima e9d27b3
Added extended Tofts
LucyKershaw 5ce3ba6
Edits as per ST suggestions
LucyKershaw 7cd756f
Corrected test_tissue
LucyKershaw 5804f63
Merge pull request #4 from LucyKershaw/LEK_development
stadmill 8a365b0
Delete .idea directory
stadmill 8ec0a0a
Delete .DS_Store
stadmill 81ab00b
Delete docs/.DS_Store
stadmill be31fe6
Delete .gitignore
stadmill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
ltorres6 marked this conversation as resolved.
Show resolved
Hide resolved
|
Empty file.
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can keep this file on the repo. You can add .DS_Store as well.