junifer 0.0.5__py3-none-any.whl → 0.0.5.dev24__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.
Files changed (194) hide show
  1. junifer/__init__.py +0 -17
  2. junifer/_version.py +2 -2
  3. junifer/api/__init__.py +1 -4
  4. junifer/api/cli.py +1 -91
  5. junifer/api/decorators.py +0 -9
  6. junifer/api/functions.py +10 -56
  7. junifer/api/parser.py +0 -3
  8. junifer/api/queue_context/__init__.py +1 -4
  9. junifer/api/res/afni/run_afni_docker.sh +1 -1
  10. junifer/api/res/ants/run_ants_docker.sh +1 -1
  11. junifer/api/res/fsl/run_fsl_docker.sh +1 -1
  12. junifer/api/tests/test_api_utils.py +2 -4
  13. junifer/api/tests/test_cli.py +0 -83
  14. junifer/api/tests/test_functions.py +2 -27
  15. junifer/configs/__init__.py +1 -1
  16. junifer/configs/juseless/__init__.py +1 -4
  17. junifer/configs/juseless/datagrabbers/__init__.py +1 -10
  18. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
  19. junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
  20. junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
  21. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
  22. junifer/configs/juseless/datagrabbers/ucla.py +9 -12
  23. junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
  24. junifer/data/__init__.py +1 -21
  25. junifer/data/coordinates.py +19 -10
  26. junifer/data/masks.py +87 -58
  27. junifer/data/parcellations.py +3 -14
  28. junifer/data/template_spaces.py +1 -4
  29. junifer/data/tests/test_masks.py +37 -26
  30. junifer/data/utils.py +0 -3
  31. junifer/datagrabber/__init__.py +1 -18
  32. junifer/datagrabber/aomic/__init__.py +0 -3
  33. junifer/datagrabber/aomic/id1000.py +37 -70
  34. junifer/datagrabber/aomic/piop1.py +36 -69
  35. junifer/datagrabber/aomic/piop2.py +38 -71
  36. junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
  37. junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
  38. junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
  39. junifer/datagrabber/base.py +6 -13
  40. junifer/datagrabber/datalad_base.py +1 -13
  41. junifer/datagrabber/dmcc13_benchmark.py +53 -36
  42. junifer/datagrabber/hcp1200/__init__.py +0 -3
  43. junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
  44. junifer/datagrabber/hcp1200/hcp1200.py +1 -4
  45. junifer/datagrabber/multiple.py +6 -45
  46. junifer/datagrabber/pattern.py +62 -170
  47. junifer/datagrabber/pattern_datalad.py +12 -25
  48. junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
  49. junifer/datagrabber/tests/test_datalad_base.py +4 -4
  50. junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
  51. junifer/datagrabber/tests/test_multiple.py +84 -161
  52. junifer/datagrabber/tests/test_pattern.py +0 -45
  53. junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
  54. junifer/datagrabber/utils.py +230 -0
  55. junifer/datareader/__init__.py +1 -4
  56. junifer/datareader/default.py +43 -95
  57. junifer/external/__init__.py +1 -1
  58. junifer/external/nilearn/__init__.py +1 -5
  59. junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
  60. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
  61. junifer/markers/__init__.py +1 -23
  62. junifer/markers/base.py +28 -68
  63. junifer/markers/collection.py +2 -10
  64. junifer/markers/complexity/__init__.py +0 -10
  65. junifer/markers/complexity/complexity_base.py +43 -26
  66. junifer/markers/complexity/hurst_exponent.py +0 -3
  67. junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
  68. junifer/markers/complexity/perm_entropy.py +0 -3
  69. junifer/markers/complexity/range_entropy.py +0 -3
  70. junifer/markers/complexity/range_entropy_auc.py +0 -3
  71. junifer/markers/complexity/sample_entropy.py +0 -3
  72. junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
  73. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
  74. junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
  75. junifer/markers/complexity/tests/test_range_entropy.py +3 -11
  76. junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
  77. junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
  78. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
  79. junifer/markers/complexity/weighted_perm_entropy.py +0 -3
  80. junifer/markers/ets_rss.py +42 -27
  81. junifer/markers/falff/__init__.py +0 -3
  82. junifer/markers/falff/_afni_falff.py +2 -5
  83. junifer/markers/falff/_junifer_falff.py +0 -3
  84. junifer/markers/falff/falff_base.py +46 -20
  85. junifer/markers/falff/falff_parcels.py +27 -56
  86. junifer/markers/falff/falff_spheres.py +29 -60
  87. junifer/markers/falff/tests/test_falff_parcels.py +23 -39
  88. junifer/markers/falff/tests/test_falff_spheres.py +23 -39
  89. junifer/markers/functional_connectivity/__init__.py +0 -9
  90. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
  91. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
  92. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
  93. junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
  94. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
  95. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
  96. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
  97. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
  98. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
  99. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
  100. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
  101. junifer/markers/parcel_aggregation.py +61 -47
  102. junifer/markers/reho/__init__.py +0 -3
  103. junifer/markers/reho/_afni_reho.py +2 -5
  104. junifer/markers/reho/_junifer_reho.py +1 -4
  105. junifer/markers/reho/reho_base.py +27 -8
  106. junifer/markers/reho/reho_parcels.py +17 -28
  107. junifer/markers/reho/reho_spheres.py +18 -27
  108. junifer/markers/reho/tests/test_reho_parcels.py +3 -8
  109. junifer/markers/reho/tests/test_reho_spheres.py +3 -8
  110. junifer/markers/sphere_aggregation.py +59 -43
  111. junifer/markers/temporal_snr/__init__.py +0 -3
  112. junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
  113. junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
  114. junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
  115. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
  116. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
  117. junifer/markers/tests/test_collection.py +8 -9
  118. junifer/markers/tests/test_ets_rss.py +9 -15
  119. junifer/markers/tests/test_markers_base.py +18 -17
  120. junifer/markers/tests/test_parcel_aggregation.py +32 -93
  121. junifer/markers/tests/test_sphere_aggregation.py +19 -72
  122. junifer/onthefly/__init__.py +1 -4
  123. junifer/onthefly/read_transform.py +0 -3
  124. junifer/pipeline/__init__.py +1 -9
  125. junifer/pipeline/pipeline_step_mixin.py +4 -21
  126. junifer/pipeline/registry.py +0 -3
  127. junifer/pipeline/singleton.py +0 -3
  128. junifer/pipeline/tests/test_registry.py +1 -1
  129. junifer/pipeline/update_meta_mixin.py +0 -3
  130. junifer/pipeline/utils.py +1 -67
  131. junifer/pipeline/workdir_manager.py +0 -3
  132. junifer/preprocess/__init__.py +2 -9
  133. junifer/preprocess/ants/__init__.py +4 -0
  134. junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
  135. junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
  136. junifer/preprocess/base.py +3 -6
  137. junifer/preprocess/bold_warper.py +265 -0
  138. junifer/preprocess/confounds/__init__.py +0 -3
  139. junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
  140. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
  141. junifer/preprocess/fsl/__init__.py +4 -0
  142. junifer/preprocess/fsl/apply_warper.py +179 -0
  143. junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
  144. junifer/preprocess/smoothing/__init__.py +0 -3
  145. junifer/preprocess/smoothing/_afni_smoothing.py +1 -1
  146. junifer/preprocess/tests/test_bold_warper.py +159 -0
  147. junifer/preprocess/warping/__init__.py +0 -3
  148. junifer/preprocess/warping/_ants_warper.py +0 -3
  149. junifer/preprocess/warping/_fsl_warper.py +0 -3
  150. junifer/stats.py +1 -4
  151. junifer/storage/__init__.py +1 -9
  152. junifer/storage/base.py +1 -40
  153. junifer/storage/hdf5.py +9 -71
  154. junifer/storage/pandas_base.py +0 -3
  155. junifer/storage/sqlite.py +0 -3
  156. junifer/storage/tests/test_hdf5.py +10 -82
  157. junifer/storage/utils.py +0 -9
  158. junifer/testing/__init__.py +1 -4
  159. junifer/testing/datagrabbers.py +6 -13
  160. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
  161. junifer/testing/utils.py +0 -3
  162. junifer/utils/__init__.py +2 -13
  163. junifer/utils/fs.py +0 -3
  164. junifer/utils/helpers.py +1 -32
  165. junifer/utils/logging.py +4 -33
  166. junifer/utils/tests/test_logging.py +0 -8
  167. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/METADATA +16 -17
  168. junifer-0.0.5.dev24.dist-info/RECORD +265 -0
  169. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/WHEEL +1 -1
  170. junifer/api/res/freesurfer/mri_binarize +0 -3
  171. junifer/api/res/freesurfer/mri_mc +0 -3
  172. junifer/api/res/freesurfer/mri_pretess +0 -3
  173. junifer/api/res/freesurfer/mris_convert +0 -3
  174. junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
  175. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  176. junifer/datagrabber/pattern_validation_mixin.py +0 -388
  177. junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
  178. junifer/external/BrainPrint/brainprint/__init__.py +0 -4
  179. junifer/external/BrainPrint/brainprint/_version.py +0 -3
  180. junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
  181. junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
  182. junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
  183. junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
  184. junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
  185. junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
  186. junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
  187. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
  188. junifer/markers/brainprint.py +0 -459
  189. junifer/markers/tests/test_brainprint.py +0 -58
  190. junifer-0.0.5.dist-info/RECORD +0 -275
  191. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/AUTHORS.rst +0 -0
  192. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/LICENSE.md +0 -0
  193. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/entry_points.txt +0 -0
  194. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.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
- for feature in output["BOLD"].keys():
77
- output_bold = output["BOLD"][feature]
78
- # Assert BOLD output keys
79
- assert "data" in output_bold
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
- output_bold_data = output_bold["data"]
83
- # Assert BOLD output data dimension
84
- assert output_bold_data.ndim == 2
85
- assert output_bold_data.shape == (1, 6)
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
- def test_ALFFSpheres_comparison(tmp_path: Path) -> None:
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 feature in afni_output_bold.keys():
140
- # Check for Pearson correlation coefficient
141
- r, _ = sp.stats.pearsonr(
142
- junifer_output_bold[feature]["data"][0],
143
- afni_output_bold[feature]["data"][0],
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
- agg_method : str, optional
32
- The method to perform aggregation using.
33
- See :func:`.get_aggfunc_by_name` for options
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
- :meth:`pandas.DataFrame.corr` (default "pearson").
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
- ``BOLD_CrossParcellationFC`` (default None).
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
- agg_method: str = "mean",
65
- agg_method_params: Optional[Dict] = None,
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.agg_method = agg_method
77
- self.agg_method_params = agg_method_params
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
- * ``functional_connectivity`` : dictionary with the following keys:
109
-
110
- - ``data`` : correlation between the two parcellations as
111
- ``numpy.ndarray``
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
- # Perform aggregation using two parcellations
124
- aggregation_parcellation_one = ParcelAggregation(
129
+ # Initialize a ParcelAggregation
130
+ parcellation_one_dict = ParcelAggregation(
125
131
  parcellation=self.parcellation_one,
126
- method=self.agg_method,
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
- aggregation_parcellation_two = ParcelAggregation(
135
+ parcellation_two_dict = ParcelAggregation(
132
136
  parcellation=self.parcellation_two,
133
- method=self.agg_method,
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
- "functional_connectivity": {
141
- "data": _correlate_dataframes(
142
- pd.DataFrame(
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) to use.
26
- See :func:`.list_parcellations` for options.
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 using.
29
- See :func:`.get_aggfunc_by_name` for options
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
- See :func:`.get_aggfunc_by_name` for options
34
- (default None).
35
- conn_method : str, optional
36
- The method to perform connectivity measure using.
37
- See :class:`.JuniferConnectivityMeasure` for options
38
- (default "correlation").
39
- conn_method_params : dict, optional
40
- Parameters to pass to :class:`.JuniferConnectivityMeasure`.
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
- ``BOLD_EdgeCentricFCParcels`` (default None).
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
- Subject identification using edge-centric functional connectivity.
58
- https://doi.org/10.1016/j.neuroimage.2021.118204
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
- conn_method: str = "correlation",
68
- conn_method_params: Optional[Dict] = None,
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
- conn_method=conn_method,
77
- conn_method_params=conn_method_params,
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
- * ``aggregation`` : dictionary with the following keys:
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
- # Perform aggregation
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
- ).compute(input, extra_input=extra_input)
119
- # Compute edgewise timeseries
108
+ )
109
+
110
+ bold_aggregated = parcel_aggregation.compute(
111
+ input, extra_input=extra_input
112
+ )
120
113
  ets, edge_names = _ets(
121
- bold_ts=aggregation["aggregation"]["data"],
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
- See :func:`.list_coordinates` for options.
27
- radius : positive float, optional
28
- The radius of the sphere around each coordinates in millimetres.
29
- If None, the signal will be extracted from a single voxel.
30
- See :class:`.JuniferNiftiSpheresMasker` for more information
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 perform aggregation using.
37
- See :func:`.get_aggfunc_by_name` for options
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. If None, will use
60
- ``BOLD_EdgeCentricFCSpheres`` (default None).
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
- Subject identification using edge-centric functional connectivity.
66
- https://doi.org/10.1016/j.neuroimage.2021.118204
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
- conn_method: str = "correlation",
78
- conn_method_params: Optional[Dict] = None,
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
- conn_method=conn_method,
91
- conn_method_params=conn_method_params,
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
- * ``aggregation`` : dictionary with the following keys:
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
- # Perform aggregation
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
- ).compute(input, extra_input=extra_input)
135
- # Compute edgewise timeseries
122
+ )
123
+ bold_aggregated = sphere_aggregation.compute(
124
+ input, extra_input=extra_input
125
+ )
136
126
  ets, edge_names = _ets(
137
- bold_ts=aggregation["aggregation"]["data"],
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}