Skip to content

Commit

Permalink
add download from ixi and caching dataset.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcencini committed Dec 5, 2024
1 parent 42a7eae commit be807df
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Restore cached ixi directory
uses: actions/cache/restore@v4
id: cache-restore
with:
path: ~/.ixi
key: ${{ runner.os }}-ixi

- name: Install dependencies
shell: bash -l {0}
Expand All @@ -162,6 +169,13 @@ jobs:
- name: Display data
run: ls -R
working-directory: docs_build/_static

- name: Cache ixi directory
uses: actions/cache/save@v4
if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }}
with:
path: ~/.ixi
key: ${{ runner.os }}-ixi

- name: Upload artifact
id: artifact-upload-step
Expand Down
19 changes: 13 additions & 6 deletions examples/02-synth-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@

import torchio as tio

ixi_dataset = tio.datasets.IXI(
"/home/mcencini//ixi/",
modalities=("PD", "T1", "T2"),
download=False,
)

try:
ixi_dataset = tio.datasets.IXI(
"/home/mcencini/ixi/",
modalities=("PD", "T1", "T2"),
download=False,
)
except:
ixi_dataset = tio.datasets.IXI(
"$HOME/.ixi/",
modalities=("PD", "T1", "T2"),
download=True,
)

# get subject 0
sample_subject = ixi_dataset[0]

Expand Down
17 changes: 12 additions & 5 deletions examples/03-fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@
import torchsim


ixi_dataset = tio.datasets.IXI(
"/home/mcencini//ixi/",
modalities=("PD", "T1", "T2"),
download=False,
)
try:
ixi_dataset = tio.datasets.IXI(
"/home/mcencini/ixi/",
modalities=("PD", "T1", "T2"),
download=False,
)
except:
ixi_dataset = tio.datasets.IXI(
"$HOME/.ixi/",
modalities=("PD", "T1", "T2"),
download=True,
)

# get subject 0
sample_subject = ixi_dataset[0]
Expand Down

0 comments on commit be807df

Please sign in to comment.