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
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
|
7
7
|
# License: AGPL
|
|
8
8
|
|
|
9
|
-
from typing import
|
|
9
|
+
from typing import Annotated, Any
|
|
10
|
+
|
|
11
|
+
from pydantic import BeforeValidator
|
|
10
12
|
|
|
11
13
|
from ...api.decorators import register_marker
|
|
12
|
-
from ...
|
|
14
|
+
from ...datagrabber import DataType
|
|
15
|
+
from ...utils import ensure_list
|
|
16
|
+
from ..base import logger
|
|
13
17
|
from ..parcel_aggregation import ParcelAggregation
|
|
14
18
|
from .falff_base import ALFFBase
|
|
15
19
|
|
|
@@ -26,33 +30,27 @@ class ALFFParcels(ALFFBase):
|
|
|
26
30
|
parcellation : str or list of str
|
|
27
31
|
The name(s) of the parcellation(s) to use.
|
|
28
32
|
See :func:`.list_data` for options.
|
|
29
|
-
using :
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
using : :enum:`.ALFFImpl`
|
|
34
|
+
agg_method : str, optional
|
|
35
|
+
The aggregation function to use.
|
|
36
|
+
See :func:`.get_aggfunc_by_name` for options (default "mean").
|
|
37
|
+
agg_method_params : dict or None, optional
|
|
38
|
+
The parameters to pass to the aggregation function.
|
|
39
|
+
See :func:`.get_aggfunc_by_name` for valid options (default None).
|
|
35
40
|
highpass : positive float, optional
|
|
36
|
-
|
|
37
|
-
it will not apply a highpass filter (default 0.01).
|
|
41
|
+
Highpass cutoff frequency (default 0.01).
|
|
38
42
|
lowpass : positive float, optional
|
|
39
|
-
|
|
43
|
+
Lowpass cutoff frequency (default 0.1).
|
|
40
44
|
tr : positive float, optional
|
|
41
|
-
The
|
|
42
|
-
the TR from NIfTI header (default None).
|
|
43
|
-
|
|
44
|
-
The method to perform aggregation using. Check valid options in
|
|
45
|
-
:func:`.get_aggfunc_by_name` (default "mean").
|
|
46
|
-
agg_method_params : dict, optional
|
|
47
|
-
Parameters to pass to the aggregation function. Check valid options in
|
|
48
|
-
:func:`.get_aggfunc_by_name` (default None).
|
|
49
|
-
masks : str, dict or list of dict or str, optional
|
|
45
|
+
The repetition time of the BOLD data.
|
|
46
|
+
If None, will extract the TR from NIfTI header (default None).
|
|
47
|
+
masks : str, dict, list of them or None, optional
|
|
50
48
|
The specification of the masks to apply to regions before extracting
|
|
51
49
|
signals. Check :ref:`Using Masks <using_masks>` for more details.
|
|
52
50
|
If None, will not apply any mask (default None).
|
|
53
|
-
name : str, optional
|
|
54
|
-
The name of the marker.
|
|
55
|
-
None).
|
|
51
|
+
name : str or None, optional
|
|
52
|
+
The name of the marker.
|
|
53
|
+
If None, will use the class name (default None).
|
|
56
54
|
|
|
57
55
|
Notes
|
|
58
56
|
-----
|
|
@@ -68,35 +66,12 @@ class ALFFParcels(ALFFBase):
|
|
|
68
66
|
|
|
69
67
|
"""
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
self,
|
|
73
|
-
parcellation: Union[str, list[str]],
|
|
74
|
-
using: str,
|
|
75
|
-
highpass: float = 0.01,
|
|
76
|
-
lowpass: float = 0.1,
|
|
77
|
-
tr: Optional[float] = None,
|
|
78
|
-
agg_method: str = "mean",
|
|
79
|
-
agg_method_params: Optional[dict] = None,
|
|
80
|
-
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
|
81
|
-
name: Optional[str] = None,
|
|
82
|
-
) -> None:
|
|
83
|
-
# Superclass init first to validate `using` parameter
|
|
84
|
-
super().__init__(
|
|
85
|
-
highpass=highpass,
|
|
86
|
-
lowpass=lowpass,
|
|
87
|
-
using=using,
|
|
88
|
-
tr=tr,
|
|
89
|
-
name=name,
|
|
90
|
-
)
|
|
91
|
-
self.parcellation = parcellation
|
|
92
|
-
self.agg_method = agg_method
|
|
93
|
-
self.agg_method_params = agg_method_params
|
|
94
|
-
self.masks = masks
|
|
69
|
+
parcellation: Annotated[str | list[str], BeforeValidator(ensure_list)]
|
|
95
70
|
|
|
96
71
|
def compute(
|
|
97
72
|
self,
|
|
98
73
|
input: dict[str, Any],
|
|
99
|
-
extra_input:
|
|
74
|
+
extra_input: dict[str, Any] | None = None,
|
|
100
75
|
) -> dict[str, Any]:
|
|
101
76
|
"""Compute.
|
|
102
77
|
|
|
@@ -129,7 +104,7 @@ class ALFFParcels(ALFFBase):
|
|
|
129
104
|
|
|
130
105
|
# Compute ALFF + fALFF
|
|
131
106
|
alff_output, falff_output, alff_output_path, falff_output_path = (
|
|
132
|
-
self._compute(input_data=input)
|
|
107
|
+
self._compute(input_data=input, extra_input=extra_input)
|
|
133
108
|
)
|
|
134
109
|
|
|
135
110
|
# Perform aggregation on ALFF + fALFF
|
|
@@ -147,7 +122,7 @@ class ALFFParcels(ALFFBase):
|
|
|
147
122
|
method=self.agg_method,
|
|
148
123
|
method_params=self.agg_method_params,
|
|
149
124
|
masks=self.masks,
|
|
150
|
-
on=
|
|
125
|
+
on=DataType.BOLD,
|
|
151
126
|
).compute(
|
|
152
127
|
input=aggregation_alff_input,
|
|
153
128
|
extra_input=extra_input,
|
|
@@ -159,7 +134,7 @@ class ALFFParcels(ALFFBase):
|
|
|
159
134
|
method=self.agg_method,
|
|
160
135
|
method_params=self.agg_method_params,
|
|
161
136
|
masks=self.masks,
|
|
162
|
-
on=
|
|
137
|
+
on=DataType.BOLD,
|
|
163
138
|
).compute(
|
|
164
139
|
input=aggregation_falff_input,
|
|
165
140
|
extra_input=extra_input,
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
|
7
7
|
# License: AGPL
|
|
8
8
|
|
|
9
|
-
from typing import Any,
|
|
9
|
+
from typing import Any, Literal
|
|
10
|
+
|
|
11
|
+
from pydantic import PositiveFloat
|
|
10
12
|
|
|
11
13
|
from ...api.decorators import register_marker
|
|
12
|
-
from ...
|
|
14
|
+
from ...datagrabber import DataType
|
|
15
|
+
from ..base import logger
|
|
13
16
|
from ..sphere_aggregation import SphereAggregation
|
|
14
17
|
from .falff_base import ALFFBase
|
|
15
18
|
|
|
@@ -26,40 +29,35 @@ class ALFFSpheres(ALFFBase):
|
|
|
26
29
|
coords : str
|
|
27
30
|
The name of the coordinates list to use.
|
|
28
31
|
See :func:`.list_data` for options.
|
|
29
|
-
using :
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
radius : float, optional
|
|
36
|
-
The radius of the sphere in mm. If None, the signal will be extracted
|
|
37
|
-
from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker`
|
|
38
|
-
for more information (default None).
|
|
32
|
+
using : :enum:`.ALFFImpl`
|
|
33
|
+
radius : ``zero`` or positive float or None, optional
|
|
34
|
+
The radius of the sphere in millimetres.
|
|
35
|
+
If None, the signal will be extracted from a single voxel.
|
|
36
|
+
See :class:`.JuniferNiftiSpheresMasker` for more information
|
|
37
|
+
(default None).
|
|
39
38
|
allow_overlap : bool, optional
|
|
40
|
-
Whether to allow overlapping spheres.
|
|
41
|
-
the spheres overlap (default
|
|
39
|
+
Whether to allow overlapping spheres.
|
|
40
|
+
If False, an error is raised if the spheres overlap (default False).
|
|
41
|
+
agg_method : str, optional
|
|
42
|
+
The aggregation function to use.
|
|
43
|
+
See :func:`.get_aggfunc_by_name` for options (default "mean").
|
|
44
|
+
agg_method_params : dict or None, optional
|
|
45
|
+
The parameters to pass to the aggregation function.
|
|
46
|
+
See :func:`.get_aggfunc_by_name` for valid options (default None).
|
|
42
47
|
highpass : positive float, optional
|
|
43
|
-
|
|
44
|
-
it will not apply a highpass filter (default 0.01).
|
|
48
|
+
Highpass cutoff frequency (default 0.01).
|
|
45
49
|
lowpass : positive float, optional
|
|
46
|
-
|
|
50
|
+
Lowpass cutoff frequency (default 0.1).
|
|
47
51
|
tr : positive float, optional
|
|
48
|
-
The
|
|
49
|
-
the TR from NIfTI header (default None).
|
|
50
|
-
|
|
51
|
-
The method to perform aggregation using. Check valid options in
|
|
52
|
-
:func:`.get_aggfunc_by_name` (default "mean").
|
|
53
|
-
agg_method_params : dict, optional
|
|
54
|
-
Parameters to pass to the aggregation function. Check valid options in
|
|
55
|
-
:func:`.get_aggfunc_by_name`.
|
|
56
|
-
masks : str, dict or list of dict or str, optional
|
|
52
|
+
The repetition time of the BOLD data.
|
|
53
|
+
If None, will extract the TR from NIfTI header (default None).
|
|
54
|
+
masks : str, dict, list of them or None, optional
|
|
57
55
|
The specification of the masks to apply to regions before extracting
|
|
58
56
|
signals. Check :ref:`Using Masks <using_masks>` for more details.
|
|
59
57
|
If None, will not apply any mask (default None).
|
|
60
|
-
name : str, optional
|
|
61
|
-
The name of the marker.
|
|
62
|
-
None).
|
|
58
|
+
name : str or None, optional
|
|
59
|
+
The name of the marker.
|
|
60
|
+
If None, will use the class name (default None).
|
|
63
61
|
|
|
64
62
|
Notes
|
|
65
63
|
-----
|
|
@@ -75,39 +73,14 @@ class ALFFSpheres(ALFFBase):
|
|
|
75
73
|
|
|
76
74
|
"""
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
using: str,
|
|
82
|
-
radius: Optional[float] = None,
|
|
83
|
-
allow_overlap: bool = False,
|
|
84
|
-
highpass: float = 0.01,
|
|
85
|
-
lowpass: float = 0.1,
|
|
86
|
-
tr: Optional[float] = None,
|
|
87
|
-
agg_method: str = "mean",
|
|
88
|
-
agg_method_params: Optional[dict] = None,
|
|
89
|
-
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
|
90
|
-
name: Optional[str] = None,
|
|
91
|
-
) -> None:
|
|
92
|
-
# Superclass init first to validate `using` parameter
|
|
93
|
-
super().__init__(
|
|
94
|
-
highpass=highpass,
|
|
95
|
-
lowpass=lowpass,
|
|
96
|
-
using=using,
|
|
97
|
-
tr=tr,
|
|
98
|
-
name=name,
|
|
99
|
-
)
|
|
100
|
-
self.coords = coords
|
|
101
|
-
self.radius = radius
|
|
102
|
-
self.allow_overlap = allow_overlap
|
|
103
|
-
self.agg_method = agg_method
|
|
104
|
-
self.agg_method_params = agg_method_params
|
|
105
|
-
self.masks = masks
|
|
76
|
+
coords: str
|
|
77
|
+
radius: Literal[0] | PositiveFloat | None = None
|
|
78
|
+
allow_overlap: bool = False
|
|
106
79
|
|
|
107
80
|
def compute(
|
|
108
81
|
self,
|
|
109
82
|
input: dict[str, Any],
|
|
110
|
-
extra_input:
|
|
83
|
+
extra_input: dict[str, Any] | None = None,
|
|
111
84
|
) -> dict[str, Any]:
|
|
112
85
|
"""Compute.
|
|
113
86
|
|
|
@@ -140,7 +113,7 @@ class ALFFSpheres(ALFFBase):
|
|
|
140
113
|
|
|
141
114
|
# Compute ALFF + fALFF
|
|
142
115
|
alff_output, falff_output, alff_output_path, falff_output_path = (
|
|
143
|
-
self._compute(input_data=input)
|
|
116
|
+
self._compute(input_data=input, extra_input=extra_input)
|
|
144
117
|
)
|
|
145
118
|
|
|
146
119
|
# Perform aggregation on ALFF / fALFF
|
|
@@ -160,7 +133,7 @@ class ALFFSpheres(ALFFBase):
|
|
|
160
133
|
method=self.agg_method,
|
|
161
134
|
method_params=self.agg_method_params,
|
|
162
135
|
masks=self.masks,
|
|
163
|
-
on=
|
|
136
|
+
on=DataType.BOLD,
|
|
164
137
|
).compute(
|
|
165
138
|
input=aggregation_alff_input,
|
|
166
139
|
extra_input=extra_input,
|
|
@@ -174,7 +147,7 @@ class ALFFSpheres(ALFFBase):
|
|
|
174
147
|
method=self.agg_method,
|
|
175
148
|
method_params=self.agg_method_params,
|
|
176
149
|
masks=self.masks,
|
|
177
|
-
on=
|
|
150
|
+
on=DataType.BOLD,
|
|
178
151
|
).compute(
|
|
179
152
|
input=aggregation_falff_input,
|
|
180
153
|
extra_input=extra_input,
|
|
@@ -7,14 +7,18 @@ import logging
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
|
-
import scipy as
|
|
10
|
+
import scipy.stats as sps
|
|
11
11
|
|
|
12
|
-
from junifer.datagrabber import
|
|
12
|
+
from junifer.datagrabber import DataType
|
|
13
13
|
from junifer.datareader import DefaultDataReader
|
|
14
|
-
from junifer.markers import ALFFMaps
|
|
14
|
+
from junifer.markers import ALFFImpl, ALFFMaps
|
|
15
15
|
from junifer.pipeline import WorkDirManager
|
|
16
16
|
from junifer.pipeline.utils import _check_afni
|
|
17
17
|
from junifer.storage import HDF5FeatureStorage
|
|
18
|
+
from junifer.testing.datagrabbers import ADHDTestingDataGrabber
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
pytestmark = pytest.mark.external
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
MAPS = "Smith_rsn_10"
|
|
@@ -38,14 +42,13 @@ def test_ALFFMaps_storage_type(feature: str) -> None:
|
|
|
38
42
|
"""
|
|
39
43
|
assert "vector" == ALFFMaps(
|
|
40
44
|
maps=MAPS,
|
|
41
|
-
using=
|
|
42
|
-
).storage_type(input_type=
|
|
45
|
+
using=ALFFImpl.junifer,
|
|
46
|
+
).storage_type(input_type=DataType.BOLD, output_feature=feature)
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
def test_ALFFMaps(
|
|
46
50
|
caplog: pytest.LogCaptureFixture,
|
|
47
51
|
tmp_path: Path,
|
|
48
|
-
maps_datagrabber: PatternDataladDataGrabber,
|
|
49
52
|
) -> None:
|
|
50
53
|
"""Test ALFFMaps.
|
|
51
54
|
|
|
@@ -55,27 +58,25 @@ def test_ALFFMaps(
|
|
|
55
58
|
The pytest.LogCaptureFixture object.
|
|
56
59
|
tmp_path : pathlib.Path
|
|
57
60
|
The path to the test directory.
|
|
58
|
-
maps_datagrabber : PatternDataladDataGrabber
|
|
59
|
-
The testing PatternDataladDataGrabber, as fixture.
|
|
60
61
|
|
|
61
62
|
"""
|
|
62
63
|
# Update workdir to current test's tmp_path
|
|
63
64
|
WorkDirManager().workdir = tmp_path
|
|
64
65
|
|
|
65
66
|
with caplog.at_level(logging.DEBUG):
|
|
66
|
-
with
|
|
67
|
-
element = dg[
|
|
67
|
+
with ADHDTestingDataGrabber() as dg:
|
|
68
|
+
element = dg["sub-01"]
|
|
68
69
|
element_data = DefaultDataReader().fit_transform(element)
|
|
69
70
|
|
|
70
71
|
# Initialize marker
|
|
71
72
|
marker = ALFFMaps(
|
|
72
73
|
maps=MAPS,
|
|
73
|
-
using=
|
|
74
|
+
using=ALFFImpl.junifer,
|
|
74
75
|
)
|
|
75
76
|
# Check correct output
|
|
76
77
|
for name in ["alff", "falff"]:
|
|
77
78
|
assert "vector" == marker.storage_type(
|
|
78
|
-
input_type=
|
|
79
|
+
input_type=DataType.BOLD, output_feature=name
|
|
79
80
|
)
|
|
80
81
|
|
|
81
82
|
# Fit transform marker on data
|
|
@@ -99,7 +100,7 @@ def test_ALFFMaps(
|
|
|
99
100
|
# Reset log capture
|
|
100
101
|
caplog.clear()
|
|
101
102
|
# Initialize storage
|
|
102
|
-
storage = HDF5FeatureStorage(tmp_path / "falff_maps.hdf5")
|
|
103
|
+
storage = HDF5FeatureStorage(uri=tmp_path / "falff_maps.hdf5")
|
|
103
104
|
# Fit transform marker on data with storage
|
|
104
105
|
marker.fit_transform(
|
|
105
106
|
input=element_data,
|
|
@@ -118,30 +119,26 @@ def test_ALFFMaps(
|
|
|
118
119
|
@pytest.mark.skipif(
|
|
119
120
|
_check_afni() is False, reason="requires AFNI to be in PATH"
|
|
120
121
|
)
|
|
121
|
-
def test_ALFFMaps_comparison(
|
|
122
|
-
tmp_path: Path, maps_datagrabber: PatternDataladDataGrabber
|
|
123
|
-
) -> None:
|
|
122
|
+
def test_ALFFMaps_comparison(tmp_path: Path) -> None:
|
|
124
123
|
"""Test ALFFMaps implementation comparison.
|
|
125
124
|
|
|
126
125
|
Parameters
|
|
127
126
|
----------
|
|
128
127
|
tmp_path : pathlib.Path
|
|
129
128
|
The path to the test directory.
|
|
130
|
-
maps_datagrabber : PatternDataladDataGrabber
|
|
131
|
-
The testing PatternDataladDataGrabber, as fixture.
|
|
132
129
|
|
|
133
130
|
"""
|
|
134
131
|
# Update workdir to current test's tmp_path
|
|
135
132
|
WorkDirManager().workdir = tmp_path
|
|
136
133
|
|
|
137
|
-
with
|
|
138
|
-
element = dg[
|
|
134
|
+
with ADHDTestingDataGrabber() as dg:
|
|
135
|
+
element = dg["sub-01"]
|
|
139
136
|
element_data = DefaultDataReader().fit_transform(element)
|
|
140
137
|
|
|
141
138
|
# Initialize marker
|
|
142
139
|
junifer_marker = ALFFMaps(
|
|
143
140
|
maps=MAPS,
|
|
144
|
-
using=
|
|
141
|
+
using=ALFFImpl.junifer,
|
|
145
142
|
)
|
|
146
143
|
# Fit transform marker on data
|
|
147
144
|
junifer_output = junifer_marker.fit_transform(element_data)
|
|
@@ -151,7 +148,7 @@ def test_ALFFMaps_comparison(
|
|
|
151
148
|
# Initialize marker
|
|
152
149
|
afni_marker = ALFFMaps(
|
|
153
150
|
maps=MAPS,
|
|
154
|
-
using=
|
|
151
|
+
using=ALFFImpl.afni,
|
|
155
152
|
)
|
|
156
153
|
# Fit transform marker on data
|
|
157
154
|
afni_output = afni_marker.fit_transform(element_data)
|
|
@@ -160,7 +157,7 @@ def test_ALFFMaps_comparison(
|
|
|
160
157
|
|
|
161
158
|
for feature in afni_output_bold.keys():
|
|
162
159
|
# Check for Pearson correlation coefficient
|
|
163
|
-
r, _ =
|
|
160
|
+
r, _ = sps.pearsonr(
|
|
164
161
|
junifer_output_bold[feature]["data"][0],
|
|
165
162
|
afni_output_bold[feature]["data"][0],
|
|
166
163
|
)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Provide tests for the ALFF and fALFF computation with masks."""
|
|
2
|
+
|
|
3
|
+
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
|
4
|
+
# License: AGPL
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import nibabel as nib
|
|
9
|
+
import numpy as np
|
|
10
|
+
import pytest
|
|
11
|
+
from numpy.testing import assert_allclose, assert_array_equal
|
|
12
|
+
|
|
13
|
+
from junifer.markers.falff._afni_falff import AFNIALFF
|
|
14
|
+
from junifer.markers.falff._junifer_falff import JuniferALFF
|
|
15
|
+
from junifer.pipeline import WorkDirManager
|
|
16
|
+
from junifer.pipeline.utils import _check_afni
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _save(data: np.ndarray, path: Path, tr: float = 2.0) -> Path:
|
|
20
|
+
"""Save data as NIfTI, with the TR in the header for 4D data."""
|
|
21
|
+
img = nib.Nifti1Image(data, np.eye(4))
|
|
22
|
+
if data.ndim == 4:
|
|
23
|
+
img.header.set_zooms((1.0, 1.0, 1.0, tr))
|
|
24
|
+
nib.save(img, path)
|
|
25
|
+
return path
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _data(tmp_path: Path) -> tuple[Path, Path, np.ndarray]:
|
|
29
|
+
"""Create BOLD data and a mask of half of the voxels."""
|
|
30
|
+
data = np.random.default_rng(0).normal(size=(6, 6, 6, 100)) + 100
|
|
31
|
+
bold_path = _save(data.astype(np.float32), tmp_path / "bold.nii")
|
|
32
|
+
mask = np.zeros((6, 6, 6), dtype=np.uint8)
|
|
33
|
+
mask[3:] = 1
|
|
34
|
+
mask_path = _save(mask, tmp_path / "mask.nii")
|
|
35
|
+
return bold_path, mask_path, mask.astype(bool)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.mark.parametrize(
|
|
39
|
+
"estimator",
|
|
40
|
+
[
|
|
41
|
+
JuniferALFF,
|
|
42
|
+
pytest.param(
|
|
43
|
+
AFNIALFF,
|
|
44
|
+
marks=pytest.mark.skipif(
|
|
45
|
+
_check_afni() is False, reason="requires AFNI to be in PATH"
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
],
|
|
49
|
+
)
|
|
50
|
+
def test_ALFF_mask(
|
|
51
|
+
estimator: type[JuniferALFF | AFNIALFF], tmp_path: Path
|
|
52
|
+
) -> None:
|
|
53
|
+
"""Test the ALFF and fALFF computation is restricted to the mask.
|
|
54
|
+
|
|
55
|
+
The values are computed for each voxel, so inside the mask they are the
|
|
56
|
+
same as without mask, and outside the mask they are 0.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
estimator : JuniferALFF or AFNIALFF
|
|
61
|
+
The ALFF estimator to test.
|
|
62
|
+
tmp_path : pathlib.Path
|
|
63
|
+
The path to the test directory.
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
WorkDirManager().workdir = tmp_path
|
|
67
|
+
bold_path, mask_path, mask = _data(tmp_path)
|
|
68
|
+
kwargs = {"highpass": 0.01, "lowpass": 0.1, "tr": 2.0}
|
|
69
|
+
masked = estimator().compute(bold_path, mask_path=mask_path, **kwargs)
|
|
70
|
+
unmasked = estimator().compute(bold_path, **kwargs)
|
|
71
|
+
for i_map in range(2): # ALFF and fALFF
|
|
72
|
+
t_masked = masked[i_map].get_fdata()
|
|
73
|
+
t_unmasked = unmasked[i_map].get_fdata()
|
|
74
|
+
assert_array_equal(t_masked[~mask], 0)
|
|
75
|
+
assert (t_masked[mask] > 0).all()
|
|
76
|
+
assert_allclose(t_masked[mask], t_unmasked[mask], rtol=1e-6)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@pytest.mark.skipif(
|
|
80
|
+
_check_afni() is False, reason="requires AFNI to be in PATH"
|
|
81
|
+
)
|
|
82
|
+
def test_AFNIALFF_no_time_series(tmp_path: Path) -> None:
|
|
83
|
+
"""Test 3dRSFC does not output the bandpassed time series.
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
tmp_path : pathlib.Path
|
|
88
|
+
The path to the test directory.
|
|
89
|
+
|
|
90
|
+
"""
|
|
91
|
+
WorkDirManager().workdir = tmp_path
|
|
92
|
+
bold_path, mask_path, _ = _data(tmp_path)
|
|
93
|
+
alff_path = AFNIALFF().compute(
|
|
94
|
+
bold_path, highpass=0.01, lowpass=0.1, tr=2.0, mask_path=mask_path
|
|
95
|
+
)[2]
|
|
96
|
+
# Only the parameters (ALFF, fALFF and mALFF) are in the output directory
|
|
97
|
+
outputs = {x.name for x in alff_path.parent.iterdir()}
|
|
98
|
+
assert not any("_LFF+" in x for x in outputs)
|
|
99
|
+
assert any("_ALFF+" in x for x in outputs)
|
|
@@ -8,16 +8,20 @@ import logging
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
|
-
import scipy as
|
|
11
|
+
import scipy.stats as sps
|
|
12
12
|
|
|
13
|
+
from junifer.datagrabber import DataType
|
|
13
14
|
from junifer.datareader import DefaultDataReader
|
|
14
|
-
from junifer.markers
|
|
15
|
+
from junifer.markers import ALFFImpl, ALFFParcels
|
|
15
16
|
from junifer.pipeline import WorkDirManager
|
|
16
17
|
from junifer.pipeline.utils import _check_afni
|
|
17
|
-
from junifer.storage import
|
|
18
|
+
from junifer.storage import HDF5FeatureStorage
|
|
18
19
|
from junifer.testing.datagrabbers import PartlyCloudyTestingDataGrabber
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
pytestmark = pytest.mark.external
|
|
23
|
+
|
|
24
|
+
|
|
21
25
|
PARCELLATION = "TianxS1x3TxMNInonlinear2009cAsym"
|
|
22
26
|
|
|
23
27
|
|
|
@@ -39,8 +43,8 @@ def test_ALFFParcels_storage_type(feature: str) -> None:
|
|
|
39
43
|
"""
|
|
40
44
|
assert "vector" == ALFFParcels(
|
|
41
45
|
parcellation=PARCELLATION,
|
|
42
|
-
using=
|
|
43
|
-
).storage_type(input_type=
|
|
46
|
+
using=ALFFImpl.junifer,
|
|
47
|
+
).storage_type(input_type=DataType.BOLD, output_feature=feature)
|
|
44
48
|
|
|
45
49
|
|
|
46
50
|
def test_ALFFParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
@@ -63,7 +67,7 @@ def test_ALFFParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
|
63
67
|
# Initialize marker
|
|
64
68
|
marker = ALFFParcels(
|
|
65
69
|
parcellation=PARCELLATION,
|
|
66
|
-
using=
|
|
70
|
+
using=ALFFImpl.junifer,
|
|
67
71
|
)
|
|
68
72
|
# Fit transform marker on data
|
|
69
73
|
output = marker.fit_transform(element_data)
|
|
@@ -86,7 +90,7 @@ def test_ALFFParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
|
86
90
|
# Reset log capture
|
|
87
91
|
caplog.clear()
|
|
88
92
|
# Initialize storage
|
|
89
|
-
storage =
|
|
93
|
+
storage = HDF5FeatureStorage(uri=tmp_path / "falff_parcels.hdf5")
|
|
90
94
|
# Fit transform marker on data with storage
|
|
91
95
|
marker.fit_transform(
|
|
92
96
|
input=element_data,
|
|
@@ -116,7 +120,7 @@ def test_ALFFParcels_comparison(tmp_path: Path) -> None:
|
|
|
116
120
|
# Initialize marker
|
|
117
121
|
junifer_marker = ALFFParcels(
|
|
118
122
|
parcellation=PARCELLATION,
|
|
119
|
-
using=
|
|
123
|
+
using=ALFFImpl.junifer,
|
|
120
124
|
)
|
|
121
125
|
# Fit transform marker on data
|
|
122
126
|
junifer_output = junifer_marker.fit_transform(element_data)
|
|
@@ -126,7 +130,7 @@ def test_ALFFParcels_comparison(tmp_path: Path) -> None:
|
|
|
126
130
|
# Initialize marker
|
|
127
131
|
afni_marker = ALFFParcels(
|
|
128
132
|
parcellation=PARCELLATION,
|
|
129
|
-
using=
|
|
133
|
+
using=ALFFImpl.afni,
|
|
130
134
|
)
|
|
131
135
|
# Fit transform marker on data
|
|
132
136
|
afni_output = afni_marker.fit_transform(element_data)
|
|
@@ -135,7 +139,7 @@ def test_ALFFParcels_comparison(tmp_path: Path) -> None:
|
|
|
135
139
|
|
|
136
140
|
for feature in afni_output_bold.keys():
|
|
137
141
|
# Check for Pearson correlation coefficient
|
|
138
|
-
r, _ =
|
|
142
|
+
r, _ = sps.pearsonr(
|
|
139
143
|
junifer_output_bold[feature]["data"][0],
|
|
140
144
|
afni_output_bold[feature]["data"][0],
|
|
141
145
|
)
|
|
@@ -8,16 +8,20 @@ import logging
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
|
-
import scipy as
|
|
11
|
+
import scipy.stats as sps
|
|
12
12
|
|
|
13
|
+
from junifer.datagrabber import DataType
|
|
13
14
|
from junifer.datareader import DefaultDataReader
|
|
14
|
-
from junifer.markers
|
|
15
|
+
from junifer.markers import ALFFImpl, ALFFSpheres
|
|
15
16
|
from junifer.pipeline import WorkDirManager
|
|
16
17
|
from junifer.pipeline.utils import _check_afni
|
|
17
|
-
from junifer.storage import
|
|
18
|
+
from junifer.storage import HDF5FeatureStorage
|
|
18
19
|
from junifer.testing.datagrabbers import PartlyCloudyTestingDataGrabber
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
pytestmark = pytest.mark.external
|
|
23
|
+
|
|
24
|
+
|
|
21
25
|
COORDINATES = "DMNBuckner"
|
|
22
26
|
|
|
23
27
|
|
|
@@ -39,8 +43,8 @@ def test_ALFFSpheres_storage_type(feature: str) -> None:
|
|
|
39
43
|
"""
|
|
40
44
|
assert "vector" == ALFFSpheres(
|
|
41
45
|
coords=COORDINATES,
|
|
42
|
-
using=
|
|
43
|
-
).storage_type(input_type=
|
|
46
|
+
using=ALFFImpl.junifer,
|
|
47
|
+
).storage_type(input_type=DataType.BOLD, output_feature=feature)
|
|
44
48
|
|
|
45
49
|
|
|
46
50
|
def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
@@ -63,7 +67,7 @@ def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
|
63
67
|
# Initialize marker
|
|
64
68
|
marker = ALFFSpheres(
|
|
65
69
|
coords=COORDINATES,
|
|
66
|
-
using=
|
|
70
|
+
using=ALFFImpl.junifer,
|
|
67
71
|
radius=5.0,
|
|
68
72
|
)
|
|
69
73
|
# Fit transform marker on data
|
|
@@ -89,7 +93,7 @@ def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
|
89
93
|
# Reset log capture
|
|
90
94
|
caplog.clear()
|
|
91
95
|
# Initialize storage
|
|
92
|
-
storage =
|
|
96
|
+
storage = HDF5FeatureStorage(uri=tmp_path / "falff_spheres.hdf5")
|
|
93
97
|
# Fit transform marker on data with storage
|
|
94
98
|
marker.fit_transform(
|
|
95
99
|
input=element_data,
|
|
@@ -119,7 +123,7 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
|
119
123
|
# Initialize marker
|
|
120
124
|
junifer_marker = ALFFSpheres(
|
|
121
125
|
coords=COORDINATES,
|
|
122
|
-
using=
|
|
126
|
+
using=ALFFImpl.junifer,
|
|
123
127
|
radius=5.0,
|
|
124
128
|
)
|
|
125
129
|
# Fit transform marker on data
|
|
@@ -130,7 +134,7 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
|
130
134
|
# Initialize marker
|
|
131
135
|
afni_marker = ALFFSpheres(
|
|
132
136
|
coords=COORDINATES,
|
|
133
|
-
using=
|
|
137
|
+
using=ALFFImpl.afni,
|
|
134
138
|
radius=5.0,
|
|
135
139
|
)
|
|
136
140
|
# Fit transform marker on data
|
|
@@ -140,7 +144,7 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
|
140
144
|
|
|
141
145
|
for feature in afni_output_bold.keys():
|
|
142
146
|
# Check for Pearson correlation coefficient
|
|
143
|
-
r, _ =
|
|
147
|
+
r, _ = sps.pearsonr(
|
|
144
148
|
junifer_output_bold[feature]["data"][0],
|
|
145
149
|
afni_output_bold[feature]["data"][0],
|
|
146
150
|
)
|