Skip to content

Commit

Permalink
Merge pull request #5 from mjt320/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mjt320 authored Nov 22, 2022
2 parents 1b02616 + deb6fe1 commit 26f40f1
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 122 deletions.
1 change: 1 addition & 0 deletions .idea/SEPAL.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

121 changes: 100 additions & 21 deletions demo/demo_aif_module.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
{
"cell_type": "markdown",
"id": "eb332c7d-4589-47da-81d0-e2697ee70254",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## AIF module demo"
]
},
{
"cell_type": "markdown",
"id": "4276273d-31f5-4625-bfc8-9018b7cd984d",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Import modules"
]
Expand All @@ -21,7 +29,10 @@
"execution_count": 2,
"id": "42671502-6096-4107-8c21-3f876b950a66",
"metadata": {
"tags": []
"tags": [],
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
Expand All @@ -46,7 +57,11 @@
{
"cell_type": "markdown",
"id": "0c2eae34-da30-465b-9b23-3dbadd7dc0d8",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### The AIF Class\n",
"AIF objects define an arterial input function. This can either be a population average function or an AIF based on individual patient measurements."
Expand All @@ -55,7 +70,11 @@
{
"cell_type": "markdown",
"id": "reported-projector",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Classic Parker AIF\n",
"Create a Parker AIF object of the Parker subclass of AIF:"
Expand All @@ -65,7 +84,11 @@
"cell_type": "code",
"execution_count": 3,
"id": "4f59a6a6-69b0-4f28-a4a1-03b0b846f6e8",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"parker_aif = aifs.Parker(hct=0.42)"
Expand All @@ -74,7 +97,11 @@
{
"cell_type": "markdown",
"id": "f9a0f8e5-ddd6-4164-a4df-7f50a3af82eb",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"We can use the c_ap method to get concentration at arbitrary time points:"
]
Expand All @@ -83,7 +110,11 @@
"cell_type": "code",
"execution_count": 4,
"id": "f65ca4cc-58d3-422a-822b-6c52cd9328c9",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand All @@ -110,7 +141,11 @@
{
"cell_type": "markdown",
"id": "electoral-tamil",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Patient-specific AIF\n",
"Now we create an individual AIF object based on a series of time-concentration data points. We use the PatientSpecific subclass of AIF."
Expand All @@ -120,7 +155,11 @@
"cell_type": "code",
"execution_count": 5,
"id": "2d0a1c5b-7972-4be9-aa1b-9029e5645685",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"t_patient = np.array([19.810000,59.430000,99.050000,138.670000,178.290000,217.910000,257.530000,297.150000,336.770000,376.390000,416.010000,455.630000,495.250000,534.870000,574.490000,614.110000,653.730000,693.350000,732.970000,772.590000,812.210000,851.830000,891.450000,931.070000,970.690000,1010.310000,1049.930000,1089.550000,1129.170000,1168.790000,1208.410000,1248.030000])\n",
Expand All @@ -132,7 +171,11 @@
{
"cell_type": "markdown",
"id": "9a03a459-93d7-4779-9709-6389bf265024",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"Again, using the c_ap method we can get concentration at arbitrary time points. This is achieved using interpolation function."
]
Expand All @@ -141,7 +184,11 @@
"cell_type": "code",
"execution_count": 6,
"id": "c9d16286-d0df-4ab8-b918-4486652200f0",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -176,7 +223,11 @@
{
"cell_type": "markdown",
"id": "d30c7325-3453-4e38-a869-7439ed256437",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Other standard AIF functions\n",
"The following function is described in Manning et al., Magn Reson Med. 2021;86:1888–1903. \n",
Expand All @@ -188,7 +239,11 @@
"cell_type": "code",
"execution_count": 7,
"id": "e7274fdd-ef51-40fd-8ce9-d1b2820aa37e",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"manning_fast_aif = aifs.ManningFast(hct=0.42, t_start=3*39.62)"
Expand All @@ -197,7 +252,11 @@
{
"cell_type": "markdown",
"id": "83da4ffa-24c2-4e24-b1ec-30ed89a823c2",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"Manning et al. also reports an AIF for *slow* contrast injections in the same patient population, based on patient measurements:"
]
Expand All @@ -206,7 +265,11 @@
"cell_type": "code",
"execution_count": 8,
"id": "a9cd6fa3-3347-4c4d-9cc4-da0d2d027c69",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"manning_slow_aif = aifs.ManningSlow()"
Expand All @@ -215,7 +278,11 @@
{
"cell_type": "markdown",
"id": "f3d27241-b579-4b38-9ecd-1658184e6253",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"A similar population average function (for Bolus injection) was reported in Heye et al., NeuroImage 2016;125:446-455:"
]
Expand All @@ -224,7 +291,11 @@
"cell_type": "code",
"execution_count": 9,
"id": "a3fb3120-0b2c-420b-9e1f-0625ab9a4fff",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"heye_aif = aifs.Heye(hct=0.45, t_start=3*39.62)"
Expand All @@ -233,7 +304,11 @@
{
"cell_type": "markdown",
"id": "65d7c712-3ef0-4f87-a7b1-2dfa03c0e45d",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"Plot the above AIFs (and the original Parker model) for comparison:"
]
Expand All @@ -242,7 +317,11 @@
"cell_type": "code",
"execution_count": 11,
"id": "f7d24797-32ac-467d-8ea8-66b24079fa49",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -293,4 +372,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading

0 comments on commit 26f40f1

Please sign in to comment.