Skip to content

Commit

Permalink
Merge branch 'main' into zenodo_IO
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverchampion authored Mar 6, 2024
2 parents 0801ec3 + 1f4cbf4 commit b7417e6
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
outputs: # here we use the outputs from steps, and set outputs for the job `configure`
algorithms: ${{ steps.algorithms.outputs.algorithms }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
Expand Down Expand Up @@ -53,9 +53,9 @@ jobs:
algorithm: ${{fromJson(needs.algorithms.outputs.algorithms).algorithms}}
SNR: [10, 30, 50, 100, 200]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -175,4 +175,4 @@ jobs:
name: Comparison
path: |
test_reference.csv
test_results.csv
test_results.csv
4 changes: 2 additions & 2 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
# - os: windows-latest
# python-version: "3.7"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ dipy
matplotlib
scienceplots
cvxpy
zenodo-get
zenodo-get
pytest
tqdm
21 changes: 21 additions & 0 deletions src/original/TCML_TechnionIIT/SUPER-IVIM-DC/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SUPER-IVIM-DC

Provided here is a sample Jupyter notebook for the SUPER-IVIM-DC package.

Full README and usage instructions can be found here: https://github.com/TechnionComputationalMRILab/SUPER-IVIM-DC or https://pypi.org/project/super-ivim-dc/0.4.0/

Citation:

```
@article{
Korngut_Rotman_Afacan_Kurugol_Zaffrani-Reznikov_Nemirovsky-Rotman_Warfield_Freiman_2022,
title={SUPER-IVIM-DC: Intra-voxel incoherent motion based fetal lung maturity assessment from limited DWI data using supervised learning coupled with data-consistency},
volume={13432}, DOI={10.1007/978-3-031-16434-7_71},
journal={Lecture Notes in Computer Science},
author={Korngut, Noam and Rotman, Elad and Afacan, Onur and Kurugol, Sila and Zaffrani-Reznikov, Yael and Nemirovsky-Rotman, Shira and Warfield, Simon and Freiman, Moti},
year={2022},
pages={743–752}
}
```

[The paper is also available on ArXiv](https://arxiv.org/abs/2206.03820).
167 changes: 167 additions & 0 deletions src/original/TCML_TechnionIIT/SUPER-IVIM-DC/sample.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"working_dir: str = './working_dir'\n",
"super_ivim_dc_filename: str = 'super_ivim_dc' # do not include .pt\n",
"ivimnet_filename: str = 'ivimnet' # do not include .pt\n",
"\n",
"bvalues = np.array([0,15,30,45,60,75,90,105,120,135,150,175,200,400,600,800])\n",
"snr = 10\n",
"sample_size = 100"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Simulate"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run training, generate .pt files"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from super_ivim_dc.train import train\n",
"\n",
"train(\n",
" SNR=snr, \n",
" bvalues=bvalues, \n",
" super_ivim_dc=True,\n",
" ivimnet=True,\n",
" work_dir=working_dir,\n",
" super_ivim_dc_filename=super_ivim_dc_filename,\n",
" ivimnet_filename=ivimnet_filename,\n",
" verbose=False\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Files that will be created:\n",
"\n",
"- **super_ivim_dc_init.json** - contains the initial values used in the training\n",
"- **super_ivim_dc_init_NRMSE.csv** - ???\n",
"- **super_ivim_dc_init.pt** - the pytorch model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test\n",
"\n",
"Generate a simulated signal + ..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from super_ivim_dc.infer import test_infer\n",
"\n",
"test_infer(\n",
" SNR=snr,\n",
" bvalues=bvalues,\n",
" work_dir=working_dir,\n",
" super_ivim_dc_filename=super_ivim_dc_filename,\n",
" ivimnet_filename=ivimnet_filename,\n",
" save_figure_to=None, # if set to None, the figure will be shown in the notebook\n",
" sample_size=sample_size,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate simulated signal"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from super_ivim_dc.IVIMNET import simulations\n",
"\n",
"IVIM_signal_noisy, Dt, f, Dp = simulations.sim_signal(\n",
" SNR=snr, \n",
" bvalues=bvalues, \n",
" sims=sample_size\n",
")\n",
"\n",
"Dt, f, Dp = np.squeeze(Dt), np.squeeze(f), np.squeeze(Dp)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run inference on the simulated signal"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from super_ivim_dc.infer import infer_from_signal\n",
"\n",
"Dp_ivimnet, Dt_ivimnet, Fp_ivimnet, S0_ivimnet = infer_from_signal(\n",
" signal=IVIM_signal_noisy, \n",
" bvalues=bvalues,\n",
" model_path=f\"{working_dir}/{ivimnet_filename}.pt\",\n",
")\n",
"\n",
"Dp_superivimdc, Dt_superivimdc, Fp_superivimdc, S0_superivimdc = infer_from_signal(\n",
" signal=IVIM_signal_noisy, \n",
" bvalues=bvalues,\n",
" model_path=f\"{working_dir}/{super_ivim_dc_filename}.pt\",\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "super_ivim_dc",
"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.10.12"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit b7417e6

Please sign in to comment.