junifer 0.0.3.dev186__py3-none-any.whl → 0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- junifer/_version.py +14 -2
- junifer/api/cli.py +162 -17
- junifer/api/functions.py +87 -419
- junifer/api/parser.py +24 -0
- junifer/api/queue_context/__init__.py +8 -0
- junifer/api/queue_context/gnu_parallel_local_adapter.py +258 -0
- junifer/api/queue_context/htcondor_adapter.py +365 -0
- junifer/api/queue_context/queue_context_adapter.py +60 -0
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +192 -0
- junifer/api/queue_context/tests/test_htcondor_adapter.py +257 -0
- junifer/api/res/afni/run_afni_docker.sh +6 -6
- junifer/api/res/ants/ResampleImage +3 -0
- junifer/api/res/ants/antsApplyTransforms +3 -0
- junifer/api/res/ants/antsApplyTransformsToPoints +3 -0
- junifer/api/res/ants/run_ants_docker.sh +39 -0
- junifer/api/res/fsl/applywarp +3 -0
- junifer/api/res/fsl/flirt +3 -0
- junifer/api/res/fsl/img2imgcoord +3 -0
- junifer/api/res/fsl/run_fsl_docker.sh +39 -0
- junifer/api/res/fsl/std2imgcoord +3 -0
- junifer/api/res/run_conda.sh +4 -4
- junifer/api/res/run_venv.sh +22 -0
- junifer/api/tests/data/partly_cloudy_agg_mean_tian.yml +16 -0
- junifer/api/tests/test_api_utils.py +21 -3
- junifer/api/tests/test_cli.py +232 -9
- junifer/api/tests/test_functions.py +211 -439
- junifer/api/tests/test_parser.py +1 -1
- junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +6 -1
- junifer/configs/juseless/datagrabbers/camcan_vbm.py +6 -1
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +6 -1
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +8 -8
- junifer/configs/juseless/datagrabbers/ucla.py +44 -26
- junifer/configs/juseless/datagrabbers/ukb_vbm.py +6 -1
- junifer/data/VOIs/meta/AutobiographicalMemory_VOIs.txt +23 -0
- junifer/data/VOIs/meta/Power2013_MNI_VOIs.tsv +264 -0
- junifer/data/__init__.py +4 -0
- junifer/data/coordinates.py +298 -31
- junifer/data/masks.py +360 -28
- junifer/data/parcellations.py +621 -188
- junifer/data/template_spaces.py +190 -0
- junifer/data/tests/test_coordinates.py +34 -3
- junifer/data/tests/test_data_utils.py +1 -0
- junifer/data/tests/test_masks.py +202 -86
- junifer/data/tests/test_parcellations.py +266 -55
- junifer/data/tests/test_template_spaces.py +104 -0
- junifer/data/utils.py +4 -2
- junifer/datagrabber/__init__.py +1 -0
- junifer/datagrabber/aomic/id1000.py +111 -70
- junifer/datagrabber/aomic/piop1.py +116 -53
- junifer/datagrabber/aomic/piop2.py +116 -53
- junifer/datagrabber/aomic/tests/test_id1000.py +27 -27
- junifer/datagrabber/aomic/tests/test_piop1.py +27 -27
- junifer/datagrabber/aomic/tests/test_piop2.py +27 -27
- junifer/datagrabber/base.py +62 -10
- junifer/datagrabber/datalad_base.py +0 -2
- junifer/datagrabber/dmcc13_benchmark.py +372 -0
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +5 -0
- junifer/datagrabber/hcp1200/hcp1200.py +30 -13
- junifer/datagrabber/pattern.py +133 -27
- junifer/datagrabber/pattern_datalad.py +111 -13
- junifer/datagrabber/tests/test_base.py +57 -6
- junifer/datagrabber/tests/test_datagrabber_utils.py +204 -76
- junifer/datagrabber/tests/test_datalad_base.py +0 -6
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +256 -0
- junifer/datagrabber/tests/test_multiple.py +43 -10
- junifer/datagrabber/tests/test_pattern.py +125 -178
- junifer/datagrabber/tests/test_pattern_datalad.py +44 -25
- junifer/datagrabber/utils.py +151 -16
- junifer/datareader/default.py +36 -10
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +6 -0
- junifer/markers/base.py +25 -16
- junifer/markers/collection.py +35 -16
- junifer/markers/complexity/__init__.py +27 -0
- junifer/markers/complexity/complexity_base.py +149 -0
- junifer/markers/complexity/hurst_exponent.py +136 -0
- junifer/markers/complexity/multiscale_entropy_auc.py +140 -0
- junifer/markers/complexity/perm_entropy.py +132 -0
- junifer/markers/complexity/range_entropy.py +136 -0
- junifer/markers/complexity/range_entropy_auc.py +145 -0
- junifer/markers/complexity/sample_entropy.py +134 -0
- junifer/markers/complexity/tests/test_complexity_base.py +19 -0
- junifer/markers/complexity/tests/test_hurst_exponent.py +69 -0
- junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +68 -0
- junifer/markers/complexity/tests/test_perm_entropy.py +68 -0
- junifer/markers/complexity/tests/test_range_entropy.py +69 -0
- junifer/markers/complexity/tests/test_range_entropy_auc.py +69 -0
- junifer/markers/complexity/tests/test_sample_entropy.py +68 -0
- junifer/markers/complexity/tests/test_weighted_perm_entropy.py +68 -0
- junifer/markers/complexity/weighted_perm_entropy.py +133 -0
- junifer/markers/falff/_afni_falff.py +153 -0
- junifer/markers/falff/_junifer_falff.py +142 -0
- junifer/markers/falff/falff_base.py +91 -84
- junifer/markers/falff/falff_parcels.py +61 -45
- junifer/markers/falff/falff_spheres.py +64 -48
- junifer/markers/falff/tests/test_falff_parcels.py +89 -121
- junifer/markers/falff/tests/test_falff_spheres.py +92 -127
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +1 -0
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +1 -0
- junifer/markers/functional_connectivity/functional_connectivity_base.py +1 -0
- junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +46 -44
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +34 -39
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +40 -52
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +62 -70
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +99 -85
- junifer/markers/parcel_aggregation.py +60 -38
- junifer/markers/reho/_afni_reho.py +192 -0
- junifer/markers/reho/_junifer_reho.py +281 -0
- junifer/markers/reho/reho_base.py +69 -34
- junifer/markers/reho/reho_parcels.py +26 -16
- junifer/markers/reho/reho_spheres.py +23 -9
- junifer/markers/reho/tests/test_reho_parcels.py +93 -92
- junifer/markers/reho/tests/test_reho_spheres.py +88 -86
- junifer/markers/sphere_aggregation.py +54 -9
- junifer/markers/temporal_snr/temporal_snr_base.py +1 -0
- junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +38 -37
- junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +34 -38
- junifer/markers/tests/test_collection.py +43 -42
- junifer/markers/tests/test_ets_rss.py +29 -37
- junifer/markers/tests/test_parcel_aggregation.py +587 -468
- junifer/markers/tests/test_sphere_aggregation.py +209 -157
- junifer/markers/utils.py +2 -40
- junifer/onthefly/read_transform.py +13 -6
- junifer/pipeline/__init__.py +1 -0
- junifer/pipeline/pipeline_step_mixin.py +105 -41
- junifer/pipeline/registry.py +17 -0
- junifer/pipeline/singleton.py +45 -0
- junifer/pipeline/tests/test_pipeline_step_mixin.py +139 -51
- junifer/pipeline/tests/test_update_meta_mixin.py +1 -0
- junifer/pipeline/tests/test_workdir_manager.py +104 -0
- junifer/pipeline/update_meta_mixin.py +8 -2
- junifer/pipeline/utils.py +154 -15
- junifer/pipeline/workdir_manager.py +246 -0
- junifer/preprocess/__init__.py +3 -0
- junifer/preprocess/ants/__init__.py +4 -0
- junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
- junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
- junifer/preprocess/base.py +96 -69
- junifer/preprocess/bold_warper.py +265 -0
- junifer/preprocess/confounds/fmriprep_confound_remover.py +91 -134
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +106 -111
- junifer/preprocess/fsl/__init__.py +4 -0
- junifer/preprocess/fsl/apply_warper.py +179 -0
- junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
- junifer/preprocess/tests/test_bold_warper.py +159 -0
- junifer/preprocess/tests/test_preprocess_base.py +6 -6
- junifer/preprocess/warping/__init__.py +6 -0
- junifer/preprocess/warping/_ants_warper.py +167 -0
- junifer/preprocess/warping/_fsl_warper.py +109 -0
- junifer/preprocess/warping/space_warper.py +213 -0
- junifer/preprocess/warping/tests/test_space_warper.py +198 -0
- junifer/stats.py +18 -4
- junifer/storage/base.py +9 -1
- junifer/storage/hdf5.py +8 -3
- junifer/storage/pandas_base.py +2 -1
- junifer/storage/sqlite.py +1 -0
- junifer/storage/tests/test_hdf5.py +2 -1
- junifer/storage/tests/test_sqlite.py +8 -8
- junifer/storage/tests/test_utils.py +6 -6
- junifer/storage/utils.py +1 -0
- junifer/testing/datagrabbers.py +11 -7
- junifer/testing/utils.py +1 -0
- junifer/tests/test_stats.py +2 -0
- junifer/utils/__init__.py +1 -0
- junifer/utils/helpers.py +53 -0
- junifer/utils/logging.py +14 -3
- junifer/utils/tests/test_helpers.py +35 -0
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/METADATA +59 -28
- junifer-0.0.4.dist-info/RECORD +257 -0
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/WHEEL +1 -1
- junifer/markers/falff/falff_estimator.py +0 -334
- junifer/markers/falff/tests/test_falff_estimator.py +0 -238
- junifer/markers/reho/reho_estimator.py +0 -515
- junifer/markers/reho/tests/test_reho_estimator.py +0 -260
- junifer-0.0.3.dev186.dist-info/RECORD +0 -199
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.3.dev186.dist-info → junifer-0.0.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
"""Provide tests for template spaces."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
import socket
|
7
|
+
from pathlib import Path
|
8
|
+
|
9
|
+
import nibabel as nib
|
10
|
+
import pytest
|
11
|
+
|
12
|
+
from junifer.data import get_template, get_xfm
|
13
|
+
from junifer.datareader import DefaultDataReader
|
14
|
+
from junifer.testing.datagrabbers import (
|
15
|
+
OasisVBMTestingDataGrabber,
|
16
|
+
PartlyCloudyTestingDataGrabber,
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.mark.skipif(
|
21
|
+
socket.gethostname() != "juseless",
|
22
|
+
reason="only for juseless",
|
23
|
+
)
|
24
|
+
def test_get_xfm(tmp_path: Path) -> None:
|
25
|
+
"""Test warp file fetching.
|
26
|
+
|
27
|
+
Parameters
|
28
|
+
----------
|
29
|
+
tmp_path : pathlib.Path
|
30
|
+
The path to the test directory.
|
31
|
+
|
32
|
+
"""
|
33
|
+
xfm_path = get_xfm(
|
34
|
+
src="MNI152NLin6Asym", dst="MNI152NLin2009cAsym", xfms_dir=tmp_path
|
35
|
+
)
|
36
|
+
assert isinstance(xfm_path, Path)
|
37
|
+
|
38
|
+
|
39
|
+
@pytest.mark.parametrize(
|
40
|
+
"template_type",
|
41
|
+
[
|
42
|
+
"T1w",
|
43
|
+
"brain",
|
44
|
+
"gm",
|
45
|
+
"wm",
|
46
|
+
"csf",
|
47
|
+
],
|
48
|
+
)
|
49
|
+
def test_get_template(template_type: str) -> None:
|
50
|
+
"""Test tailored template image fetch.
|
51
|
+
|
52
|
+
Parameters
|
53
|
+
----------
|
54
|
+
template_type : str
|
55
|
+
The parametrized template type.
|
56
|
+
|
57
|
+
"""
|
58
|
+
with PartlyCloudyTestingDataGrabber() as dg:
|
59
|
+
element = dg["sub-01"]
|
60
|
+
element_data = DefaultDataReader().fit_transform(element)
|
61
|
+
bold = element_data["BOLD"]
|
62
|
+
# Get tailored parcellation
|
63
|
+
tailored_template = get_template(
|
64
|
+
space=bold["space"], target_data=bold, template_type=template_type
|
65
|
+
)
|
66
|
+
assert isinstance(tailored_template, nib.Nifti1Image)
|
67
|
+
|
68
|
+
|
69
|
+
def test_get_template_invalid_space() -> None:
|
70
|
+
"""Test invalid space check for template fetch."""
|
71
|
+
with OasisVBMTestingDataGrabber() as dg:
|
72
|
+
element = dg["sub-01"]
|
73
|
+
element_data = DefaultDataReader().fit_transform(element)
|
74
|
+
vbm_gm = element_data["VBM_GM"]
|
75
|
+
# Get tailored parcellation
|
76
|
+
with pytest.raises(ValueError, match="Unknown template space:"):
|
77
|
+
get_template(space="andromeda", target_data=vbm_gm)
|
78
|
+
|
79
|
+
|
80
|
+
def test_get_template_invalid_template_type() -> None:
|
81
|
+
"""Test invalid template type check for template fetch."""
|
82
|
+
with OasisVBMTestingDataGrabber() as dg:
|
83
|
+
element = dg["sub-01"]
|
84
|
+
element_data = DefaultDataReader().fit_transform(element)
|
85
|
+
vbm_gm = element_data["VBM_GM"]
|
86
|
+
# Get tailored parcellation
|
87
|
+
with pytest.raises(ValueError, match="Unknown template type:"):
|
88
|
+
get_template(
|
89
|
+
space=vbm_gm["space"],
|
90
|
+
target_data=vbm_gm,
|
91
|
+
template_type="xenon",
|
92
|
+
)
|
93
|
+
|
94
|
+
|
95
|
+
def test_get_template_closest_resolution() -> None:
|
96
|
+
"""Test closest resolution check for template fetch."""
|
97
|
+
with OasisVBMTestingDataGrabber() as dg:
|
98
|
+
element = dg["sub-01"]
|
99
|
+
element_data = DefaultDataReader().fit_transform(element)
|
100
|
+
vbm_gm = element_data["VBM_GM"]
|
101
|
+
# Change header resolution to fetch closest resolution
|
102
|
+
element_data["VBM_GM"]["data"].header.set_zooms((3, 3, 3))
|
103
|
+
template = get_template(space=vbm_gm["space"], target_data=vbm_gm)
|
104
|
+
assert isinstance(template, nib.Nifti1Image)
|
junifer/data/utils.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Provide utilities for data module."""
|
2
|
+
|
2
3
|
from typing import List, Optional, Union
|
3
4
|
|
4
5
|
import numpy as np
|
@@ -7,14 +8,14 @@ from ..utils.logging import logger
|
|
7
8
|
|
8
9
|
|
9
10
|
def closest_resolution(
|
10
|
-
resolution: Optional[float],
|
11
|
+
resolution: Optional[Union[float, int]],
|
11
12
|
valid_resolution: Union[List[float], List[int], np.ndarray],
|
12
13
|
) -> Union[float, int]:
|
13
14
|
"""Find the closest resolution.
|
14
15
|
|
15
16
|
Parameters
|
16
17
|
----------
|
17
|
-
resolution : float, optional
|
18
|
+
resolution : float or int, optional
|
18
19
|
The given resolution. If None, will return the highest resolution
|
19
20
|
(default None).
|
20
21
|
valid_resolution : list of float or int, or np.ndarray
|
@@ -24,6 +25,7 @@ def closest_resolution(
|
|
24
25
|
-------
|
25
26
|
float or int
|
26
27
|
The closest valid resolution.
|
28
|
+
|
27
29
|
"""
|
28
30
|
# Convert list of int to numpy.ndarray
|
29
31
|
if not isinstance(valid_resolution, np.ndarray):
|
junifer/datagrabber/__init__.py
CHANGED
@@ -15,3 +15,4 @@ from .pattern_datalad import PatternDataladDataGrabber
|
|
15
15
|
from .aomic import DataladAOMICID1000, DataladAOMICPIOP1, DataladAOMICPIOP2
|
16
16
|
from .hcp1200 import HCP1200, DataladHCP1200
|
17
17
|
from .multiple import MultipleDataGrabber
|
18
|
+
from .dmcc13_benchmark import DMCC13Benchmark
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# License: AGPL
|
9
9
|
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import
|
11
|
+
from typing import List, Union
|
12
12
|
|
13
13
|
from ...api.decorators import register_datagrabber
|
14
14
|
from ..pattern_datalad import PatternDataladDataGrabber
|
@@ -24,10 +24,12 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
|
|
24
24
|
The directory where the datalad dataset will be cloned. If None,
|
25
25
|
the datalad dataset will be cloned into a temporary directory
|
26
26
|
(default None).
|
27
|
-
types: {"BOLD", "BOLD_confounds", "T1w", "
|
28
|
-
"
|
27
|
+
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
|
28
|
+
"VBM_WM", "DWI"} or a list of the options, optional
|
29
29
|
AOMIC data types. If None, all available data types are selected.
|
30
30
|
(default None).
|
31
|
+
native_t1w : bool, optional
|
32
|
+
Whether to use T1w in native space (default False).
|
31
33
|
|
32
34
|
"""
|
33
35
|
|
@@ -35,55 +37,116 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
|
|
35
37
|
self,
|
36
38
|
datadir: Union[str, Path, None] = None,
|
37
39
|
types: Union[str, List[str], None] = None,
|
40
|
+
native_t1w: bool = False,
|
38
41
|
) -> None:
|
39
42
|
# The patterns
|
40
43
|
patterns = {
|
41
|
-
"BOLD":
|
42
|
-
"
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
"
|
48
|
-
"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
"
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
"
|
66
|
-
|
67
|
-
"
|
68
|
-
"
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
"
|
74
|
-
"
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
44
|
+
"BOLD": {
|
45
|
+
"pattern": (
|
46
|
+
"derivatives/fmriprep/{subject}/func/"
|
47
|
+
"{subject}_task-moviewatching_"
|
48
|
+
"space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
|
49
|
+
),
|
50
|
+
"space": "MNI152NLin2009cAsym",
|
51
|
+
"mask_item": "BOLD_mask",
|
52
|
+
},
|
53
|
+
"BOLD_confounds": {
|
54
|
+
"pattern": (
|
55
|
+
"derivatives/fmriprep/{subject}/func/"
|
56
|
+
"{subject}_task-moviewatching_"
|
57
|
+
"desc-confounds_regressors.tsv"
|
58
|
+
),
|
59
|
+
"format": "fmriprep",
|
60
|
+
},
|
61
|
+
"BOLD_mask": {
|
62
|
+
"pattern": (
|
63
|
+
"derivatives/fmriprep/{subject}/func/"
|
64
|
+
"{subject}_task-moviewatching_"
|
65
|
+
"space-MNI152NLin2009cAsym_"
|
66
|
+
"desc-brain_mask.nii.gz"
|
67
|
+
),
|
68
|
+
"space": "MNI152NLin2009cAsym",
|
69
|
+
},
|
70
|
+
"T1w": {
|
71
|
+
"pattern": (
|
72
|
+
"derivatives/fmriprep/{subject}/anat/"
|
73
|
+
"{subject}_space-MNI152NLin2009cAsym_"
|
74
|
+
"desc-preproc_T1w.nii.gz"
|
75
|
+
),
|
76
|
+
"space": "MNI152NLin2009cAsym",
|
77
|
+
"mask_item": "T1w_mask",
|
78
|
+
},
|
79
|
+
"T1w_mask": {
|
80
|
+
"pattern": (
|
81
|
+
"derivatives/fmriprep/{subject}/anat/"
|
82
|
+
"{subject}_space-MNI152NLin2009cAsym_"
|
83
|
+
"desc-brain_mask.nii.gz"
|
84
|
+
),
|
85
|
+
"space": "MNI152NLin2009cAsym",
|
86
|
+
},
|
87
|
+
"VBM_CSF": {
|
88
|
+
"pattern": (
|
89
|
+
"derivatives/fmriprep/{subject}/anat/"
|
90
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
91
|
+
"CSF_probseg.nii.gz"
|
92
|
+
),
|
93
|
+
"space": "MNI152NLin2009cAsym",
|
94
|
+
},
|
95
|
+
"VBM_GM": {
|
96
|
+
"pattern": (
|
97
|
+
"derivatives/fmriprep/{subject}/anat/"
|
98
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
99
|
+
"GM_probseg.nii.gz"
|
100
|
+
),
|
101
|
+
"space": "MNI152NLin2009cAsym",
|
102
|
+
},
|
103
|
+
"VBM_WM": {
|
104
|
+
"pattern": (
|
105
|
+
"derivatives/fmriprep/{subject}/anat/"
|
106
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
107
|
+
"WM_probseg.nii.gz"
|
108
|
+
),
|
109
|
+
"space": "MNI152NLin2009cAsym",
|
110
|
+
},
|
111
|
+
"DWI": {
|
112
|
+
"pattern": (
|
113
|
+
"derivatives/dwipreproc/{subject}/dwi/"
|
114
|
+
"{subject}_desc-preproc_dwi.nii.gz"
|
115
|
+
),
|
116
|
+
},
|
86
117
|
}
|
118
|
+
# Use native T1w assets
|
119
|
+
self.native_t1w = False
|
120
|
+
if native_t1w:
|
121
|
+
self.native_t1w = True
|
122
|
+
patterns.update(
|
123
|
+
{
|
124
|
+
"T1w": {
|
125
|
+
"pattern": (
|
126
|
+
"derivatives/fmriprep/{subject}/anat/"
|
127
|
+
"{subject}_desc-preproc_T1w.nii.gz"
|
128
|
+
),
|
129
|
+
"space": "native",
|
130
|
+
"mask_item": "T1w_mask",
|
131
|
+
},
|
132
|
+
"T1w_mask": {
|
133
|
+
"pattern": (
|
134
|
+
"derivatives/fmriprep/{subject}/anat/"
|
135
|
+
"{subject}_desc-brain_mask.nii.gz"
|
136
|
+
),
|
137
|
+
"space": "native",
|
138
|
+
},
|
139
|
+
"Warp": {
|
140
|
+
"pattern": (
|
141
|
+
"derivatives/fmriprep/{subject}/anat/"
|
142
|
+
"{subject}_from-MNI152NLin2009cAsym_to-T1w_"
|
143
|
+
"mode-image_xfm.h5"
|
144
|
+
),
|
145
|
+
"src": "MNI152NLin2009cAsym",
|
146
|
+
"dst": "native",
|
147
|
+
},
|
148
|
+
}
|
149
|
+
)
|
87
150
|
# Set default types
|
88
151
|
if types is None:
|
89
152
|
types = list(patterns.keys())
|
@@ -102,25 +165,3 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
|
|
102
165
|
replacements=replacements,
|
103
166
|
confounds_format="fmriprep",
|
104
167
|
)
|
105
|
-
|
106
|
-
def get_item(self, subject: str) -> Dict:
|
107
|
-
"""Index one element in the dataset.
|
108
|
-
|
109
|
-
Parameters
|
110
|
-
----------
|
111
|
-
subject : str
|
112
|
-
The subject ID.
|
113
|
-
|
114
|
-
Returns
|
115
|
-
-------
|
116
|
-
out : dict
|
117
|
-
Dictionary of paths for each type of data required for the
|
118
|
-
specified element.
|
119
|
-
|
120
|
-
"""
|
121
|
-
out = super().get_item(subject=subject)
|
122
|
-
if out.get("BOLD"):
|
123
|
-
out["BOLD"]["mask_item"] = "BOLD_mask"
|
124
|
-
if out.get("T1w"):
|
125
|
-
out["T1w"]["mask_item"] = "T1w_mask"
|
126
|
-
return out
|
@@ -26,14 +26,21 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
|
|
26
26
|
The directory where the datalad dataset will be cloned. If None,
|
27
27
|
the datalad dataset will be cloned into a temporary directory
|
28
28
|
(default None).
|
29
|
-
types: {"BOLD", "BOLD_confounds", "T1w", "
|
30
|
-
"
|
29
|
+
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
|
30
|
+
"VBM_WM", "DWI"} or a list of the options, optional
|
31
31
|
AOMIC data types. If None, all available data types are selected.
|
32
32
|
(default None).
|
33
33
|
tasks : {"restingstate", "anticipation", "emomatching", "faces", \
|
34
34
|
"gstroop", "workingmemory"} or list of the options, optional
|
35
35
|
AOMIC PIOP1 task sessions. If None, all available task sessions are
|
36
36
|
selected (default None).
|
37
|
+
native_t1w : bool, optional
|
38
|
+
Whether to use T1w in native space (default False).
|
39
|
+
|
40
|
+
Raises
|
41
|
+
------
|
42
|
+
ValueError
|
43
|
+
If invalid value is passed for ``tasks``.
|
37
44
|
|
38
45
|
"""
|
39
46
|
|
@@ -42,6 +49,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
|
|
42
49
|
datadir: Union[str, Path, None] = None,
|
43
50
|
types: Union[str, List[str], None] = None,
|
44
51
|
tasks: Union[str, List[str], None] = None,
|
52
|
+
native_t1w: bool = False,
|
45
53
|
) -> None:
|
46
54
|
# Declare all tasks
|
47
55
|
all_tasks = [
|
@@ -69,51 +77,111 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
|
|
69
77
|
self.tasks = tasks
|
70
78
|
# The patterns
|
71
79
|
patterns = {
|
72
|
-
"BOLD":
|
73
|
-
"
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
"
|
79
|
-
"
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
"
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"
|
96
|
-
|
97
|
-
"
|
98
|
-
"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
"
|
104
|
-
"
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
80
|
+
"BOLD": {
|
81
|
+
"pattern": (
|
82
|
+
"derivatives/fmriprep/{subject}/func/"
|
83
|
+
"{subject}_task-{task}_"
|
84
|
+
"space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
|
85
|
+
),
|
86
|
+
"space": "MNI152NLin2009cAsym",
|
87
|
+
"mask_item": "BOLD_mask",
|
88
|
+
},
|
89
|
+
"BOLD_confounds": {
|
90
|
+
"pattern": (
|
91
|
+
"derivatives/fmriprep/{subject}/func/"
|
92
|
+
"{subject}_task-{task}_"
|
93
|
+
"desc-confounds_regressors.tsv"
|
94
|
+
),
|
95
|
+
"format": "fmriprep",
|
96
|
+
},
|
97
|
+
"BOLD_mask": {
|
98
|
+
"pattern": (
|
99
|
+
"derivatives/fmriprep/{subject}/func/"
|
100
|
+
"{subject}_task-{task}_"
|
101
|
+
"space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
|
102
|
+
),
|
103
|
+
"space": "MNI152NLin2009cAsym",
|
104
|
+
},
|
105
|
+
"T1w": {
|
106
|
+
"pattern": (
|
107
|
+
"derivatives/fmriprep/{subject}/anat/"
|
108
|
+
"{subject}_space-MNI152NLin2009cAsym_"
|
109
|
+
"desc-preproc_T1w.nii.gz"
|
110
|
+
),
|
111
|
+
"space": "MNI152NLin2009cAsym",
|
112
|
+
"mask_item": "T1w_mask",
|
113
|
+
},
|
114
|
+
"T1w_mask": {
|
115
|
+
"pattern": (
|
116
|
+
"derivatives/fmriprep/{subject}/anat/"
|
117
|
+
"{subject}_space-MNI152NLin2009cAsym_"
|
118
|
+
"desc-brain_mask.nii.gz"
|
119
|
+
),
|
120
|
+
"space": "MNI152NLin2009cAsym",
|
121
|
+
},
|
122
|
+
"VBM_CSF": {
|
123
|
+
"pattern": (
|
124
|
+
"derivatives/fmriprep/{subject}/anat/"
|
125
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
126
|
+
"CSF_probseg.nii.gz"
|
127
|
+
),
|
128
|
+
"space": "MNI152NLin2009cAsym",
|
129
|
+
},
|
130
|
+
"VBM_GM": {
|
131
|
+
"pattern": (
|
132
|
+
"derivatives/fmriprep/{subject}/anat/"
|
133
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
134
|
+
"GM_probseg.nii.gz"
|
135
|
+
),
|
136
|
+
"space": "MNI152NLin2009cAsym",
|
137
|
+
},
|
138
|
+
"VBM_WM": {
|
139
|
+
"pattern": (
|
140
|
+
"derivatives/fmriprep/{subject}/anat/"
|
141
|
+
"{subject}_space-MNI152NLin2009cAsym_label-"
|
142
|
+
"WM_probseg.nii.gz"
|
143
|
+
),
|
144
|
+
"space": "MNI152NLin2009cAsym",
|
145
|
+
},
|
146
|
+
"DWI": {
|
147
|
+
"pattern": (
|
148
|
+
"derivatives/dwipreproc/{subject}/dwi/"
|
149
|
+
"{subject}_desc-preproc_dwi.nii.gz"
|
150
|
+
),
|
151
|
+
},
|
116
152
|
}
|
153
|
+
# Use native T1w assets
|
154
|
+
self.native_t1w = False
|
155
|
+
if native_t1w:
|
156
|
+
self.native_t1w = True
|
157
|
+
patterns.update(
|
158
|
+
{
|
159
|
+
"T1w": {
|
160
|
+
"pattern": (
|
161
|
+
"derivatives/fmriprep/{subject}/anat/"
|
162
|
+
"{subject}_desc-preproc_T1w.nii.gz"
|
163
|
+
),
|
164
|
+
"space": "native",
|
165
|
+
"mask_item": "T1w_mask",
|
166
|
+
},
|
167
|
+
"T1w_mask": {
|
168
|
+
"pattern": (
|
169
|
+
"derivatives/fmriprep/{subject}/anat/"
|
170
|
+
"{subject}_desc-brain_mask.nii.gz"
|
171
|
+
),
|
172
|
+
"space": "native",
|
173
|
+
},
|
174
|
+
"Warp": {
|
175
|
+
"pattern": (
|
176
|
+
"derivatives/fmriprep/{subject}/anat/"
|
177
|
+
"{subject}_from-MNI152NLin2009cAsym_to-T1w_"
|
178
|
+
"mode-image_xfm.h5"
|
179
|
+
),
|
180
|
+
"src": "MNI152NLin2009cAsym",
|
181
|
+
"dst": "native",
|
182
|
+
},
|
183
|
+
}
|
184
|
+
)
|
117
185
|
# Set default types
|
118
186
|
if types is None:
|
119
187
|
types = list(patterns.keys())
|
@@ -163,12 +231,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
|
|
163
231
|
acq = task_acqs[task]
|
164
232
|
new_task = f"{task}_acq-{acq}"
|
165
233
|
|
166
|
-
|
167
|
-
if out.get("BOLD"):
|
168
|
-
out["BOLD"]["mask_item"] = "BOLD_mask"
|
169
|
-
if out.get("T1w"):
|
170
|
-
out["T1w"]["mask_item"] = "T1w_mask"
|
171
|
-
return out
|
234
|
+
return super().get_item(subject=subject, task=new_task)
|
172
235
|
|
173
236
|
def get_elements(self) -> List:
|
174
237
|
"""Implement fetching list of subjects in the dataset.
|
@@ -179,7 +242,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
|
|
179
242
|
The list of subjects in the dataset.
|
180
243
|
|
181
244
|
"""
|
182
|
-
subjects = [f"{x:04d}" for x in range(1, 217)]
|
245
|
+
subjects = [f"sub-{x:04d}" for x in range(1, 217)]
|
183
246
|
elems = []
|
184
247
|
for subject, task in product(subjects, self.tasks):
|
185
248
|
elems.append((subject, task))
|