junifer 0.0.7.dev332__py3-none-any.whl → 0.0.8__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 +9 -19
- junifer/api/__init__.pyi +17 -2
- junifer/api/functions.py +222 -39
- junifer/api/queue_context/__init__.pyi +11 -3
- junifer/api/queue_context/gnu_parallel_local_adapter.py +81 -120
- junifer/api/queue_context/htcondor_adapter.py +118 -181
- junifer/api/queue_context/queue_context_adapter.py +51 -7
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +10 -35
- junifer/api/queue_context/tests/test_htcondor_adapter.py +13 -50
- junifer/api/res/fsl/run_fsl_docker.sh +4 -0
- junifer/api/tests/test_functions.py +863 -36
- junifer/cli/__init__.py +1 -7
- junifer/cli/cli.py +41 -22
- junifer/cli/parser.py +23 -147
- junifer/cli/tests/data/gmd_mean.yaml +6 -6
- junifer/cli/tests/data/gmd_mean_htcondor.yaml +6 -5
- junifer/cli/tests/data/partly_cloudy_agg_mean_tian.yml +1 -0
- junifer/cli/tests/test_cli.py +120 -4
- junifer/cli/tests/test_cli_utils.py +23 -6
- junifer/cli/utils.py +14 -9
- junifer/configs/__init__.py +5 -0
- junifer/configs/__init__.pyi +0 -0
- junifer/configs/juseless/datagrabbers/__init__.pyi +4 -2
- junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +18 -24
- junifer/configs/juseless/datagrabbers/camcan_vbm.py +20 -27
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +44 -52
- junifer/configs/juseless/datagrabbers/tests/test_ixi_vbm.py +0 -7
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -19
- junifer/configs/juseless/datagrabbers/ucla.py +111 -104
- junifer/configs/juseless/datagrabbers/ukb_vbm.py +19 -25
- junifer/configs/py.typed +0 -0
- junifer/conftest.py +63 -24
- junifer/data/_dispatch.py +9 -19
- junifer/data/coordinates/_ants_coordinates_warper.py +4 -1
- junifer/data/coordinates/_coordinates.py +51 -6
- junifer/data/coordinates/_fsl_coordinates_warper.py +4 -1
- junifer/data/coordinates/tests/test_coordinates.py +15 -3
- junifer/data/coordinates/tests/test_coordinates_names.py +37 -0
- junifer/data/maps/_ants_maps_warper.py +18 -12
- junifer/data/maps/_fsl_maps_warper.py +7 -3
- junifer/data/maps/_maps.py +12 -8
- junifer/data/maps/tests/test_maps.py +13 -21
- junifer/data/masks/_ants_mask_warper.py +18 -12
- junifer/data/masks/_fsl_mask_warper.py +7 -3
- junifer/data/masks/_masks.py +15 -12
- junifer/data/masks/tests/test_masks.py +20 -17
- junifer/data/parcellations/_ants_parcellation_warper.py +18 -12
- junifer/data/parcellations/_fsl_parcellation_warper.py +7 -5
- junifer/data/parcellations/_parcellations.py +125 -91
- junifer/data/parcellations/tests/test_parcellations.py +122 -1
- junifer/data/template_spaces.py +117 -50
- junifer/data/tests/test_template_spaces.py +10 -7
- junifer/data/utils.py +10 -8
- junifer/datagrabber/__init__.pyi +38 -5
- junifer/datagrabber/aomic/__init__.pyi +8 -1
- junifer/datagrabber/aomic/_types.py +22 -0
- junifer/datagrabber/aomic/id1000.py +193 -183
- junifer/datagrabber/aomic/piop1.py +215 -259
- junifer/datagrabber/aomic/piop2.py +211 -244
- junifer/datagrabber/aomic/tests/test_id1000.py +70 -53
- junifer/datagrabber/aomic/tests/test_piop1.py +98 -102
- junifer/datagrabber/aomic/tests/test_piop2.py +88 -85
- junifer/datagrabber/base.py +253 -79
- junifer/datagrabber/datalad_base.py +127 -76
- junifer/datagrabber/dmcc13_benchmark.py +204 -289
- junifer/datagrabber/hcp1200/__init__.pyi +7 -2
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +61 -40
- junifer/datagrabber/hcp1200/hcp1200.py +151 -164
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +116 -128
- junifer/datagrabber/multiple.py +183 -63
- junifer/datagrabber/pattern.py +358 -227
- junifer/datagrabber/pattern_datalad.py +84 -124
- junifer/datagrabber/pattern_validation_mixin.py +22 -50
- junifer/datagrabber/tests/test_base.py +17 -4
- junifer/datagrabber/tests/test_datalad_base.py +20 -27
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +110 -122
- junifer/datagrabber/tests/test_multiple.py +293 -31
- junifer/datagrabber/tests/test_pattern.py +577 -18
- junifer/datagrabber/tests/test_pattern_datalad.py +177 -107
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +9 -51
- junifer/datareader/default.py +8 -5
- junifer/datareader/tests/test_default_reader.py +1 -1
- junifer/external/BrainPrint/.codecov.yml +2 -0
- junifer/external/BrainPrint/.codespellignore +2 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/bug-report.md +45 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/documentation.md +12 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/feature-request.md +24 -0
- junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/questions-help-support.md +28 -0
- junifer/external/BrainPrint/.github/dependabot.yml +6 -0
- junifer/external/BrainPrint/.github/workflows/build.yml +53 -0
- junifer/external/BrainPrint/.github/workflows/code-style.yml +44 -0
- junifer/external/BrainPrint/.github/workflows/doc.yml +65 -0
- junifer/external/BrainPrint/.github/workflows/publish.yml +31 -0
- junifer/external/BrainPrint/.github/workflows/pytest.yml +54 -0
- junifer/external/BrainPrint/.gitignore +123 -0
- junifer/external/BrainPrint/LICENSE +21 -0
- junifer/external/BrainPrint/README.md +108 -0
- junifer/external/BrainPrint/brainprint/cli/__init__.py +11 -0
- junifer/external/BrainPrint/brainprint/cli/help_text.py +169 -0
- junifer/external/BrainPrint/brainprint/cli/parser.py +150 -0
- junifer/external/BrainPrint/brainprint/cli/utils.py +14 -0
- junifer/external/BrainPrint/brainprint/commands/__init__.py +0 -0
- junifer/external/BrainPrint/brainprint/commands/sys_info.py +18 -0
- junifer/external/BrainPrint/brainprint/utils/tests/__init__.py +0 -0
- junifer/external/BrainPrint/brainprint/utils/tests/test_config.py +33 -0
- junifer/external/BrainPrint/doc/Makefile +20 -0
- junifer/external/BrainPrint/doc/_static/.gitkeep +0 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/class.rst +10 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/function.rst +8 -0
- junifer/external/BrainPrint/doc/_templates/autosummary/module.rst +6 -0
- junifer/external/BrainPrint/doc/api/index.rst +11 -0
- junifer/external/BrainPrint/doc/conf.py +272 -0
- junifer/external/BrainPrint/doc/index.rst +140 -0
- junifer/external/BrainPrint/doc/links.inc +36 -0
- junifer/external/BrainPrint/doc/make.bat +35 -0
- junifer/external/BrainPrint/doc/references.bib +23 -0
- junifer/external/BrainPrint/pyproject.toml +170 -0
- junifer/external/BrainPrint/setup.py +3 -0
- junifer/external/__init__.py +5 -0
- junifer/external/__init__.pyi +0 -0
- junifer/external/nilearn/junifer_connectivity_measure.py +95 -39
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +226 -67
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +39 -27
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +231 -21
- junifer/external/py.typed +0 -0
- junifer/markers/__init__.pyi +6 -3
- junifer/markers/base.py +126 -76
- junifer/markers/brainprint.py +30 -39
- junifer/markers/complexity/__init__.py +20 -3
- junifer/markers/complexity/complexity_base.py +40 -41
- junifer/markers/complexity/hurst_exponent.py +22 -35
- junifer/markers/complexity/multiscale_entropy_auc.py +53 -41
- junifer/markers/complexity/perm_entropy.py +22 -36
- junifer/markers/complexity/range_entropy.py +22 -35
- junifer/markers/complexity/range_entropy_auc.py +27 -36
- junifer/markers/complexity/sample_entropy.py +22 -36
- junifer/markers/complexity/tests/test_complexity_registry.py +48 -0
- junifer/markers/complexity/tests/test_hurst_exponent.py +47 -36
- junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +50 -36
- junifer/markers/complexity/tests/test_perm_entropy.py +48 -36
- junifer/markers/complexity/tests/test_range_entropy.py +47 -36
- junifer/markers/complexity/tests/test_range_entropy_auc.py +47 -36
- junifer/markers/complexity/tests/test_sample_entropy.py +48 -36
- junifer/markers/complexity/tests/test_weighted_perm_entropy.py +50 -36
- junifer/markers/complexity/weighted_perm_entropy.py +22 -36
- junifer/markers/ets_rss.py +35 -31
- junifer/markers/falff/__init__.pyi +7 -1
- junifer/markers/falff/_afni_falff.py +22 -9
- junifer/markers/falff/_junifer_falff.py +47 -31
- junifer/markers/falff/falff_base.py +80 -60
- junifer/markers/falff/falff_maps.py +17 -41
- junifer/markers/falff/falff_parcels.py +26 -51
- junifer/markers/falff/falff_spheres.py +34 -61
- junifer/markers/falff/tests/test_falff_maps.py +20 -23
- junifer/markers/falff/tests/test_falff_mask.py +99 -0
- junifer/markers/falff/tests/test_falff_parcels.py +14 -10
- junifer/markers/falff/tests/test_falff_spheres.py +14 -10
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +32 -34
- junifer/markers/functional_connectivity/edge_functional_connectivity_maps.py +12 -25
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +19 -34
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +24 -44
- junifer/markers/functional_connectivity/functional_connectivity_base.py +50 -40
- junifer/markers/functional_connectivity/functional_connectivity_maps.py +12 -25
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +19 -34
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +24 -45
- junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +21 -22
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_maps.py +8 -7
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +8 -4
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +8 -4
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_maps.py +8 -7
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +9 -5
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +8 -12
- junifer/markers/maps_aggregation.py +77 -55
- junifer/markers/parcel_aggregation.py +91 -70
- junifer/markers/reho/__init__.pyi +7 -1
- junifer/markers/reho/_afni_reho.py +23 -14
- junifer/markers/reho/_junifer_reho.py +112 -123
- junifer/markers/reho/reho_base.py +115 -37
- junifer/markers/reho/reho_maps.py +18 -32
- junifer/markers/reho/reho_parcels.py +26 -41
- junifer/markers/reho/reho_spheres.py +33 -54
- junifer/markers/reho/tests/test_junifer_reho.py +178 -0
- junifer/markers/reho/tests/test_reho_maps.py +27 -25
- junifer/markers/reho/tests/test_reho_parcels.py +28 -22
- junifer/markers/reho/tests/test_reho_spheres.py +16 -12
- junifer/markers/sphere_aggregation.py +88 -72
- junifer/markers/temporal_snr/temporal_snr_base.py +32 -30
- junifer/markers/temporal_snr/temporal_snr_maps.py +9 -18
- junifer/markers/temporal_snr/temporal_snr_parcels.py +19 -27
- junifer/markers/temporal_snr/temporal_snr_spheres.py +27 -41
- junifer/markers/temporal_snr/tests/test_temporal_snr_base.py +2 -2
- junifer/markers/temporal_snr/tests/test_temporal_snr_maps.py +17 -22
- junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +11 -3
- junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +9 -9
- junifer/markers/tests/test_brainprint.py +10 -9
- junifer/markers/tests/test_ets_rss.py +7 -3
- junifer/markers/tests/test_lost_regions.py +279 -0
- junifer/markers/tests/test_maps_aggregation.py +67 -114
- junifer/markers/tests/test_marker_utils.py +40 -1
- junifer/markers/tests/test_markers_base.py +275 -6
- junifer/markers/tests/test_parcel_aggregation.py +91 -53
- junifer/markers/tests/test_sphere_aggregation.py +53 -47
- junifer/markers/utils.py +267 -5
- junifer/onthefly/__init__.py +2 -3
- junifer/onthefly/__init__.pyi +4 -0
- junifer/onthefly/_brainprint.py +3 -5
- junifer/onthefly/py.typed +0 -0
- junifer/onthefly/read_transform.py +11 -9
- junifer/onthefly/tests/test_read_transform.py +7 -7
- junifer/pipeline/__init__.pyi +4 -2
- junifer/pipeline/marker_collection.py +14 -10
- junifer/pipeline/pipeline_component_registry.py +25 -6
- junifer/pipeline/pipeline_step_mixin.py +5 -12
- junifer/pipeline/tests/test_data_object_dumper.py +10 -10
- junifer/pipeline/tests/test_marker_collection.py +145 -168
- junifer/pipeline/tests/test_pipeline_component_registry.py +52 -8
- junifer/pipeline/tests/test_pipeline_step_mixin.py +12 -26
- junifer/pipeline/tests/test_update_meta_mixin.py +4 -5
- junifer/pipeline/tests/test_workdir_manager.py +39 -0
- junifer/pipeline/update_meta_mixin.py +13 -10
- junifer/pipeline/utils.py +22 -17
- junifer/pipeline/workdir_manager.py +41 -32
- junifer/preprocess/__init__.pyi +9 -4
- junifer/preprocess/_temporal_filter.py +34 -33
- junifer/preprocess/_temporal_slicer.py +17 -30
- junifer/preprocess/base.py +99 -55
- junifer/preprocess/confounds/__init__.pyi +10 -2
- junifer/preprocess/confounds/fmriprep_confound_remover.py +87 -109
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +64 -45
- junifer/preprocess/smoothing/__init__.pyi +2 -2
- junifer/preprocess/smoothing/_afni_smoothing.py +8 -7
- junifer/preprocess/smoothing/_fsl_smoothing.py +6 -4
- junifer/preprocess/smoothing/_nilearn_smoothing.py +7 -5
- junifer/preprocess/smoothing/smoothing.py +59 -40
- junifer/preprocess/smoothing/tests/test_smoothing.py +28 -8
- junifer/preprocess/tests/test_preprocess_base.py +17 -9
- junifer/preprocess/tests/test_temporal_filter.py +37 -16
- junifer/preprocess/tests/test_temporal_slicer.py +12 -12
- junifer/preprocess/warping/__init__.pyi +2 -2
- junifer/preprocess/warping/_ants_warper.py +56 -40
- junifer/preprocess/warping/_fsl_warper.py +49 -36
- junifer/preprocess/warping/_utils.py +106 -0
- junifer/preprocess/warping/space_warper.py +99 -98
- junifer/preprocess/warping/tests/test_space_warper.py +46 -41
- junifer/preprocess/warping/tests/test_warping_utils.py +163 -0
- junifer/stats.py +46 -34
- junifer/storage/__init__.pyi +8 -4
- junifer/storage/base.py +129 -64
- junifer/storage/hdf5.py +307 -199
- junifer/storage/pandas_base.py +46 -24
- junifer/storage/sqlite.py +99 -62
- junifer/storage/tests/data/collected_h5io_fork.hdf5 +0 -0
- junifer/storage/tests/test_hdf5.py +147 -12
- junifer/storage/tests/test_repeated_storage.py +293 -0
- junifer/storage/tests/test_sqlite.py +9 -20
- junifer/storage/tests/test_storage_base.py +18 -21
- junifer/storage/tests/test_utils.py +83 -22
- junifer/storage/utils.py +58 -38
- junifer/testing/__init__.pyi +2 -2
- junifer/testing/datagrabbers.py +480 -44
- junifer/testing/registry.py +12 -0
- junifer/testing/tests/test_adhdtesting_datagrabber.py +24 -0
- junifer/testing/tests/test_oasisvmbtesting_datagrabber.py +5 -0
- junifer/testing/tests/test_partlycloudytesting_datagrabber.py +52 -0
- junifer/testing/tests/test_spmauditory_datagrabber.py +16 -0
- junifer/testing/tests/test_testing_registry.py +31 -0
- junifer/testing/tests/test_testing_utils.py +35 -0
- junifer/testing/tests/test_uclacnpvbmtesting_datagrabber.py +81 -0
- junifer/testing/utils.py +33 -1
- junifer/tests/test_stats.py +1 -5
- junifer/typing/__init__.pyi +2 -0
- junifer/typing/_typing.py +34 -19
- junifer/typing/py.typed +0 -0
- junifer/utils/__init__.pyi +10 -1
- junifer/utils/_config.py +1 -2
- junifer/utils/helpers.py +68 -2
- junifer/utils/logging.py +31 -7
- junifer/utils/tests/test_helpers.py +36 -1
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/METADATA +43 -35
- junifer-0.0.8.dist-info/RECORD +402 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/WHEEL +1 -1
- junifer/cli/tests/test_parser.py +0 -280
- junifer/external/h5io/h5io/__init__.py +0 -15
- junifer/external/h5io/h5io/_h5io.py +0 -767
- junifer/external/h5io/h5io/_version.py +0 -1
- junifer/external/h5io/h5io/chunked_array.py +0 -94
- junifer/external/h5io/h5io/chunked_list.py +0 -65
- junifer/markers/complexity/__init__.pyi +0 -17
- junifer-0.0.7.dev332.dist-info/RECORD +0 -353
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/AUTHORS.rst +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/LICENSE.md +0 -0
- {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/top_level.txt +0 -0
|
@@ -7,65 +7,65 @@ import shutil
|
|
|
7
7
|
import tempfile
|
|
8
8
|
from collections.abc import Iterable
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import Optional
|
|
11
10
|
|
|
11
|
+
import datalad.api as dl
|
|
12
12
|
import pytest
|
|
13
|
+
from pydantic import AnyUrl
|
|
13
14
|
|
|
14
15
|
from junifer.datagrabber import HCP1200, DataladHCP1200
|
|
16
|
+
from junifer.testing import config_override
|
|
15
17
|
from junifer.utils import configure_logging
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
URI = "https://gin.g-node.org/juaml/datalad-example-hcp1200"
|
|
19
|
-
|
|
20
|
-
|
|
21
20
|
@pytest.fixture(scope="module")
|
|
22
21
|
def hcpdg() -> Iterable[DataladHCP1200]:
|
|
23
22
|
"""Return a HCP1200 DataGrabber."""
|
|
24
23
|
tmpdir = Path(tempfile.gettempdir())
|
|
25
|
-
dg = DataladHCP1200(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
dg = DataladHCP1200(
|
|
25
|
+
uri=AnyUrl(
|
|
26
|
+
"https://cerebra.fz-juelich.de/junifer/datalad-example-hcp1200.git"
|
|
27
|
+
),
|
|
28
|
+
datadir=tmpdir / "hcp1200_test",
|
|
29
|
+
rootdir=Path("."),
|
|
30
|
+
)
|
|
31
|
+
with config_override("datagrabber.skipidcheck", True), dg:
|
|
31
32
|
for t_elem in dg.get_elements():
|
|
32
33
|
dg[t_elem]
|
|
33
34
|
yield dg
|
|
34
|
-
shutil.rmtree(tmpdir / "
|
|
35
|
+
shutil.rmtree(tmpdir / "hcp1200_test", ignore_errors=True)
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
@pytest.mark.parametrize(
|
|
38
39
|
"tasks, phase_encodings, ica_fix, expected_path_name",
|
|
39
40
|
[
|
|
40
|
-
(None, None, False, "rfMRI_REST1_LR.nii.gz"),
|
|
41
41
|
("REST1", "LR", False, "rfMRI_REST1_LR.nii.gz"),
|
|
42
|
-
("REST1", "RL", False, "rfMRI_REST1_RL.nii.gz"),
|
|
42
|
+
(["REST1"], ["RL"], False, "rfMRI_REST1_RL.nii.gz"),
|
|
43
43
|
("REST2", "LR", False, "rfMRI_REST2_LR.nii.gz"),
|
|
44
|
-
("REST2", "RL", False, "rfMRI_REST2_RL.nii.gz"),
|
|
44
|
+
(["REST2"], ["RL"], False, "rfMRI_REST2_RL.nii.gz"),
|
|
45
45
|
("SOCIAL", "LR", False, "tfMRI_SOCIAL_LR.nii.gz"),
|
|
46
|
-
("SOCIAL", "RL", False, "tfMRI_SOCIAL_RL.nii.gz"),
|
|
46
|
+
(["SOCIAL"], ["RL"], False, "tfMRI_SOCIAL_RL.nii.gz"),
|
|
47
47
|
("WM", "LR", False, "tfMRI_WM_LR.nii.gz"),
|
|
48
|
-
("WM", "RL", False, "tfMRI_WM_RL.nii.gz"),
|
|
48
|
+
(["WM"], ["RL"], False, "tfMRI_WM_RL.nii.gz"),
|
|
49
49
|
("RELATIONAL", "LR", False, "tfMRI_RELATIONAL_LR.nii.gz"),
|
|
50
|
-
("RELATIONAL", "RL", False, "tfMRI_RELATIONAL_RL.nii.gz"),
|
|
50
|
+
(["RELATIONAL"], ["RL"], False, "tfMRI_RELATIONAL_RL.nii.gz"),
|
|
51
51
|
("EMOTION", "LR", False, "tfMRI_EMOTION_LR.nii.gz"),
|
|
52
|
-
("EMOTION", "RL", False, "tfMRI_EMOTION_RL.nii.gz"),
|
|
52
|
+
(["EMOTION"], ["RL"], False, "tfMRI_EMOTION_RL.nii.gz"),
|
|
53
53
|
("LANGUAGE", "LR", False, "tfMRI_LANGUAGE_LR.nii.gz"),
|
|
54
|
-
("LANGUAGE", "RL", False, "tfMRI_LANGUAGE_RL.nii.gz"),
|
|
54
|
+
(["LANGUAGE"], ["RL"], False, "tfMRI_LANGUAGE_RL.nii.gz"),
|
|
55
55
|
("GAMBLING", "LR", False, "tfMRI_GAMBLING_LR.nii.gz"),
|
|
56
|
-
("GAMBLING", "RL", False, "tfMRI_GAMBLING_RL.nii.gz"),
|
|
56
|
+
(["GAMBLING"], ["RL"], False, "tfMRI_GAMBLING_RL.nii.gz"),
|
|
57
57
|
("MOTOR", "LR", False, "tfMRI_MOTOR_LR.nii.gz"),
|
|
58
|
-
("MOTOR", "RL", False, "tfMRI_MOTOR_RL.nii.gz"),
|
|
58
|
+
(["MOTOR"], ["RL"], False, "tfMRI_MOTOR_RL.nii.gz"),
|
|
59
59
|
("REST1", "LR", True, "rfMRI_REST1_LR_hp2000_clean.nii.gz"),
|
|
60
|
-
("REST1", "RL", True, "rfMRI_REST1_RL_hp2000_clean.nii.gz"),
|
|
60
|
+
(["REST1"], ["RL"], True, "rfMRI_REST1_RL_hp2000_clean.nii.gz"),
|
|
61
61
|
("REST2", "LR", True, "rfMRI_REST2_LR_hp2000_clean.nii.gz"),
|
|
62
|
-
("REST2", "RL", True, "rfMRI_REST2_RL_hp2000_clean.nii.gz"),
|
|
62
|
+
(["REST2"], ["RL"], True, "rfMRI_REST2_RL_hp2000_clean.nii.gz"),
|
|
63
63
|
],
|
|
64
64
|
)
|
|
65
65
|
def test_HCP1200(
|
|
66
66
|
hcpdg: DataladHCP1200,
|
|
67
|
-
tasks:
|
|
68
|
-
phase_encodings:
|
|
67
|
+
tasks: str | list[str],
|
|
68
|
+
phase_encodings: str | list[str],
|
|
69
69
|
ica_fix: bool,
|
|
70
70
|
expected_path_name: str,
|
|
71
71
|
) -> None:
|
|
@@ -76,9 +76,9 @@ def test_HCP1200(
|
|
|
76
76
|
hcpdg : DataladHCP1200
|
|
77
77
|
The Datalad version of the DataGrabber with the first subject
|
|
78
78
|
already cloned.
|
|
79
|
-
tasks : str
|
|
79
|
+
tasks : str or list of str
|
|
80
80
|
The parametrized tasks.
|
|
81
|
-
phase_encodings : str
|
|
81
|
+
phase_encodings : str or list of str
|
|
82
82
|
The parametrized phase encodings.
|
|
83
83
|
ica_fix : bool
|
|
84
84
|
The parametrized ICA-FIX flag.
|
|
@@ -119,29 +119,29 @@ def test_HCP1200(
|
|
|
119
119
|
"tasks, phase_encodings",
|
|
120
120
|
[
|
|
121
121
|
("REST1", "LR"),
|
|
122
|
-
("REST1", "RL"),
|
|
122
|
+
(["REST1"], ["RL"]),
|
|
123
123
|
("REST2", "LR"),
|
|
124
|
-
("REST2", "RL"),
|
|
124
|
+
(["REST2"], ["RL"]),
|
|
125
125
|
("SOCIAL", "LR"),
|
|
126
|
-
("SOCIAL", "RL"),
|
|
126
|
+
(["SOCIAL"], ["RL"]),
|
|
127
127
|
("WM", "LR"),
|
|
128
|
-
("WM", "RL"),
|
|
128
|
+
(["WM"], ["RL"]),
|
|
129
129
|
("RELATIONAL", "LR"),
|
|
130
|
-
("RELATIONAL", "RL"),
|
|
130
|
+
(["RELATIONAL"], ["RL"]),
|
|
131
131
|
("EMOTION", "LR"),
|
|
132
|
-
("EMOTION", "RL"),
|
|
132
|
+
(["EMOTION"], ["RL"]),
|
|
133
133
|
("LANGUAGE", "LR"),
|
|
134
|
-
("LANGUAGE", "RL"),
|
|
134
|
+
(["LANGUAGE"], ["RL"]),
|
|
135
135
|
("GAMBLING", "LR"),
|
|
136
|
-
("GAMBLING", "RL"),
|
|
136
|
+
(["GAMBLING"], ["RL"]),
|
|
137
137
|
("MOTOR", "LR"),
|
|
138
|
-
("MOTOR", "RL"),
|
|
138
|
+
(["MOTOR"], ["RL"]),
|
|
139
139
|
],
|
|
140
140
|
)
|
|
141
141
|
def test_HCP1200_single_access(
|
|
142
142
|
hcpdg: DataladHCP1200,
|
|
143
|
-
tasks:
|
|
144
|
-
phase_encodings:
|
|
143
|
+
tasks: str | list[str],
|
|
144
|
+
phase_encodings: str | list[str],
|
|
145
145
|
) -> None:
|
|
146
146
|
"""Test HCP1200 DataGrabber single access.
|
|
147
147
|
|
|
@@ -150,9 +150,9 @@ def test_HCP1200_single_access(
|
|
|
150
150
|
hcpdg : DataladHCP1200
|
|
151
151
|
The Datalad version of the DataGrabber with the first subject
|
|
152
152
|
already cloned.
|
|
153
|
-
tasks : str
|
|
153
|
+
tasks : str or list of str
|
|
154
154
|
The parametrized tasks.
|
|
155
|
-
phase_encodings : str
|
|
155
|
+
phase_encodings : str or list of str
|
|
156
156
|
The parametrized phase encodings.
|
|
157
157
|
|
|
158
158
|
"""
|
|
@@ -167,21 +167,16 @@ def test_HCP1200_single_access(
|
|
|
167
167
|
all_elements = dg.get_elements()
|
|
168
168
|
# Check only specified task and phase encoding are found
|
|
169
169
|
for element in all_elements:
|
|
170
|
-
assert element[1] == tasks
|
|
171
|
-
assert
|
|
170
|
+
assert element[1] == tasks if isinstance(tasks, str) else tasks[0]
|
|
171
|
+
assert (
|
|
172
|
+
element[2] == phase_encodings
|
|
173
|
+
if isinstance(phase_encodings, str)
|
|
174
|
+
else phase_encodings[0]
|
|
175
|
+
)
|
|
172
176
|
|
|
173
177
|
|
|
174
|
-
@pytest.mark.parametrize(
|
|
175
|
-
"tasks, phase_encodings",
|
|
176
|
-
[
|
|
177
|
-
(["REST1", "REST2"], ["LR", "RL"]),
|
|
178
|
-
(["REST1", "REST2"], None),
|
|
179
|
-
],
|
|
180
|
-
)
|
|
181
178
|
def test_HCP1200_multi_access(
|
|
182
179
|
hcpdg: DataladHCP1200,
|
|
183
|
-
tasks: Optional[str],
|
|
184
|
-
phase_encodings: Optional[str],
|
|
185
180
|
) -> None:
|
|
186
181
|
"""Test HCP1200 DataGrabber multiple access.
|
|
187
182
|
|
|
@@ -190,17 +185,13 @@ def test_HCP1200_multi_access(
|
|
|
190
185
|
hcpdg : DataladHCP1200
|
|
191
186
|
The Datalad version of the DataGrabber with the first subject
|
|
192
187
|
already cloned.
|
|
193
|
-
tasks : str
|
|
194
|
-
The parametrized tasks.
|
|
195
|
-
phase_encodings : str
|
|
196
|
-
The parametrized phase encodings.
|
|
197
188
|
|
|
198
189
|
"""
|
|
199
190
|
configure_logging(level="DEBUG")
|
|
200
191
|
dg = HCP1200(
|
|
201
192
|
datadir=hcpdg.datadir,
|
|
202
|
-
tasks=
|
|
203
|
-
phase_encodings=
|
|
193
|
+
tasks=["REST1", "REST2"],
|
|
194
|
+
phase_encodings=["LR", "RL"],
|
|
204
195
|
)
|
|
205
196
|
with dg:
|
|
206
197
|
# Get all elements
|
|
@@ -265,70 +256,6 @@ def test_HCP1200_multi_access_phase_simple(
|
|
|
265
256
|
assert element[2] == "LR"
|
|
266
257
|
|
|
267
258
|
|
|
268
|
-
@pytest.mark.parametrize(
|
|
269
|
-
"tasks, phase_encodings",
|
|
270
|
-
[
|
|
271
|
-
("FOO", ["LR", "RL"]),
|
|
272
|
-
("FOO", "RL"),
|
|
273
|
-
(["FOO", "BAR"], ["LR", "RL"]),
|
|
274
|
-
(["FOO", "BAR"], "LR"),
|
|
275
|
-
],
|
|
276
|
-
)
|
|
277
|
-
def test_HCP1200_incorrect_access_task(
|
|
278
|
-
tasks: Optional[str],
|
|
279
|
-
phase_encodings: Optional[str],
|
|
280
|
-
) -> None:
|
|
281
|
-
"""Test HCP1200 DataGrabber incorrect access for task.
|
|
282
|
-
|
|
283
|
-
Parameters
|
|
284
|
-
----------
|
|
285
|
-
tasks : str
|
|
286
|
-
The parametrized tasks.
|
|
287
|
-
phase_encodings : str
|
|
288
|
-
The parametrized phase encodings.
|
|
289
|
-
|
|
290
|
-
"""
|
|
291
|
-
configure_logging(level="DEBUG")
|
|
292
|
-
with pytest.raises(ValueError, match="not a valid HCP-YA fMRI task input"):
|
|
293
|
-
_ = HCP1200(
|
|
294
|
-
datadir=".",
|
|
295
|
-
tasks=tasks,
|
|
296
|
-
phase_encodings=phase_encodings,
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
@pytest.mark.parametrize(
|
|
301
|
-
"tasks, phase_encodings",
|
|
302
|
-
[
|
|
303
|
-
("REST1", ["FOO", "BAR"]),
|
|
304
|
-
("REST1", "FOO"),
|
|
305
|
-
(["REST1", "REST2"], ["FOO", "BAR"]),
|
|
306
|
-
(["REST1", "REST2"], "BAR"),
|
|
307
|
-
],
|
|
308
|
-
)
|
|
309
|
-
def test_HCP1200_incorrect_access_phase(
|
|
310
|
-
tasks: Optional[str],
|
|
311
|
-
phase_encodings: Optional[str],
|
|
312
|
-
) -> None:
|
|
313
|
-
"""Test HCP1200 DataGrabber incorrect access for phase.
|
|
314
|
-
|
|
315
|
-
Parameters
|
|
316
|
-
----------
|
|
317
|
-
tasks : str
|
|
318
|
-
The parametrized tasks.
|
|
319
|
-
phase_encodings : str
|
|
320
|
-
The parametrized phase encodings.
|
|
321
|
-
|
|
322
|
-
"""
|
|
323
|
-
configure_logging(level="DEBUG")
|
|
324
|
-
with pytest.raises(ValueError, match="not a valid HCP-YA phase encoding"):
|
|
325
|
-
_ = HCP1200(
|
|
326
|
-
datadir=".",
|
|
327
|
-
tasks=tasks,
|
|
328
|
-
phase_encodings=phase_encodings,
|
|
329
|
-
)
|
|
330
|
-
|
|
331
|
-
|
|
332
259
|
def test_HCP1200_elements(
|
|
333
260
|
hcpdg: DataladHCP1200,
|
|
334
261
|
) -> None:
|
|
@@ -364,23 +291,24 @@ def test_HCP1200_elements(
|
|
|
364
291
|
@pytest.mark.parametrize(
|
|
365
292
|
"tasks, ica_fix",
|
|
366
293
|
[
|
|
367
|
-
("SOCIAL", True),
|
|
294
|
+
(["SOCIAL"], True),
|
|
368
295
|
("WM", True),
|
|
369
|
-
("RELATIONAL", True),
|
|
296
|
+
(["RELATIONAL"], True),
|
|
370
297
|
("EMOTION", True),
|
|
371
|
-
("LANGUAGE", True),
|
|
298
|
+
(["LANGUAGE"], True),
|
|
372
299
|
("GAMBLING", True),
|
|
373
|
-
("MOTOR", True),
|
|
300
|
+
(["MOTOR"], True),
|
|
374
301
|
],
|
|
375
302
|
)
|
|
376
303
|
def test_HCP1200_incorrect_access_icafix(
|
|
377
|
-
tasks:
|
|
304
|
+
tasks: str | list[str],
|
|
305
|
+
ica_fix: bool,
|
|
378
306
|
) -> None:
|
|
379
307
|
"""Test HCP1200 DataGrabber incorrect access for icafix.
|
|
380
308
|
|
|
381
309
|
Parameters
|
|
382
310
|
----------
|
|
383
|
-
tasks : str
|
|
311
|
+
tasks : str or list of str
|
|
384
312
|
The parametrized tasks.
|
|
385
313
|
ica_fix : bool
|
|
386
314
|
The parametrized ICA-FIX flag.
|
|
@@ -389,7 +317,67 @@ def test_HCP1200_incorrect_access_icafix(
|
|
|
389
317
|
configure_logging(level="DEBUG")
|
|
390
318
|
with pytest.raises(ValueError, match="is only available for"):
|
|
391
319
|
_ = HCP1200(
|
|
392
|
-
datadir=".",
|
|
320
|
+
datadir=Path("."),
|
|
393
321
|
tasks=tasks,
|
|
394
322
|
ica_fix=ica_fix,
|
|
395
323
|
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def test_DataladHCP1200_subdatasets(tmp_path: Path) -> None:
|
|
327
|
+
"""Test DataladHCP1200 with a sub-dataset for each subject, as HCP.
|
|
328
|
+
|
|
329
|
+
Parameters
|
|
330
|
+
----------
|
|
331
|
+
tmp_path : pathlib.Path
|
|
332
|
+
The path to the test directory.
|
|
333
|
+
|
|
334
|
+
"""
|
|
335
|
+
dataset = dl.create(tmp_path / "origin", result_renderer="disabled")
|
|
336
|
+
for subject in ("100206", "100307"):
|
|
337
|
+
subdataset = dataset.create(subject, result_renderer="disabled")
|
|
338
|
+
for folder in ("rfMRI_REST1_LR", "tfMRI_WM_RL"):
|
|
339
|
+
path = (
|
|
340
|
+
subdataset.pathobj
|
|
341
|
+
/ "MNINonLinear"
|
|
342
|
+
/ "Results"
|
|
343
|
+
/ folder
|
|
344
|
+
/ f"{folder}.nii.gz"
|
|
345
|
+
)
|
|
346
|
+
path.parent.mkdir(parents=True)
|
|
347
|
+
path.write_text(f"{subject} {folder}")
|
|
348
|
+
path = subdataset.pathobj / "T1w" / "T1w_acpc_dc_restore.nii.gz"
|
|
349
|
+
path.parent.mkdir(parents=True)
|
|
350
|
+
path.write_text(f"{subject} T1w")
|
|
351
|
+
dataset.save(recursive=True, result_renderer="disabled")
|
|
352
|
+
dg = DataladHCP1200(
|
|
353
|
+
uri=AnyUrl(f"file://{dataset.path}"),
|
|
354
|
+
datadir=tmp_path / "clone",
|
|
355
|
+
rootdir=Path("."),
|
|
356
|
+
types=["BOLD", "T1w"],
|
|
357
|
+
tasks=["REST1", "WM"],
|
|
358
|
+
phase_encodings=["LR", "RL"],
|
|
359
|
+
)
|
|
360
|
+
with config_override("datagrabber.skipidcheck", True), dg:
|
|
361
|
+
# All the subjects with the tasks and phase encodings, without
|
|
362
|
+
# installing the sub-datasets
|
|
363
|
+
assert dg.get_elements() == [
|
|
364
|
+
(subject, task, phase_encoding)
|
|
365
|
+
for subject in ("100206", "100307")
|
|
366
|
+
for task in ("REST1", "WM")
|
|
367
|
+
for phase_encoding in ("LR", "RL")
|
|
368
|
+
]
|
|
369
|
+
assert not (dg.fulldir / "100206" / "T1w").exists()
|
|
370
|
+
out = dg[("100307", "WM", "RL")]
|
|
371
|
+
assert out["BOLD"]["path"].read_text() == "100307 tfMRI_WM_RL"
|
|
372
|
+
assert out["T1w"]["path"].read_text() == "100307 T1w"
|
|
373
|
+
out = dg[("100206", "REST1", "LR")]
|
|
374
|
+
assert out["BOLD"]["path"].read_text() == "100206 rfMRI_REST1_LR"
|
|
375
|
+
dg = DataladHCP1200(
|
|
376
|
+
uri=AnyUrl(f"file://{dataset.path}"),
|
|
377
|
+
datadir=tmp_path / "clone",
|
|
378
|
+
rootdir=Path("."),
|
|
379
|
+
types=["T1w"],
|
|
380
|
+
)
|
|
381
|
+
with config_override("datagrabber.skipidcheck", True), dg:
|
|
382
|
+
assert dg.get_elements() == ["100206", "100307"]
|
|
383
|
+
assert dg["100206"]["T1w"]["path"].read_text() == "100206 T1w"
|