Skip to content

Commit

Permalink
added bold and dwi image datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed May 29, 2024
1 parent 478f529 commit 50623ce
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
21 changes: 21 additions & 0 deletions medimages4tests/mri/neuro/bold.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pathlib import Path
from medimages4tests import base_cache_dir
from medimages4tests.utils import retrieve_from_openneuro, OpenneuroSpec


cache_dir = base_cache_dir / "mri" / "neuro" / "bold"


SAMPLES = {
"ds002014-01": OpenneuroSpec(
dataset="ds002014",
tag="1.0.1",
path="sub-01/func/sub-01_task-languageproduction_run-01_bold",
)
}


def get_image(out_dir: Path = None, sample: str = "ds002014-01"):
if out_dir is None:
out_dir = cache_dir / sample
return retrieve_from_openneuro(SAMPLES[sample], out_dir)
23 changes: 23 additions & 0 deletions medimages4tests/mri/neuro/dwi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from pathlib import Path
from medimages4tests import base_cache_dir
from medimages4tests.utils import retrieve_from_openneuro, OpenneuroSpec


cache_dir = base_cache_dir / "mri" / "neuro" / "t1w"


SAMPLES = {
"ds004024-CON031": OpenneuroSpec(
dataset="ds004024",
tag="1.0.1",
path="sub-CON031/ses-mri/dwi/sub-CON031_ses-mri_dwi",
)
}


def get_image(out_dir: Path = None, sample: str = "ds004024-CON031"):
if out_dir is None:
out_dir = cache_dir / sample
return retrieve_from_openneuro(
SAMPLES[sample], out_dir, suffixes=(".nii.gz", ".json", ".bvec", ".bval")
)
24 changes: 21 additions & 3 deletions medimages4tests/mri/neuro/t1w.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from medimages4tests import base_cache_dir
from medimages4tests.utils import retrieve_from_openneuro, OpenneuroSpec

Expand All @@ -10,9 +11,26 @@
dataset="ds004130",
tag="1.0.0",
path="sub-ON01016/anat/sub-ON01016_acq-fspgr_run-01_T1w",
)
),
"ds002014-01": OpenneuroSpec(
dataset="ds002014",
tag="1.0.1",
path="sub-01/anat/sub-01_T1w",
),
"ds001743-01": OpenneuroSpec(
dataset="ds001743",
tag="1.0.1",
path="sub-01/anat/sub-01_T1w",
),
"ds004024-CON031": OpenneuroSpec(
dataset="ds004024",
tag="1.0.1",
path="sub-CON031/ses-mri/dwi/sub-CON031_ses-mri_T1w",
),
}


def get_image(sample="ds004130-ON01016"):
return retrieve_from_openneuro(SAMPLES[sample], cache_dir / sample)
def get_image(out_dir: Path = None, sample: str = "ds004130-ON01016"):
if out_dir is None:
out_dir = cache_dir / sample
return retrieve_from_openneuro(SAMPLES[sample], out_dir)

0 comments on commit 50623ce

Please sign in to comment.