Provide data in all spaces for AOMIC datasets #405

Merged
fraimondo merged 5 commits from enh/aomic_native_all into main 2024-11-29 14:24:16 +00:00
11 changed files with 477 additions and 228 deletions

View file

@ -0,0 +1 @@
``native_t1w`` parameter has been replaced with ``space`` to allow :class:`.DataladAOMICID1000`, :class:`.DataladAOMICPIOP1` and :class:`.DataladAOMICPIOP2` to fetch data in all available spaces by `Fede Raimondo`_

View file

@ -0,0 +1 @@
Update :class:`.DataladAOMICID1000`, :class:`.DataladAOMICPIOP1` and :class:`.DataladAOMICPIOP2` to fetch data in all available spaces by `Fede Raimondo`_

View file

@ -11,6 +11,7 @@ from pathlib import Path
from typing import Union from typing import Union
from ...api.decorators import register_datagrabber from ...api.decorators import register_datagrabber
from ...utils import raise_error
from ..pattern_datalad import PatternDataladDataGrabber from ..pattern_datalad import PatternDataladDataGrabber
@ -31,8 +32,8 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
"FreeSurfer"} or list of the options, optional "FreeSurfer"} or list of the options, optional
AOMIC data types. If None, all available data types are selected. AOMIC data types. If None, all available data types are selected.
(default None). (default None).
native_t1w : bool, optional space : {"native", "MNI152NLin2009cAsym"}, optional
Whether to use T1w in native space (default False). The space to use for the data (default "MNI152NLin2009cAsym").
""" """
@ -40,25 +41,40 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
self, self,
datadir: Union[str, Path, None] = None, datadir: Union[str, Path, None] = None,
types: Union[str, list[str], None] = None, types: Union[str, list[str], None] = None,
native_t1w: bool = False, space: str = "MNI152NLin2009cAsym",
) -> None: ) -> None:
valid_spaces = ["native", "MNI152NLin2009cAsym"]
if space not in ["native", "MNI152NLin2009cAsym"]:
raise_error(
f"Invalid space {space}. Must be one of {valid_spaces}"
)
# Descriptor for space in `anat`
sp_anat_desc = (
"" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# Descriptor for space in `func`
sp_func_desc = (
"space-T1w_" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# The patterns # The patterns
patterns = { patterns = {
"BOLD": { "BOLD": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-moviewatching_" "{subject}_task-moviewatching_"
"space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" f"{sp_func_desc}"
"desc-preproc_bold.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-moviewatching_" "{subject}_task-moviewatching_"
"space-MNI152NLin2009cAsym_" f"{sp_func_desc}"
"desc-brain_mask.nii.gz" "desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"confounds": { "confounds": {
"pattern": ( "pattern": (
@ -68,46 +84,59 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
), ),
"format": "fmriprep", "format": "fmriprep",
}, },
"reference": {
"pattern": (
"derivatives/fmriprep/{subject}/func/"
"{subject}_task-moviewatching_"
f"{sp_func_desc}"
"boldref.nii.gz"
),
},
}, },
"T1w": { "T1w": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-preproc_T1w.nii.gz" "desc-preproc_T1w.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-brain_mask.nii.gz" "desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
}, },
"VBM_CSF": { "VBM_CSF": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"CSF_probseg.nii.gz" f"{sp_anat_desc}"
"label-CSF_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_GM": { "VBM_GM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"GM_probseg.nii.gz" f"{sp_anat_desc}"
"label-GM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_WM": { "VBM_WM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"WM_probseg.nii.gz" f"{sp_anat_desc}"
"label-WM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"DWI": { "DWI": {
"pattern": ( "pattern": (
@ -148,27 +177,6 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
) )
}, },
}, },
}
# Use native T1w assets
self.native_t1w = False
if native_t1w:
self.native_t1w = True
patterns.update(
{
"T1w": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-preproc_T1w.nii.gz"
),
"space": "native",
"mask": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-brain_mask.nii.gz"
),
"space": "native",
},
},
"Warp": [ "Warp": [
{ {
"pattern": ( "pattern": (
@ -192,7 +200,15 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
}, },
], ],
} }
) if space == "native":
patterns["BOLD"]["prewarp_space"] = "MNI152NLin2009cAsym"
else:
patterns["BOLD"]["prewarp_space"] = "native"
# Use native T1w assets
self.space = space
# Set default types # Set default types
if types is None: if types is None:
types = list(patterns.keys()) types = list(patterns.keys())

View file

@ -37,8 +37,8 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
"gstroop", "workingmemory"} or list of the options, optional "gstroop", "workingmemory"} or list of the options, optional
AOMIC PIOP1 task sessions. If None, all available task sessions are AOMIC PIOP1 task sessions. If None, all available task sessions are
selected (default None). selected (default None).
native_t1w : bool, optional space : {"native", "MNI152NLin2009cAsym"}, optional
Whether to use T1w in native space (default False). The space to use for the data (default "MNI152NLin2009cAsym").
Raises Raises
------ ------
@ -52,8 +52,13 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
datadir: Union[str, Path, None] = None, datadir: Union[str, Path, None] = None,
types: Union[str, list[str], None] = None, types: Union[str, list[str], None] = None,
tasks: Union[str, list[str], None] = None, tasks: Union[str, list[str], None] = None,
native_t1w: bool = False, space: str = "MNI152NLin2009cAsym",
) -> None: ) -> None:
valid_spaces = ["native", "MNI152NLin2009cAsym"]
if space not in ["native", "MNI152NLin2009cAsym"]:
raise_error(
f"Invalid space {space}. Must be one of {valid_spaces}"
)
# Declare all tasks # Declare all tasks
all_tasks = [ all_tasks = [
"restingstate", "restingstate",
@ -78,22 +83,32 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
" dataset!" " dataset!"
) )
self.tasks = tasks self.tasks = tasks
# Descriptor for space in `anat`
sp_anat_desc = (
"" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# Descriptor for space in `func`
sp_func_desc = (
"space-T1w_" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# The patterns # The patterns
patterns = { patterns = {
"BOLD": { "BOLD": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_" "{subject}_task-{task}_"
"space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" f"{sp_func_desc}"
"desc-preproc_bold.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_" "{subject}_task-{task}_"
"space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz" f"{sp_func_desc}"
"desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"confounds": { "confounds": {
"pattern": ( "pattern": (
@ -103,46 +118,59 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
), ),
"format": "fmriprep", "format": "fmriprep",
}, },
"reference": {
"pattern": (
"derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_"
f"{sp_func_desc}"
"boldref.nii.gz"
),
},
}, },
"T1w": { "T1w": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-preproc_T1w.nii.gz" "desc-preproc_T1w.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-brain_mask.nii.gz" "desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
}, },
"VBM_CSF": { "VBM_CSF": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"CSF_probseg.nii.gz" f"{sp_anat_desc}"
"label-CSF_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_GM": { "VBM_GM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"GM_probseg.nii.gz" f"{sp_anat_desc}"
"label-GM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_WM": { "VBM_WM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"WM_probseg.nii.gz" f"{sp_anat_desc}"
"label-WM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"DWI": { "DWI": {
"pattern": ( "pattern": (
@ -183,27 +211,6 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
) )
}, },
}, },
}
# Use native T1w assets
self.native_t1w = False
if native_t1w:
self.native_t1w = True
patterns.update(
{
"T1w": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-preproc_T1w.nii.gz"
),
"space": "native",
"mask": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-brain_mask.nii.gz"
),
"space": "native",
},
},
"Warp": [ "Warp": [
{ {
"pattern": ( "pattern": (
@ -227,7 +234,15 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
}, },
], ],
} }
)
if space == "native":
patterns["BOLD"]["prewarp_space"] = "MNI152NLin2009cAsym"
else:
patterns["BOLD"]["prewarp_space"] = "native"
# Use native T1w assets
self.space = space
# Set default types # Set default types
if types is None: if types is None:
types = list(patterns.keys()) types = list(patterns.keys())

View file

@ -37,8 +37,8 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
list of the options, optional list of the options, optional
AOMIC PIOP2 task sessions. If None, all available task sessions are AOMIC PIOP2 task sessions. If None, all available task sessions are
selected (default None). selected (default None).
native_t1w : bool, optional space : {"native", "MNI152NLin2009cAsym"}, optional
Whether to use T1w in native space (default False). The space to use for the data (default "MNI152NLin2009cAsym").
Raises Raises
------ ------
@ -52,8 +52,13 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
datadir: Union[str, Path, None] = None, datadir: Union[str, Path, None] = None,
types: Union[str, list[str], None] = None, types: Union[str, list[str], None] = None,
tasks: Union[str, list[str], None] = None, tasks: Union[str, list[str], None] = None,
native_t1w: bool = False, space: str = "MNI152NLin2009cAsym",
) -> None: ) -> None:
valid_spaces = ["native", "MNI152NLin2009cAsym"]
if space not in ["native", "MNI152NLin2009cAsym"]:
raise_error(
f"Invalid space {space}. Must be one of {valid_spaces}"
)
# Declare all tasks # Declare all tasks
all_tasks = [ all_tasks = [
"restingstate", "restingstate",
@ -76,22 +81,32 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
" dataset!" " dataset!"
) )
self.tasks = tasks self.tasks = tasks
# Descriptor for space in `anat`
sp_anat_desc = (
"" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# Descriptor for space in `func`
sp_func_desc = (
"space-T1w_" if space == "native" else "space-MNI152NLin2009cAsym_"
)
# The patterns # The patterns
patterns = { patterns = {
"BOLD": { "BOLD": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_" "{subject}_task-{task}_"
"space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" f"{sp_func_desc}"
"desc-preproc_bold.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/func/" "derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_" "{subject}_task-{task}_"
"space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz" f"{sp_func_desc}"
"desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"confounds": { "confounds": {
"pattern": ( "pattern": (
@ -101,46 +116,59 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
), ),
"format": "fmriprep", "format": "fmriprep",
}, },
"reference": {
"pattern": (
"derivatives/fmriprep/{subject}/func/"
"{subject}_task-{task}_"
f"{sp_func_desc}"
"boldref.nii.gz"
),
},
}, },
"T1w": { "T1w": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-preproc_T1w.nii.gz" "desc-preproc_T1w.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
"mask": { "mask": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_" "{subject}_"
f"{sp_anat_desc}"
"desc-brain_mask.nii.gz" "desc-brain_mask.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
}, },
"VBM_CSF": { "VBM_CSF": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"CSF_probseg.nii.gz" f"{sp_anat_desc}"
"label-CSF_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_GM": { "VBM_GM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"GM_probseg.nii.gz" f"{sp_anat_desc}"
"label-GM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"VBM_WM": { "VBM_WM": {
"pattern": ( "pattern": (
"derivatives/fmriprep/{subject}/anat/" "derivatives/fmriprep/{subject}/anat/"
"{subject}_space-MNI152NLin2009cAsym_label-" "{subject}_"
"WM_probseg.nii.gz" f"{sp_anat_desc}"
"label-WM_probseg.nii.gz"
), ),
"space": "MNI152NLin2009cAsym", "space": space,
}, },
"DWI": { "DWI": {
"pattern": ( "pattern": (
@ -181,27 +209,6 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
) )
}, },
}, },
}
# Use native T1w assets
self.native_t1w = False
if native_t1w:
self.native_t1w = True
patterns.update(
{
"T1w": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-preproc_T1w.nii.gz"
),
"space": "native",
"mask": {
"pattern": (
"derivatives/fmriprep/{subject}/anat/"
"{subject}_desc-brain_mask.nii.gz"
),
"space": "native",
},
},
"Warp": [ "Warp": [
{ {
"pattern": ( "pattern": (
@ -225,7 +232,15 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
}, },
], ],
} }
)
if space == "native":
patterns["BOLD"]["prewarp_space"] = "MNI152NLin2009cAsym"
else:
patterns["BOLD"]["prewarp_space"] = "native"
# Use native T1w assets
self.space = space
# Set default types # Set default types
if types is None: if types is None:
types = list(patterns.keys()) types = list(patterns.keys())

View file

@ -18,20 +18,25 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomic1000"
@pytest.mark.parametrize( @pytest.mark.parametrize(
"type_, nested_types", "type_, nested_types, space",
[ [
("BOLD", ["confounds", "mask"]), ("BOLD", ["confounds", "mask", "reference"], "MNI152NLin2009cAsym"),
("T1w", ["mask"]), ("BOLD", ["confounds", "mask", "reference"], "native"),
("VBM_CSF", None), ("T1w", ["mask"], "MNI152NLin2009cAsym"),
("VBM_GM", None), ("T1w", ["mask"], "native"),
("VBM_WM", None), ("VBM_CSF", None, "MNI152NLin2009cAsym"),
("DWI", None), ("VBM_CSF", None, "native"),
("FreeSurfer", None), ("VBM_GM", None, "MNI152NLin2009cAsym"),
("VBM_GM", None, "native"),
("VBM_WM", None, "MNI152NLin2009cAsym"),
("DWI", None, "MNI152NLin2009cAsym"),
("FreeSurfer", None, "MNI152NLin2009cAsym"),
], ],
) )
def test_DataladAOMICID1000( def test_DataladAOMICID1000(
type_: str, type_: str,
nested_types: Optional[list[str]], nested_types: Optional[list[str]],
space: str,
) -> None: ) -> None:
"""Test DataladAOMICID1000 DataGrabber. """Test DataladAOMICID1000 DataGrabber.
@ -41,9 +46,11 @@ def test_DataladAOMICID1000(
The parametrized type. The parametrized type.
nested_types : list of str or None nested_types : list of str or None
The parametrized nested types. The parametrized nested types.
space: str
The parametrized space.
""" """
dg = DataladAOMICID1000(types=type_) dg = DataladAOMICID1000(types=type_, space=space)
# Set URI to Gin # Set URI to Gin
dg.uri = URI dg.uri = URI

View file

@ -18,30 +18,62 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomicpiop1"
@pytest.mark.parametrize( @pytest.mark.parametrize(
"type_, nested_types, tasks", "type_, nested_types, tasks, space",
[ [
("BOLD", ["confounds", "mask"], None),
("BOLD", ["confounds", "mask"], ["anticipation"]),
("BOLD", ["confounds", "mask"], ["emomatching", "faces"]),
("BOLD", ["confounds", "mask"], ["restingstate"]),
("BOLD", ["confounds", "mask"], ["workingmemory", "gstroop"]),
( (
"BOLD", "BOLD",
["confounds", "mask"], ["confounds", "mask", "reference"],
["anticipation", "faces", "restingstate"], None,
"MNI152NLin2009cAsym",
), ),
("T1w", ["mask"], None), ("BOLD", ["confounds", "mask", "reference"], None, "native"),
("VBM_CSF", None, None), (
("VBM_GM", None, None), "BOLD",
("VBM_WM", None, None), ["confounds", "mask", "reference"],
("DWI", None, None), ["anticipation"],
("FreeSurfer", None, None), "MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["emomatching", "faces"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["restingstate"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["workingmemory", "gstroop"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["anticipation", "faces", "restingstate"],
"MNI152NLin2009cAsym",
),
("T1w", ["mask"], None, "MNI152NLin2009cAsym"),
("T1w", ["mask"], None, "native"),
("VBM_CSF", None, None, "MNI152NLin2009cAsym"),
("VBM_CSF", None, None, "native"),
("VBM_GM", None, None, "MNI152NLin2009cAsym"),
("VBM_GM", None, None, "native"),
("VBM_WM", None, None, "MNI152NLin2009cAsym"),
("VBM_WM", None, None, "native"),
("DWI", None, None, "MNI152NLin2009cAsym"),
("FreeSurfer", None, None, "MNI152NLin2009cAsym"),
], ],
) )
def test_DataladAOMICPIOP1( def test_DataladAOMICPIOP1(
type_: str, type_: str,
nested_types: Optional[list[str]], nested_types: Optional[list[str]],
tasks: Optional[list[str]], tasks: Optional[list[str]],
space: str,
) -> None: ) -> None:
"""Test DataladAOMICPIOP1 DataGrabber. """Test DataladAOMICPIOP1 DataGrabber.
@ -53,9 +85,11 @@ def test_DataladAOMICPIOP1(
The parametrized nested types. The parametrized nested types.
tasks : list of str or None tasks : list of str or None
The parametrized task values. The parametrized task values.
space: str
The parametrized space.
""" """
dg = DataladAOMICPIOP1(types=type_, tasks=tasks) dg = DataladAOMICPIOP1(types=type_, tasks=tasks, space=space)
# Set URI to Gin # Set URI to Gin
dg.uri = URI dg.uri = URI

View file

@ -18,25 +18,56 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomicpiop2"
@pytest.mark.parametrize( @pytest.mark.parametrize(
"type_, nested_types, tasks", "type_, nested_types, tasks, space",
[ [
("BOLD", ["confounds", "mask"], None), (
("BOLD", ["confounds", "mask"], ["restingstate"]), "BOLD",
("BOLD", ["confounds", "mask"], ["restingstate", "stopsignal"]), ["confounds", "mask", "reference"],
("BOLD", ["confounds", "mask"], ["workingmemory", "stopsignal"]), None,
("BOLD", ["confounds", "mask"], ["workingmemory"]), "MNI152NLin2009cAsym",
("T1w", ["mask"], None), ),
("VBM_CSF", None, None), ("BOLD", ["confounds", "mask", "reference"], None, "native"),
("VBM_GM", None, None), (
("VBM_WM", None, None), "BOLD",
("DWI", None, None), ["confounds", "mask", "reference"],
("FreeSurfer", None, None), ["restingstate"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["restingstate", "stopsignal"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["workingmemory", "stopsignal"],
"MNI152NLin2009cAsym",
),
(
"BOLD",
["confounds", "mask", "reference"],
["workingmemory"],
"MNI152NLin2009cAsym",
),
("T1w", ["mask"], None, "MNI152NLin2009cAsym"),
("T1w", ["mask"], None, "native"),
("VBM_CSF", None, None, "MNI152NLin2009cAsym"),
("VBM_CSF", None, None, "native"),
("VBM_GM", None, None, "MNI152NLin2009cAsym"),
("VBM_GM", None, None, "native"),
("VBM_WM", None, None, "MNI152NLin2009cAsym"),
("VBM_WM", None, None, "native"),
("DWI", None, None, "MNI152NLin2009cAsym"),
("FreeSurfer", None, None, "MNI152NLin2009cAsym"),
], ],
) )
def test_DataladAOMICPIOP2( def test_DataladAOMICPIOP2(
type_: str, type_: str,
nested_types: Optional[list[str]], nested_types: Optional[list[str]],
tasks: Optional[list[str]], tasks: Optional[list[str]],
space: str,
) -> None: ) -> None:
"""Test DataladAOMICPIOP2 DataGrabber. """Test DataladAOMICPIOP2 DataGrabber.
@ -48,9 +79,11 @@ def test_DataladAOMICPIOP2(
The parametrized nested types. The parametrized nested types.
tasks : list of str or None tasks : list of str or None
The parametrized task values. The parametrized task values.
space: str
The parametrized space.
""" """
dg = DataladAOMICPIOP2(types=type_, tasks=tasks) dg = DataladAOMICPIOP2(types=type_, tasks=tasks, space=space)
# Set URI to Gin # Set URI to Gin
dg.uri = URI dg.uri = URI

View file

@ -4,6 +4,7 @@
# Vera Komeyer <v.komeyer@fz-juelich.de> # Vera Komeyer <v.komeyer@fz-juelich.de>
# Xuan Li <xu.li@fz-juelich.de> # Xuan Li <xu.li@fz-juelich.de>
# License: AGPL # License: AGPL
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
@ -39,30 +40,70 @@ with TemporaryDirectory() as tmpdir_name:
(sub_dir / dname).mkdir() (sub_dir / dname).mkdir()
fnames = [ fnames = [
# T1w native
f"anat/{t_sub}_desc-preproc_T1w.nii.gz",
# T1w MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc" f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc"
"_T1w.nii.gz" "_T1w.nii.gz"
), ),
# T1w brain mask native
f"anat/{t_sub}_desc-brain_mask.nii.gz",
# T1w brain mask MNI152NLin2009cAsym
(
f"anat/{t_sub}_space-MNI152NLin2009cAsym_"
"desc-brain_mask.nii.gz"
),
# CSF native
f"anat/{t_sub}_label-CSF_probseg.nii.gz",
# CSF MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz" "CSF_probseg.nii.gz"
), ),
# GM native
f"anat/{t_sub}_label-GM_probseg.nii.gz",
# GM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz" "GM_probseg.nii.gz"
), ),
# WM native
f"anat/{t_sub}_label-WM_probseg.nii.gz",
# WM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz" "WM_probseg.nii.gz"
), ),
# BOLD native
(
f"func/{t_sub}_task-moviewatching_space-"
"T1w_desc-preproc_bold.nii.gz"
),
# BOLD MNI152NLin2009cAsym
( (
f"func/{t_sub}_task-moviewatching_space-" f"func/{t_sub}_task-moviewatching_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" "MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
), ),
# BOLD brain mask native
(
f"func/{t_sub}_task-moviewatching_"
"space-T1w_desc-brain_mask.nii.gz"
),
# BOLD brain mask MNI152NLin2009cAsym
(
f"func/{t_sub}_task-moviewatching_"
"space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
),
(
f"func/{t_sub}_task-moviewatching_space-"
"T1w_desc-preproc_bold.json"
),
( (
f"func/{t_sub}_task-moviewatching_space-" f"func/{t_sub}_task-moviewatching_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.json" "MNI152NLin2009cAsym_desc-preproc_bold.json"
), ),
# BOLD confounds
( (
f"func/{t_sub}_task-moviewatching_desc-confounds" f"func/{t_sub}_task-moviewatching_desc-confounds"
"_regressors.tsv" "_regressors.tsv"
@ -71,13 +112,15 @@ with TemporaryDirectory() as tmpdir_name:
f"func/{t_sub}_task-moviewatching_desc-confounds" f"func/{t_sub}_task-moviewatching_desc-confounds"
"_regressors.json" "_regressors.json"
), ),
# BOLD reference native
( (
f"func/{t_sub}_task-moviewatching_" f"func/{t_sub}_task-moviewatching_"
"space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz" "space-T1w_boldref.nii.gz"
), ),
# BOLD reference MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_" f"func/{t_sub}_task-moviewatching_"
"desc-brain_mask.nii.gz" "space-MNI152NLin2009cAsym_boldref.nii.gz"
), ),
] ]

View file

@ -5,6 +5,7 @@
# Xuan Li <xu.li@fz-juelich.de> # Xuan Li <xu.li@fz-juelich.de>
# Leonard Sasse <l.sasse@fz-juelich.de> # Leonard Sasse <l.sasse@fz-juelich.de>
# License: AGPL # License: AGPL
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
@ -35,22 +36,37 @@ with TemporaryDirectory() as tmpdir_name:
(sub_dir / dname).mkdir() (sub_dir / dname).mkdir()
fnames = [ fnames = [
# T1w native
f"anat/{t_sub}_desc-preproc_T1w.nii.gz",
# T1w MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc" f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc"
"_T1w.nii.gz" "_T1w.nii.gz"
), ),
# T1w brain mask native
f"anat/{t_sub}_desc-brain_mask.nii.gz",
# T1w brain mask MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_" f"anat/{t_sub}_space-MNI152NLin2009cAsym_"
"desc-brain_mask.nii.gz" "desc-brain_mask.nii.gz"
), ),
# CSF native
f"anat/{t_sub}_label-CSF_probseg.nii.gz",
# CSF MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz" "CSF_probseg.nii.gz"
), ),
# GM native
f"anat/{t_sub}_label-GM_probseg.nii.gz",
# GM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz" "GM_probseg.nii.gz"
), ),
# WM native
f"anat/{t_sub}_label-WM_probseg.nii.gz",
# WM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz" "WM_probseg.nii.gz"
@ -66,18 +82,35 @@ with TemporaryDirectory() as tmpdir_name:
"workingmemory_acq-seq", "workingmemory_acq-seq",
] ]
for t in tasks: for t in tasks:
# BOLD native
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-preproc_bold.nii.gz"
)
# BOLD MNI152NLin2009cAsym
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" "MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
) )
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-preproc_bold.json"
)
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.json" "MNI152NLin2009cAsym_desc-preproc_bold.json"
) )
# BOLD brain mask native
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-brain_mask.nii.gz"
)
# BOLD brain mask MNI152NLin2009cAsym
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-brain_mask.nii.gz" "MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
) )
# BOLD confounds
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_desc-confounds" f"func/{t_sub}_task-{t}_desc-confounds"
"_regressors.tsv" "_regressors.tsv"
@ -86,6 +119,15 @@ with TemporaryDirectory() as tmpdir_name:
f"func/{t_sub}_task-{t}_desc-confounds" f"func/{t_sub}_task-{t}_desc-confounds"
"_regressors.json" "_regressors.json"
) )
# BOLD reference native
fnames.append(
f"func/{t_sub}_task-{t}_" "space-T1w_boldref.nii.gz"
)
# BOLD reference MNI152NLin2009cAsym
fnames.append(
f"func/{t_sub}_task-{t}_"
"space-MNI152NLin2009cAsym_boldref.nii.gz"
)
elif dtype == "dwipreproc": elif dtype == "dwipreproc":
dname = "dwi" dname = "dwi"

View file

@ -5,6 +5,7 @@
# Xuan Li <xu.li@fz-juelich.de> # Xuan Li <xu.li@fz-juelich.de>
# Leonard Sasse <l.sasse@fz-juelich.de> # Leonard Sasse <l.sasse@fz-juelich.de>
# License: AGPL # License: AGPL
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
@ -35,22 +36,37 @@ with TemporaryDirectory() as tmpdir_name:
(sub_dir / dname).mkdir() (sub_dir / dname).mkdir()
fnames = [ fnames = [
# T1w native
f"anat/{t_sub}_desc-preproc_T1w.nii.gz",
# T1w MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc" f"anat/{t_sub}_space-MNI152NLin2009cAsym_desc-preproc"
"_T1w.nii.gz" "_T1w.nii.gz"
), ),
# T1w brain mask native
f"anat/{t_sub}_desc-brain_mask.nii.gz",
# T1w brain mask MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym" f"anat/{t_sub}_space-MNI152NLin2009cAsym"
"_desc-brain_mask.nii.gz" "_desc-brain_mask.nii.gz"
), ),
# CSF native
f"anat/{t_sub}_label-CSF_probseg.nii.gz",
# CSF MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz" "CSF_probseg.nii.gz"
), ),
# GM native
f"anat/{t_sub}_label-GM_probseg.nii.gz",
# GM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz" "GM_probseg.nii.gz"
), ),
# WM native
f"anat/{t_sub}_label-WM_probseg.nii.gz",
# WM MNI152NLin2009cAsym
( (
f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-" f"anat/{t_sub}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz" "WM_probseg.nii.gz"
@ -64,18 +80,35 @@ with TemporaryDirectory() as tmpdir_name:
"workingmemory_acq-seq", "workingmemory_acq-seq",
] ]
for t in tasks: for t in tasks:
# BOLD native
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-preproc_bold.nii.gz"
)
# BOLD MNI152NLin2009cAsym
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" "MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
) )
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-preproc_bold.json"
)
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-preproc_bold.json" "MNI152NLin2009cAsym_desc-preproc_bold.json"
) )
# BOLD brain mask native
fnames.append(
f"func/{t_sub}_task-{t}_space-"
"T1w_desc-brain_mask.nii.gz"
)
# BOLD brain mask MNI152NLin2009cAsym
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_space-" f"func/{t_sub}_task-{t}_space-"
"MNI152NLin2009cAsym_desc-brain_mask.nii.gz" "MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
) )
# BOLD confounds
fnames.append( fnames.append(
f"func/{t_sub}_task-{t}_desc-confounds" f"func/{t_sub}_task-{t}_desc-confounds"
"_regressors.tsv" "_regressors.tsv"
@ -84,6 +117,15 @@ with TemporaryDirectory() as tmpdir_name:
f"func/{t_sub}_task-{t}_desc-confounds" f"func/{t_sub}_task-{t}_desc-confounds"
"_regressors.json" "_regressors.json"
) )
# BOLD reference native
fnames.append(
f"func/{t_sub}_task-{t}_" "space-T1w_boldref.nii.gz"
)
# BOLD reference MNI152NLin2009cAsym
fnames.append(
f"func/{t_sub}_task-{t}_"
"space-MNI152NLin2009cAsym_boldref.nii.gz"
)
elif dtype == "dwipreproc": elif dtype == "dwipreproc":
dname = "dwi" dname = "dwi"