junifer 0.0.5__py3-none-any.whl → 0.0.5.dev11__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/__init__.py +0 -17
- junifer/_version.py +2 -2
- junifer/api/__init__.py +1 -4
- junifer/api/cli.py +1 -91
- junifer/api/decorators.py +0 -9
- junifer/api/functions.py +10 -56
- junifer/api/parser.py +0 -3
- junifer/api/queue_context/__init__.py +1 -4
- junifer/api/res/afni/run_afni_docker.sh +1 -1
- junifer/api/res/ants/run_ants_docker.sh +1 -1
- junifer/api/res/fsl/run_fsl_docker.sh +1 -1
- junifer/api/tests/test_api_utils.py +2 -4
- junifer/api/tests/test_cli.py +0 -83
- junifer/api/tests/test_functions.py +2 -27
- junifer/configs/__init__.py +1 -1
- junifer/configs/juseless/__init__.py +1 -4
- junifer/configs/juseless/datagrabbers/__init__.py +1 -10
- junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
- junifer/configs/juseless/datagrabbers/ucla.py +9 -12
- junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
- junifer/data/__init__.py +1 -21
- junifer/data/coordinates.py +19 -10
- junifer/data/masks.py +87 -58
- junifer/data/parcellations.py +3 -14
- junifer/data/template_spaces.py +1 -4
- junifer/data/tests/test_masks.py +37 -26
- junifer/data/utils.py +0 -3
- junifer/datagrabber/__init__.py +1 -18
- junifer/datagrabber/aomic/__init__.py +0 -3
- junifer/datagrabber/aomic/id1000.py +37 -70
- junifer/datagrabber/aomic/piop1.py +36 -69
- junifer/datagrabber/aomic/piop2.py +38 -71
- junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
- junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
- junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
- junifer/datagrabber/base.py +6 -13
- junifer/datagrabber/datalad_base.py +1 -13
- junifer/datagrabber/dmcc13_benchmark.py +53 -36
- junifer/datagrabber/hcp1200/__init__.py +0 -3
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
- junifer/datagrabber/hcp1200/hcp1200.py +1 -4
- junifer/datagrabber/multiple.py +6 -45
- junifer/datagrabber/pattern.py +62 -170
- junifer/datagrabber/pattern_datalad.py +12 -25
- junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
- junifer/datagrabber/tests/test_datalad_base.py +4 -4
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
- junifer/datagrabber/tests/test_multiple.py +84 -161
- junifer/datagrabber/tests/test_pattern.py +0 -45
- junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
- junifer/datagrabber/utils.py +230 -0
- junifer/datareader/__init__.py +1 -4
- junifer/datareader/default.py +43 -95
- junifer/external/__init__.py +1 -1
- junifer/external/nilearn/__init__.py +1 -5
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
- junifer/markers/__init__.py +1 -23
- junifer/markers/base.py +28 -68
- junifer/markers/collection.py +2 -10
- junifer/markers/complexity/__init__.py +0 -10
- junifer/markers/complexity/complexity_base.py +43 -26
- junifer/markers/complexity/hurst_exponent.py +0 -3
- junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
- junifer/markers/complexity/perm_entropy.py +0 -3
- junifer/markers/complexity/range_entropy.py +0 -3
- junifer/markers/complexity/range_entropy_auc.py +0 -3
- junifer/markers/complexity/sample_entropy.py +0 -3
- junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
- junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
- junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
- junifer/markers/complexity/tests/test_range_entropy.py +3 -11
- junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
- junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
- junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
- junifer/markers/complexity/weighted_perm_entropy.py +0 -3
- junifer/markers/ets_rss.py +42 -27
- junifer/markers/falff/__init__.py +0 -3
- junifer/markers/falff/_afni_falff.py +2 -5
- junifer/markers/falff/_junifer_falff.py +0 -3
- junifer/markers/falff/falff_base.py +46 -20
- junifer/markers/falff/falff_parcels.py +27 -56
- junifer/markers/falff/falff_spheres.py +29 -60
- junifer/markers/falff/tests/test_falff_parcels.py +23 -39
- junifer/markers/falff/tests/test_falff_spheres.py +23 -39
- junifer/markers/functional_connectivity/__init__.py +0 -9
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
- junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
- junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
- junifer/markers/parcel_aggregation.py +61 -47
- junifer/markers/reho/__init__.py +0 -3
- junifer/markers/reho/_afni_reho.py +2 -5
- junifer/markers/reho/_junifer_reho.py +1 -4
- junifer/markers/reho/reho_base.py +27 -8
- junifer/markers/reho/reho_parcels.py +17 -28
- junifer/markers/reho/reho_spheres.py +18 -27
- junifer/markers/reho/tests/test_reho_parcels.py +3 -8
- junifer/markers/reho/tests/test_reho_spheres.py +3 -8
- junifer/markers/sphere_aggregation.py +59 -43
- junifer/markers/temporal_snr/__init__.py +0 -3
- junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
- junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
- junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
- junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
- junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
- junifer/markers/tests/test_collection.py +8 -9
- junifer/markers/tests/test_ets_rss.py +9 -15
- junifer/markers/tests/test_markers_base.py +18 -17
- junifer/markers/tests/test_parcel_aggregation.py +32 -93
- junifer/markers/tests/test_sphere_aggregation.py +19 -72
- junifer/onthefly/__init__.py +1 -4
- junifer/onthefly/read_transform.py +0 -3
- junifer/pipeline/__init__.py +1 -9
- junifer/pipeline/pipeline_step_mixin.py +4 -21
- junifer/pipeline/registry.py +0 -3
- junifer/pipeline/singleton.py +0 -3
- junifer/pipeline/tests/test_registry.py +1 -1
- junifer/pipeline/update_meta_mixin.py +0 -3
- junifer/pipeline/utils.py +1 -67
- junifer/pipeline/workdir_manager.py +0 -3
- junifer/preprocess/__init__.py +2 -10
- 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 +3 -6
- junifer/preprocess/bold_warper.py +265 -0
- junifer/preprocess/confounds/__init__.py +0 -3
- junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
- 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/warping/__init__.py +0 -3
- junifer/preprocess/warping/_ants_warper.py +0 -3
- junifer/preprocess/warping/_fsl_warper.py +0 -3
- junifer/stats.py +1 -4
- junifer/storage/__init__.py +1 -9
- junifer/storage/base.py +1 -40
- junifer/storage/hdf5.py +9 -71
- junifer/storage/pandas_base.py +0 -3
- junifer/storage/sqlite.py +0 -3
- junifer/storage/tests/test_hdf5.py +10 -82
- junifer/storage/utils.py +0 -9
- junifer/testing/__init__.py +1 -4
- junifer/testing/datagrabbers.py +6 -13
- junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
- junifer/testing/utils.py +0 -3
- junifer/utils/__init__.py +2 -13
- junifer/utils/fs.py +0 -3
- junifer/utils/helpers.py +1 -32
- junifer/utils/logging.py +4 -33
- junifer/utils/tests/test_logging.py +0 -8
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/METADATA +16 -17
- junifer-0.0.5.dev11.dist-info/RECORD +259 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/WHEEL +1 -1
- junifer/api/res/freesurfer/mri_binarize +0 -3
- junifer/api/res/freesurfer/mri_mc +0 -3
- junifer/api/res/freesurfer/mri_pretess +0 -3
- junifer/api/res/freesurfer/mris_convert +0 -3
- junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
- junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
- junifer/datagrabber/pattern_validation_mixin.py +0 -388
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
- junifer/external/BrainPrint/brainprint/__init__.py +0 -4
- junifer/external/BrainPrint/brainprint/_version.py +0 -3
- junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
- junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
- junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
- junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
- junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
- junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
- junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
- junifer/markers/brainprint.py +0 -459
- junifer/markers/tests/test_brainprint.py +0 -58
- junifer/preprocess/smoothing/__init__.py +0 -9
- junifer/preprocess/smoothing/_afni_smoothing.py +0 -119
- junifer/preprocess/smoothing/_fsl_smoothing.py +0 -116
- junifer/preprocess/smoothing/_nilearn_smoothing.py +0 -69
- junifer/preprocess/smoothing/smoothing.py +0 -174
- junifer/preprocess/smoothing/tests/test_smoothing.py +0 -94
- junifer-0.0.5.dist-info/RECORD +0 -275
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.5.dist-info → junifer-0.0.5.dev11.dist-info}/top_level.txt +0 -0
@@ -21,28 +21,6 @@ from junifer.testing.datagrabbers import PartlyCloudyTestingDataGrabber
|
|
21
21
|
COORDINATES = "DMNBuckner"
|
22
22
|
|
23
23
|
|
24
|
-
@pytest.mark.parametrize(
|
25
|
-
"feature",
|
26
|
-
[
|
27
|
-
"alff",
|
28
|
-
"falff",
|
29
|
-
],
|
30
|
-
)
|
31
|
-
def test_ALFFSpheres_get_output_type(feature: str) -> None:
|
32
|
-
"""Test ALFFSpheres get_output_type().
|
33
|
-
|
34
|
-
Parameters
|
35
|
-
----------
|
36
|
-
feature : str
|
37
|
-
The parametrized feature name.
|
38
|
-
|
39
|
-
"""
|
40
|
-
assert "vector" == ALFFSpheres(
|
41
|
-
coords=COORDINATES,
|
42
|
-
using="junifer",
|
43
|
-
).get_output_type(input_type="BOLD", output_feature=feature)
|
44
|
-
|
45
|
-
|
46
24
|
def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
47
25
|
"""Test ALFFSpheres.
|
48
26
|
|
@@ -63,6 +41,7 @@ def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
63
41
|
# Initialize marker
|
64
42
|
marker = ALFFSpheres(
|
65
43
|
coords=COORDINATES,
|
44
|
+
fractional=False,
|
66
45
|
using="junifer",
|
67
46
|
radius=5.0,
|
68
47
|
)
|
@@ -73,16 +52,15 @@ def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
73
52
|
|
74
53
|
# Get BOLD output
|
75
54
|
assert "BOLD" in output
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
assert "col_names" in output_bold
|
55
|
+
output_bold = output["BOLD"]
|
56
|
+
# Assert BOLD output keys
|
57
|
+
assert "data" in output_bold
|
58
|
+
assert "col_names" in output_bold
|
81
59
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
60
|
+
output_bold_data = output_bold["data"]
|
61
|
+
# Assert BOLD output data dimension
|
62
|
+
assert output_bold_data.ndim == 2
|
63
|
+
assert output_bold_data.shape == (1, 6)
|
86
64
|
|
87
65
|
# Reset log capture
|
88
66
|
caplog.clear()
|
@@ -100,13 +78,18 @@ def test_ALFFSpheres(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
100
78
|
@pytest.mark.skipif(
|
101
79
|
_check_afni() is False, reason="requires AFNI to be in PATH"
|
102
80
|
)
|
103
|
-
|
81
|
+
@pytest.mark.parametrize(
|
82
|
+
"fractional", [True, False], ids=["fractional", "non-fractional"]
|
83
|
+
)
|
84
|
+
def test_ALFFSpheres_comparison(tmp_path: Path, fractional: bool) -> None:
|
104
85
|
"""Test ALFFSpheres implementation comparison.
|
105
86
|
|
106
87
|
Parameters
|
107
88
|
----------
|
108
89
|
tmp_path : pathlib.Path
|
109
90
|
The path to the test directory.
|
91
|
+
fractional : bool
|
92
|
+
Whether to compute fractional ALFF or not.
|
110
93
|
|
111
94
|
"""
|
112
95
|
with PartlyCloudyTestingDataGrabber() as dg:
|
@@ -117,6 +100,7 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
117
100
|
# Initialize marker
|
118
101
|
junifer_marker = ALFFSpheres(
|
119
102
|
coords=COORDINATES,
|
103
|
+
fractional=fractional,
|
120
104
|
using="junifer",
|
121
105
|
radius=5.0,
|
122
106
|
)
|
@@ -128,6 +112,7 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
128
112
|
# Initialize marker
|
129
113
|
afni_marker = ALFFSpheres(
|
130
114
|
coords=COORDINATES,
|
115
|
+
fractional=fractional,
|
131
116
|
using="afni",
|
132
117
|
radius=5.0,
|
133
118
|
)
|
@@ -136,10 +121,9 @@ def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
|
|
136
121
|
# Get BOLD output
|
137
122
|
afni_output_bold = afni_output["BOLD"]
|
138
123
|
|
139
|
-
for
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
assert r > 0.99
|
124
|
+
# Check for Pearson correlation coefficient
|
125
|
+
r, _ = sp.stats.pearsonr(
|
126
|
+
junifer_output_bold["data"][0],
|
127
|
+
afni_output_bold["data"][0],
|
128
|
+
)
|
129
|
+
assert r > 0.99
|
@@ -8,12 +8,3 @@ from .functional_connectivity_spheres import FunctionalConnectivitySpheres
|
|
8
8
|
from .crossparcellation_functional_connectivity import CrossParcellationFC
|
9
9
|
from .edge_functional_connectivity_parcels import EdgeCentricFCParcels
|
10
10
|
from .edge_functional_connectivity_spheres import EdgeCentricFCSpheres
|
11
|
-
|
12
|
-
|
13
|
-
__all__ = [
|
14
|
-
"FunctionalConnectivityParcels",
|
15
|
-
"FunctionalConnectivitySpheres",
|
16
|
-
"CrossParcellationFC",
|
17
|
-
"EdgeCentricFCParcels",
|
18
|
-
"EdgeCentricFCSpheres",
|
19
|
-
]
|
@@ -15,9 +15,6 @@ from ..parcel_aggregation import ParcelAggregation
|
|
15
15
|
from ..utils import _correlate_dataframes
|
16
16
|
|
17
17
|
|
18
|
-
__all__ = ["CrossParcellationFC"]
|
19
|
-
|
20
|
-
|
21
18
|
@register_marker
|
22
19
|
class CrossParcellationFC(BaseMarker):
|
23
20
|
"""Class for calculating parcel-wise correlations with 2 parcellations.
|
@@ -28,42 +25,29 @@ class CrossParcellationFC(BaseMarker):
|
|
28
25
|
The name of the first parcellation.
|
29
26
|
parcellation_two : str
|
30
27
|
The name of the second parcellation.
|
31
|
-
|
32
|
-
The method
|
33
|
-
|
34
|
-
(default "mean").
|
35
|
-
agg_method_params : dict, optional
|
36
|
-
Parameters to pass to the aggregation function.
|
37
|
-
See :func:`.get_aggfunc_by_name` for options
|
38
|
-
(default None).
|
39
|
-
corr_method : str, optional
|
28
|
+
aggregation_method : str, optional
|
29
|
+
The aggregation method (default "mean").
|
30
|
+
correlation_method : str, optional
|
40
31
|
Any method that can be passed to
|
41
|
-
:
|
32
|
+
:any:`pandas.DataFrame.corr` (default "pearson").
|
42
33
|
masks : str, dict or list of dict or str, optional
|
43
34
|
The specification of the masks to apply to regions before extracting
|
44
35
|
signals. Check :ref:`Using Masks <using_masks>` for more details.
|
45
36
|
If None, will not apply any mask (default None).
|
46
37
|
name : str, optional
|
47
|
-
The name of the marker. If None, will use
|
48
|
-
|
38
|
+
The name of the marker. If None, will use the class name
|
39
|
+
(default None).
|
49
40
|
|
50
41
|
"""
|
51
42
|
|
52
43
|
_DEPENDENCIES: ClassVar[Set[str]] = {"nilearn"}
|
53
44
|
|
54
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[Dict[str, Dict[str, str]]] = {
|
55
|
-
"BOLD": {
|
56
|
-
"functional_connectivity": "matrix",
|
57
|
-
},
|
58
|
-
}
|
59
|
-
|
60
45
|
def __init__(
|
61
46
|
self,
|
62
47
|
parcellation_one: str,
|
63
48
|
parcellation_two: str,
|
64
|
-
|
65
|
-
|
66
|
-
corr_method: str = "pearson",
|
49
|
+
aggregation_method: str = "mean",
|
50
|
+
correlation_method: str = "pearson",
|
67
51
|
masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
|
68
52
|
name: Optional[str] = None,
|
69
53
|
) -> None:
|
@@ -73,12 +57,38 @@ class CrossParcellationFC(BaseMarker):
|
|
73
57
|
)
|
74
58
|
self.parcellation_one = parcellation_one
|
75
59
|
self.parcellation_two = parcellation_two
|
76
|
-
self.
|
77
|
-
self.
|
78
|
-
self.corr_method = corr_method
|
60
|
+
self.aggregation_method = aggregation_method
|
61
|
+
self.correlation_method = correlation_method
|
79
62
|
self.masks = masks
|
80
63
|
super().__init__(on=["BOLD"], name=name)
|
81
64
|
|
65
|
+
def get_valid_inputs(self) -> List[str]:
|
66
|
+
"""Get valid data types for input.
|
67
|
+
|
68
|
+
Returns
|
69
|
+
-------
|
70
|
+
list of str
|
71
|
+
The list of data types that can be used as input for this marker
|
72
|
+
|
73
|
+
"""
|
74
|
+
return ["BOLD"]
|
75
|
+
|
76
|
+
def get_output_type(self, input_type: str) -> str:
|
77
|
+
"""Get output type.
|
78
|
+
|
79
|
+
Parameters
|
80
|
+
----------
|
81
|
+
input_type : str
|
82
|
+
The data type input to the marker.
|
83
|
+
|
84
|
+
Returns
|
85
|
+
-------
|
86
|
+
str
|
87
|
+
The storage type output by the marker.
|
88
|
+
|
89
|
+
"""
|
90
|
+
return "matrix"
|
91
|
+
|
82
92
|
def compute(
|
83
93
|
self,
|
84
94
|
input: Dict[str, Any],
|
@@ -105,14 +115,10 @@ class CrossParcellationFC(BaseMarker):
|
|
105
115
|
to the user or stored in the storage by calling the store method
|
106
116
|
with this as a parameter. The dictionary has the following keys:
|
107
117
|
|
108
|
-
* ``
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
- ``col_names`` : ROI labels for first parcellation as list of
|
113
|
-
str
|
114
|
-
- ``row_names`` : ROI labels for second parcellation as list of
|
115
|
-
str
|
118
|
+
* ``data`` : the correlation values between the two parcellations
|
119
|
+
as a numpy.ndarray
|
120
|
+
* ``col_names`` : the ROIs for first parcellation as a list
|
121
|
+
* ``row_names`` : the ROIs for second parcellation as a list
|
116
122
|
|
117
123
|
"""
|
118
124
|
logger.debug(
|
@@ -120,40 +126,31 @@ class CrossParcellationFC(BaseMarker):
|
|
120
126
|
f" {self.parcellation_one} and "
|
121
127
|
f"{self.parcellation_two} parcellations."
|
122
128
|
)
|
123
|
-
#
|
124
|
-
|
129
|
+
# Initialize a ParcelAggregation
|
130
|
+
parcellation_one_dict = ParcelAggregation(
|
125
131
|
parcellation=self.parcellation_one,
|
126
|
-
method=self.
|
127
|
-
method_params=self.agg_method_params,
|
132
|
+
method=self.aggregation_method,
|
128
133
|
masks=self.masks,
|
129
|
-
on="BOLD",
|
130
134
|
).compute(input, extra_input=extra_input)
|
131
|
-
|
135
|
+
parcellation_two_dict = ParcelAggregation(
|
132
136
|
parcellation=self.parcellation_two,
|
133
|
-
method=self.
|
134
|
-
method_params=self.agg_method_params,
|
137
|
+
method=self.aggregation_method,
|
135
138
|
masks=self.masks,
|
136
|
-
on="BOLD",
|
137
139
|
).compute(input, extra_input=extra_input)
|
138
140
|
|
141
|
+
parcellated_ts_one = parcellation_one_dict["data"]
|
142
|
+
parcellated_ts_two = parcellation_two_dict["data"]
|
143
|
+
# columns should be named after parcellation 1
|
144
|
+
# rows should be named after parcellation 2
|
145
|
+
|
146
|
+
result = _correlate_dataframes(
|
147
|
+
pd.DataFrame(parcellated_ts_one),
|
148
|
+
pd.DataFrame(parcellated_ts_two),
|
149
|
+
method=self.correlation_method,
|
150
|
+
).values
|
151
|
+
|
139
152
|
return {
|
140
|
-
"
|
141
|
-
|
142
|
-
|
143
|
-
aggregation_parcellation_one["aggregation"]["data"]
|
144
|
-
),
|
145
|
-
pd.DataFrame(
|
146
|
-
aggregation_parcellation_two["aggregation"]["data"]
|
147
|
-
),
|
148
|
-
method=self.corr_method,
|
149
|
-
).values,
|
150
|
-
# Columns should be named after parcellation 1
|
151
|
-
"col_names": aggregation_parcellation_one["aggregation"][
|
152
|
-
"col_names"
|
153
|
-
],
|
154
|
-
# Rows should be named after parcellation 2
|
155
|
-
"row_names": aggregation_parcellation_two["aggregation"][
|
156
|
-
"col_names"
|
157
|
-
],
|
158
|
-
},
|
153
|
+
"data": result,
|
154
|
+
"col_names": parcellation_one_dict["col_names"],
|
155
|
+
"row_names": parcellation_two_dict["col_names"],
|
159
156
|
}
|
@@ -12,9 +12,6 @@ from ..utils import _ets
|
|
12
12
|
from .functional_connectivity_base import FunctionalConnectivityBase
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = ["EdgeCentricFCParcels"]
|
16
|
-
|
17
|
-
|
18
15
|
@register_marker
|
19
16
|
class EdgeCentricFCParcels(FunctionalConnectivityBase):
|
20
17
|
"""Class for edge-centric FC using parcellations.
|
@@ -22,40 +19,36 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
|
|
22
19
|
Parameters
|
23
20
|
----------
|
24
21
|
parcellation : str or list of str
|
25
|
-
The name(s) of the parcellation(s)
|
26
|
-
|
22
|
+
The name(s) of the parcellation(s). Check valid options by calling
|
23
|
+
:func:`.list_parcellations`.
|
27
24
|
agg_method : str, optional
|
28
|
-
The method to perform aggregation
|
29
|
-
|
25
|
+
The method to perform aggregation of BOLD time series.
|
26
|
+
Check valid options in :func:`.get_aggfunc_by_name`
|
30
27
|
(default "mean").
|
31
28
|
agg_method_params : dict, optional
|
32
|
-
Parameters to pass to the aggregation function.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
If None, ``{"empirical": True}`` will be used, which would mean
|
42
|
-
:class:`sklearn.covariance.EmpiricalCovariance` is used to compute
|
43
|
-
covariance. If usage of :class:`sklearn.covariance.LedoitWolf` is
|
44
|
-
desired, ``{"empirical": False}`` should be passed
|
45
|
-
(default None).
|
29
|
+
Parameters to pass to the aggregation function. Check valid options in
|
30
|
+
:func:`.get_aggfunc_by_name` (default None).
|
31
|
+
cor_method : str, optional
|
32
|
+
The method to perform correlation. Check valid options in
|
33
|
+
:class:`nilearn.connectome.ConnectivityMeasure`
|
34
|
+
(default "covariance").
|
35
|
+
cor_method_params : dict, optional
|
36
|
+
Parameters to pass to the correlation function. Check valid options in
|
37
|
+
:class:`nilearn.connectome.ConnectivityMeasure` (default None).
|
46
38
|
masks : str, dict or list of dict or str, optional
|
47
39
|
The specification of the masks to apply to regions before extracting
|
48
40
|
signals. Check :ref:`Using Masks <using_masks>` for more details.
|
49
41
|
If None, will not apply any mask (default None).
|
50
42
|
name : str, optional
|
51
|
-
The name of the marker. If None, will use
|
52
|
-
|
43
|
+
The name of the marker. If None, will use the class name (default
|
44
|
+
None).
|
53
45
|
|
54
46
|
References
|
55
47
|
----------
|
56
48
|
.. [1] Jo et al. (2021)
|
57
|
-
|
58
|
-
|
49
|
+
Subject identification using
|
50
|
+
edge-centric functional connectivity
|
51
|
+
doi: https://doi.org/10.1016/j.neuroimage.2021.118204
|
59
52
|
|
60
53
|
"""
|
61
54
|
|
@@ -64,8 +57,8 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
|
|
64
57
|
parcellation: Union[str, List[str]],
|
65
58
|
agg_method: str = "mean",
|
66
59
|
agg_method_params: Optional[Dict] = None,
|
67
|
-
|
68
|
-
|
60
|
+
cor_method: str = "covariance",
|
61
|
+
cor_method_params: Optional[Dict] = None,
|
69
62
|
masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
|
70
63
|
name: Optional[str] = None,
|
71
64
|
) -> None:
|
@@ -73,8 +66,8 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
|
|
73
66
|
super().__init__(
|
74
67
|
agg_method=agg_method,
|
75
68
|
agg_method_params=agg_method_params,
|
76
|
-
|
77
|
-
|
69
|
+
cor_method=cor_method,
|
70
|
+
cor_method_params=cor_method_params,
|
78
71
|
masks=masks,
|
79
72
|
name=name,
|
80
73
|
)
|
@@ -102,29 +95,23 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
|
|
102
95
|
to the user or stored in the storage by calling the store method
|
103
96
|
with this as a parameter. The dictionary has the following keys:
|
104
97
|
|
105
|
-
* ``
|
106
|
-
|
107
|
-
- ``data`` : ROI values as ``numpy.ndarray``
|
108
|
-
- ``col_names`` : ROI labels as list of str
|
98
|
+
* ``data`` : the actual computed values as a numpy.ndarray
|
99
|
+
* ``col_names`` : the column labels for the computed values as list
|
109
100
|
|
110
101
|
"""
|
111
|
-
|
112
|
-
aggregation = ParcelAggregation(
|
102
|
+
parcel_aggregation = ParcelAggregation(
|
113
103
|
parcellation=self.parcellation,
|
114
104
|
method=self.agg_method,
|
115
105
|
method_params=self.agg_method_params,
|
116
106
|
masks=self.masks,
|
117
107
|
on="BOLD",
|
118
|
-
)
|
119
|
-
|
108
|
+
)
|
109
|
+
|
110
|
+
bold_aggregated = parcel_aggregation.compute(
|
111
|
+
input, extra_input=extra_input
|
112
|
+
)
|
120
113
|
ets, edge_names = _ets(
|
121
|
-
|
122
|
-
roi_names=aggregation["aggregation"]["col_names"],
|
114
|
+
bold_aggregated["data"], bold_aggregated["col_names"]
|
123
115
|
)
|
124
116
|
|
125
|
-
return {
|
126
|
-
"aggregation": {
|
127
|
-
"data": ets,
|
128
|
-
"col_names": edge_names,
|
129
|
-
},
|
130
|
-
}
|
117
|
+
return {"data": ets, "col_names": edge_names}
|
@@ -12,9 +12,6 @@ from ..utils import _ets, raise_error
|
|
12
12
|
from .functional_connectivity_base import FunctionalConnectivityBase
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = ["EdgeCentricFCSpheres"]
|
16
|
-
|
17
|
-
|
18
15
|
@register_marker
|
19
16
|
class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
20
17
|
"""Class for edge-centric FC using coordinates (spheres).
|
@@ -22,48 +19,42 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
|
22
19
|
Parameters
|
23
20
|
----------
|
24
21
|
coords : str
|
25
|
-
The name of the coordinates list to use.
|
26
|
-
|
27
|
-
radius :
|
28
|
-
The radius of the sphere
|
29
|
-
|
30
|
-
|
31
|
-
(default None).
|
22
|
+
The name of the coordinates list to use. See
|
23
|
+
:func:`.list_coordinates` for options.
|
24
|
+
radius : float, optional
|
25
|
+
The radius of the sphere in mm. If None, the signal will be extracted
|
26
|
+
from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker`
|
27
|
+
for more information (default None).
|
32
28
|
allow_overlap : bool, optional
|
33
29
|
Whether to allow overlapping spheres. If False, an error is raised if
|
34
|
-
the spheres overlap (default False).
|
30
|
+
the spheres overlap (default is False).
|
35
31
|
agg_method : str, optional
|
36
|
-
The method to
|
37
|
-
See :func:`.get_aggfunc_by_name` for
|
38
|
-
(default "mean").
|
39
|
-
agg_method_params : dict, optional
|
40
|
-
Parameters to pass to the aggregation function.
|
41
|
-
See :func:`.get_aggfunc_by_name` for options
|
42
|
-
(default None).
|
43
|
-
conn_method : str, optional
|
44
|
-
The method to perform connectivity measure using.
|
45
|
-
See :class:`.JuniferConnectivityMeasure` for options
|
46
|
-
(default "correlation").
|
47
|
-
conn_method_params : dict, optional
|
48
|
-
Parameters to pass to :class:`.JuniferConnectivityMeasure`.
|
49
|
-
If None, ``{"empirical": True}`` will be used, which would mean
|
50
|
-
:class:`sklearn.covariance.EmpiricalCovariance` is used to compute
|
51
|
-
covariance. If usage of :class:`sklearn.covariance.LedoitWolf` is
|
52
|
-
desired, ``{"empirical": False}`` should be passed
|
32
|
+
The aggregation method to use.
|
33
|
+
See :func:`.get_aggfunc_by_name` for more information
|
53
34
|
(default None).
|
35
|
+
agg_method_params : dict, optional
|
36
|
+
The parameters to pass to the aggregation method (default None).
|
37
|
+
cor_method : str, optional
|
38
|
+
The method to perform correlation using. Check valid options in
|
39
|
+
:class:`nilearn.connectome.ConnectivityMeasure` (default "covariance").
|
40
|
+
cor_method_params : dict, optional
|
41
|
+
Parameters to pass to the correlation function. Check valid options in
|
42
|
+
:class:`nilearn.connectome.ConnectivityMeasure` (default None).
|
54
43
|
masks : str, dict or list of dict or str, optional
|
55
44
|
The specification of the masks to apply to regions before extracting
|
56
45
|
signals. Check :ref:`Using Masks <using_masks>` for more details.
|
57
46
|
If None, will not apply any mask (default None).
|
58
47
|
name : str, optional
|
59
|
-
The name of the marker.
|
60
|
-
|
48
|
+
The name of the marker. By default, it will use
|
49
|
+
KIND_EdgeCentricFCSpheres where KIND is the kind of data it
|
50
|
+
was applied to (default None).
|
61
51
|
|
62
52
|
References
|
63
53
|
----------
|
64
54
|
.. [1] Jo et al. (2021)
|
65
|
-
|
66
|
-
|
55
|
+
Subject identification using
|
56
|
+
edge-centric functional connectivity
|
57
|
+
doi: https://doi.org/10.1016/j.neuroimage.2021.118204
|
67
58
|
|
68
59
|
"""
|
69
60
|
|
@@ -74,8 +65,8 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
|
74
65
|
allow_overlap: bool = False,
|
75
66
|
agg_method: str = "mean",
|
76
67
|
agg_method_params: Optional[Dict] = None,
|
77
|
-
|
78
|
-
|
68
|
+
cor_method: str = "covariance",
|
69
|
+
cor_method_params: Optional[Dict] = None,
|
79
70
|
masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
|
80
71
|
name: Optional[str] = None,
|
81
72
|
) -> None:
|
@@ -87,8 +78,8 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
|
87
78
|
super().__init__(
|
88
79
|
agg_method=agg_method,
|
89
80
|
agg_method_params=agg_method_params,
|
90
|
-
|
91
|
-
|
81
|
+
cor_method=cor_method,
|
82
|
+
cor_method_params=cor_method_params,
|
92
83
|
masks=masks,
|
93
84
|
name=name,
|
94
85
|
)
|
@@ -116,14 +107,11 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
|
116
107
|
to the user or stored in the storage by calling the store method
|
117
108
|
with this as a parameter. The dictionary has the following keys:
|
118
109
|
|
119
|
-
* ``
|
120
|
-
|
121
|
-
- ``data`` : ROI values as ``numpy.ndarray``
|
122
|
-
- ``col_names`` : ROI labels as list of str
|
110
|
+
* ``data`` : the actual computed values as a numpy.ndarray
|
111
|
+
* ``col_names`` : the column labels for the computed values as list
|
123
112
|
|
124
113
|
"""
|
125
|
-
|
126
|
-
aggregation = SphereAggregation(
|
114
|
+
sphere_aggregation = SphereAggregation(
|
127
115
|
coords=self.coords,
|
128
116
|
radius=self.radius,
|
129
117
|
allow_overlap=self.allow_overlap,
|
@@ -131,13 +119,12 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
|
|
131
119
|
method_params=self.agg_method_params,
|
132
120
|
masks=self.masks,
|
133
121
|
on="BOLD",
|
134
|
-
)
|
135
|
-
|
122
|
+
)
|
123
|
+
bold_aggregated = sphere_aggregation.compute(
|
124
|
+
input, extra_input=extra_input
|
125
|
+
)
|
136
126
|
ets, edge_names = _ets(
|
137
|
-
|
138
|
-
roi_names=aggregation["aggregation"]["col_names"],
|
127
|
+
bold_aggregated["data"], bold_aggregated["col_names"]
|
139
128
|
)
|
140
129
|
|
141
|
-
return {
|
142
|
-
"aggregation": {"data": ets, "col_names": edge_names},
|
143
|
-
}
|
130
|
+
return {"data": ets, "col_names": edge_names}
|