junifer 0.0.5.dev240__py3-none-any.whl → 0.0.6__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 (279) hide show
  1. junifer/__init__.py +2 -31
  2. junifer/__init__.pyi +37 -0
  3. junifer/_version.py +9 -4
  4. junifer/api/__init__.py +3 -5
  5. junifer/api/__init__.pyi +4 -0
  6. junifer/api/decorators.py +14 -19
  7. junifer/api/functions.py +165 -109
  8. junifer/api/py.typed +0 -0
  9. junifer/api/queue_context/__init__.py +2 -4
  10. junifer/api/queue_context/__init__.pyi +5 -0
  11. junifer/api/queue_context/gnu_parallel_local_adapter.py +22 -6
  12. junifer/api/queue_context/htcondor_adapter.py +23 -6
  13. junifer/api/queue_context/py.typed +0 -0
  14. junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +3 -3
  15. junifer/api/queue_context/tests/test_htcondor_adapter.py +3 -3
  16. junifer/api/tests/test_functions.py +168 -74
  17. junifer/cli/__init__.py +24 -0
  18. junifer/cli/__init__.pyi +3 -0
  19. junifer/{api → cli}/cli.py +141 -125
  20. junifer/cli/parser.py +235 -0
  21. junifer/cli/py.typed +0 -0
  22. junifer/{api → cli}/tests/test_cli.py +8 -8
  23. junifer/{api/tests/test_api_utils.py → cli/tests/test_cli_utils.py} +5 -4
  24. junifer/{api → cli}/tests/test_parser.py +2 -2
  25. junifer/{api → cli}/utils.py +6 -16
  26. junifer/configs/juseless/__init__.py +2 -2
  27. junifer/configs/juseless/__init__.pyi +3 -0
  28. junifer/configs/juseless/datagrabbers/__init__.py +2 -12
  29. junifer/configs/juseless/datagrabbers/__init__.pyi +13 -0
  30. junifer/configs/juseless/datagrabbers/ixi_vbm.py +2 -2
  31. junifer/configs/juseless/datagrabbers/py.typed +0 -0
  32. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -2
  33. junifer/configs/juseless/datagrabbers/ucla.py +4 -4
  34. junifer/configs/juseless/py.typed +0 -0
  35. junifer/conftest.py +25 -0
  36. junifer/data/__init__.py +2 -42
  37. junifer/data/__init__.pyi +29 -0
  38. junifer/data/_dispatch.py +248 -0
  39. junifer/data/coordinates/__init__.py +9 -0
  40. junifer/data/coordinates/__init__.pyi +5 -0
  41. junifer/data/coordinates/_ants_coordinates_warper.py +104 -0
  42. junifer/data/coordinates/_coordinates.py +385 -0
  43. junifer/data/coordinates/_fsl_coordinates_warper.py +81 -0
  44. junifer/data/{tests → coordinates/tests}/test_coordinates.py +26 -33
  45. junifer/data/masks/__init__.py +9 -0
  46. junifer/data/masks/__init__.pyi +6 -0
  47. junifer/data/masks/_ants_mask_warper.py +177 -0
  48. junifer/data/masks/_fsl_mask_warper.py +106 -0
  49. junifer/data/masks/_masks.py +802 -0
  50. junifer/data/{tests → masks/tests}/test_masks.py +67 -63
  51. junifer/data/parcellations/__init__.py +9 -0
  52. junifer/data/parcellations/__init__.pyi +6 -0
  53. junifer/data/parcellations/_ants_parcellation_warper.py +166 -0
  54. junifer/data/parcellations/_fsl_parcellation_warper.py +89 -0
  55. junifer/data/parcellations/_parcellations.py +1388 -0
  56. junifer/data/{tests → parcellations/tests}/test_parcellations.py +165 -295
  57. junifer/data/pipeline_data_registry_base.py +76 -0
  58. junifer/data/py.typed +0 -0
  59. junifer/data/template_spaces.py +44 -79
  60. junifer/data/tests/test_data_utils.py +1 -2
  61. junifer/data/tests/test_template_spaces.py +8 -4
  62. junifer/data/utils.py +109 -4
  63. junifer/datagrabber/__init__.py +2 -26
  64. junifer/datagrabber/__init__.pyi +27 -0
  65. junifer/datagrabber/aomic/__init__.py +2 -4
  66. junifer/datagrabber/aomic/__init__.pyi +5 -0
  67. junifer/datagrabber/aomic/id1000.py +81 -52
  68. junifer/datagrabber/aomic/piop1.py +83 -55
  69. junifer/datagrabber/aomic/piop2.py +85 -56
  70. junifer/datagrabber/aomic/py.typed +0 -0
  71. junifer/datagrabber/aomic/tests/test_id1000.py +19 -12
  72. junifer/datagrabber/aomic/tests/test_piop1.py +52 -18
  73. junifer/datagrabber/aomic/tests/test_piop2.py +50 -17
  74. junifer/datagrabber/base.py +22 -18
  75. junifer/datagrabber/datalad_base.py +71 -34
  76. junifer/datagrabber/dmcc13_benchmark.py +31 -18
  77. junifer/datagrabber/hcp1200/__init__.py +2 -3
  78. junifer/datagrabber/hcp1200/__init__.pyi +4 -0
  79. junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
  80. junifer/datagrabber/hcp1200/hcp1200.py +26 -15
  81. junifer/datagrabber/hcp1200/py.typed +0 -0
  82. junifer/datagrabber/hcp1200/tests/test_hcp1200.py +8 -2
  83. junifer/datagrabber/multiple.py +14 -9
  84. junifer/datagrabber/pattern.py +132 -96
  85. junifer/datagrabber/pattern_validation_mixin.py +206 -94
  86. junifer/datagrabber/py.typed +0 -0
  87. junifer/datagrabber/tests/test_datalad_base.py +27 -12
  88. junifer/datagrabber/tests/test_dmcc13_benchmark.py +28 -11
  89. junifer/datagrabber/tests/test_multiple.py +48 -2
  90. junifer/datagrabber/tests/test_pattern_datalad.py +1 -1
  91. junifer/datagrabber/tests/test_pattern_validation_mixin.py +6 -6
  92. junifer/datareader/__init__.py +2 -2
  93. junifer/datareader/__init__.pyi +3 -0
  94. junifer/datareader/default.py +6 -6
  95. junifer/datareader/py.typed +0 -0
  96. junifer/external/nilearn/__init__.py +2 -3
  97. junifer/external/nilearn/__init__.pyi +4 -0
  98. junifer/external/nilearn/junifer_connectivity_measure.py +25 -17
  99. junifer/external/nilearn/junifer_nifti_spheres_masker.py +4 -4
  100. junifer/external/nilearn/py.typed +0 -0
  101. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +17 -16
  102. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +2 -3
  103. junifer/markers/__init__.py +2 -38
  104. junifer/markers/__init__.pyi +37 -0
  105. junifer/markers/base.py +11 -14
  106. junifer/markers/brainprint.py +12 -14
  107. junifer/markers/complexity/__init__.py +2 -18
  108. junifer/markers/complexity/__init__.pyi +17 -0
  109. junifer/markers/complexity/complexity_base.py +9 -11
  110. junifer/markers/complexity/hurst_exponent.py +7 -7
  111. junifer/markers/complexity/multiscale_entropy_auc.py +7 -7
  112. junifer/markers/complexity/perm_entropy.py +7 -7
  113. junifer/markers/complexity/py.typed +0 -0
  114. junifer/markers/complexity/range_entropy.py +7 -7
  115. junifer/markers/complexity/range_entropy_auc.py +7 -7
  116. junifer/markers/complexity/sample_entropy.py +7 -7
  117. junifer/markers/complexity/tests/test_complexity_base.py +1 -1
  118. junifer/markers/complexity/tests/test_hurst_exponent.py +5 -5
  119. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +5 -5
  120. junifer/markers/complexity/tests/test_perm_entropy.py +5 -5
  121. junifer/markers/complexity/tests/test_range_entropy.py +5 -5
  122. junifer/markers/complexity/tests/test_range_entropy_auc.py +5 -5
  123. junifer/markers/complexity/tests/test_sample_entropy.py +5 -5
  124. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +5 -5
  125. junifer/markers/complexity/weighted_perm_entropy.py +7 -7
  126. junifer/markers/ets_rss.py +12 -11
  127. junifer/markers/falff/__init__.py +2 -3
  128. junifer/markers/falff/__init__.pyi +4 -0
  129. junifer/markers/falff/_afni_falff.py +38 -45
  130. junifer/markers/falff/_junifer_falff.py +16 -19
  131. junifer/markers/falff/falff_base.py +7 -11
  132. junifer/markers/falff/falff_parcels.py +9 -9
  133. junifer/markers/falff/falff_spheres.py +8 -8
  134. junifer/markers/falff/py.typed +0 -0
  135. junifer/markers/falff/tests/test_falff_spheres.py +3 -1
  136. junifer/markers/functional_connectivity/__init__.py +2 -12
  137. junifer/markers/functional_connectivity/__init__.pyi +13 -0
  138. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +9 -8
  139. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +8 -8
  140. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +7 -7
  141. junifer/markers/functional_connectivity/functional_connectivity_base.py +13 -12
  142. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +8 -8
  143. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +7 -7
  144. junifer/markers/functional_connectivity/py.typed +0 -0
  145. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +1 -2
  146. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +1 -2
  147. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +6 -6
  148. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +5 -5
  149. junifer/markers/parcel_aggregation.py +22 -17
  150. junifer/markers/py.typed +0 -0
  151. junifer/markers/reho/__init__.py +2 -3
  152. junifer/markers/reho/__init__.pyi +4 -0
  153. junifer/markers/reho/_afni_reho.py +29 -35
  154. junifer/markers/reho/_junifer_reho.py +13 -14
  155. junifer/markers/reho/py.typed +0 -0
  156. junifer/markers/reho/reho_base.py +7 -11
  157. junifer/markers/reho/reho_parcels.py +10 -10
  158. junifer/markers/reho/reho_spheres.py +9 -9
  159. junifer/markers/sphere_aggregation.py +22 -17
  160. junifer/markers/temporal_snr/__init__.py +2 -3
  161. junifer/markers/temporal_snr/__init__.pyi +4 -0
  162. junifer/markers/temporal_snr/py.typed +0 -0
  163. junifer/markers/temporal_snr/temporal_snr_base.py +11 -10
  164. junifer/markers/temporal_snr/temporal_snr_parcels.py +8 -8
  165. junifer/markers/temporal_snr/temporal_snr_spheres.py +7 -7
  166. junifer/markers/tests/test_ets_rss.py +3 -3
  167. junifer/markers/tests/test_parcel_aggregation.py +24 -24
  168. junifer/markers/tests/test_sphere_aggregation.py +6 -6
  169. junifer/markers/utils.py +3 -3
  170. junifer/onthefly/__init__.py +2 -1
  171. junifer/onthefly/_brainprint.py +138 -0
  172. junifer/onthefly/read_transform.py +5 -8
  173. junifer/pipeline/__init__.py +2 -10
  174. junifer/pipeline/__init__.pyi +13 -0
  175. junifer/{markers/collection.py → pipeline/marker_collection.py} +8 -14
  176. junifer/pipeline/pipeline_component_registry.py +294 -0
  177. junifer/pipeline/pipeline_step_mixin.py +15 -11
  178. junifer/pipeline/py.typed +0 -0
  179. junifer/{markers/tests/test_collection.py → pipeline/tests/test_marker_collection.py} +2 -3
  180. junifer/pipeline/tests/test_pipeline_component_registry.py +200 -0
  181. junifer/pipeline/tests/test_pipeline_step_mixin.py +36 -37
  182. junifer/pipeline/tests/test_update_meta_mixin.py +4 -4
  183. junifer/pipeline/tests/test_workdir_manager.py +43 -0
  184. junifer/pipeline/update_meta_mixin.py +21 -17
  185. junifer/pipeline/utils.py +6 -6
  186. junifer/pipeline/workdir_manager.py +19 -5
  187. junifer/preprocess/__init__.py +2 -10
  188. junifer/preprocess/__init__.pyi +11 -0
  189. junifer/preprocess/base.py +10 -10
  190. junifer/preprocess/confounds/__init__.py +2 -2
  191. junifer/preprocess/confounds/__init__.pyi +3 -0
  192. junifer/preprocess/confounds/fmriprep_confound_remover.py +243 -64
  193. junifer/preprocess/confounds/py.typed +0 -0
  194. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +121 -14
  195. junifer/preprocess/py.typed +0 -0
  196. junifer/preprocess/smoothing/__init__.py +2 -2
  197. junifer/preprocess/smoothing/__init__.pyi +3 -0
  198. junifer/preprocess/smoothing/_afni_smoothing.py +40 -40
  199. junifer/preprocess/smoothing/_fsl_smoothing.py +22 -32
  200. junifer/preprocess/smoothing/_nilearn_smoothing.py +35 -14
  201. junifer/preprocess/smoothing/py.typed +0 -0
  202. junifer/preprocess/smoothing/smoothing.py +11 -13
  203. junifer/preprocess/warping/__init__.py +2 -2
  204. junifer/preprocess/warping/__init__.pyi +3 -0
  205. junifer/preprocess/warping/_ants_warper.py +136 -32
  206. junifer/preprocess/warping/_fsl_warper.py +73 -22
  207. junifer/preprocess/warping/py.typed +0 -0
  208. junifer/preprocess/warping/space_warper.py +39 -11
  209. junifer/preprocess/warping/tests/test_space_warper.py +5 -9
  210. junifer/py.typed +0 -0
  211. junifer/stats.py +5 -5
  212. junifer/storage/__init__.py +2 -10
  213. junifer/storage/__init__.pyi +11 -0
  214. junifer/storage/base.py +47 -13
  215. junifer/storage/hdf5.py +95 -33
  216. junifer/storage/pandas_base.py +12 -11
  217. junifer/storage/py.typed +0 -0
  218. junifer/storage/sqlite.py +11 -11
  219. junifer/storage/tests/test_hdf5.py +86 -4
  220. junifer/storage/tests/test_sqlite.py +2 -2
  221. junifer/storage/tests/test_storage_base.py +5 -2
  222. junifer/storage/tests/test_utils.py +33 -7
  223. junifer/storage/utils.py +95 -9
  224. junifer/testing/__init__.py +2 -3
  225. junifer/testing/__init__.pyi +4 -0
  226. junifer/testing/datagrabbers.py +10 -11
  227. junifer/testing/py.typed +0 -0
  228. junifer/testing/registry.py +4 -7
  229. junifer/testing/tests/test_testing_registry.py +9 -17
  230. junifer/tests/test_stats.py +2 -2
  231. junifer/typing/__init__.py +9 -0
  232. junifer/typing/__init__.pyi +31 -0
  233. junifer/typing/_typing.py +68 -0
  234. junifer/utils/__init__.py +2 -12
  235. junifer/utils/__init__.pyi +18 -0
  236. junifer/utils/_config.py +110 -0
  237. junifer/utils/_yaml.py +16 -0
  238. junifer/utils/helpers.py +6 -6
  239. junifer/utils/logging.py +117 -8
  240. junifer/utils/py.typed +0 -0
  241. junifer/{pipeline → utils}/singleton.py +19 -14
  242. junifer/utils/tests/test_config.py +59 -0
  243. {junifer-0.0.5.dev240.dist-info → junifer-0.0.6.dist-info}/METADATA +43 -38
  244. junifer-0.0.6.dist-info/RECORD +350 -0
  245. {junifer-0.0.5.dev240.dist-info → junifer-0.0.6.dist-info}/WHEEL +1 -1
  246. junifer-0.0.6.dist-info/entry_points.txt +2 -0
  247. junifer/api/parser.py +0 -118
  248. junifer/data/coordinates.py +0 -408
  249. junifer/data/masks.py +0 -670
  250. junifer/data/parcellations.py +0 -1828
  251. junifer/pipeline/registry.py +0 -177
  252. junifer/pipeline/tests/test_registry.py +0 -150
  253. junifer-0.0.5.dev240.dist-info/RECORD +0 -275
  254. junifer-0.0.5.dev240.dist-info/entry_points.txt +0 -2
  255. /junifer/{api → cli}/tests/data/gmd_mean.yaml +0 -0
  256. /junifer/{api → cli}/tests/data/gmd_mean_htcondor.yaml +0 -0
  257. /junifer/{api → cli}/tests/data/partly_cloudy_agg_mean_tian.yml +0 -0
  258. /junifer/data/{VOIs → coordinates/VOIs}/meta/AutobiographicalMemory_VOIs.txt +0 -0
  259. /junifer/data/{VOIs → coordinates/VOIs}/meta/CogAC_VOIs.txt +0 -0
  260. /junifer/data/{VOIs → coordinates/VOIs}/meta/CogAR_VOIs.txt +0 -0
  261. /junifer/data/{VOIs → coordinates/VOIs}/meta/DMNBuckner_VOIs.txt +0 -0
  262. /junifer/data/{VOIs → coordinates/VOIs}/meta/Dosenbach2010_MNI_VOIs.txt +0 -0
  263. /junifer/data/{VOIs → coordinates/VOIs}/meta/Empathy_VOIs.txt +0 -0
  264. /junifer/data/{VOIs → coordinates/VOIs}/meta/Motor_VOIs.txt +0 -0
  265. /junifer/data/{VOIs → coordinates/VOIs}/meta/MultiTask_VOIs.txt +0 -0
  266. /junifer/data/{VOIs → coordinates/VOIs}/meta/PhysioStress_VOIs.txt +0 -0
  267. /junifer/data/{VOIs → coordinates/VOIs}/meta/Power2011_MNI_VOIs.txt +0 -0
  268. /junifer/data/{VOIs → coordinates/VOIs}/meta/Power2013_MNI_VOIs.tsv +0 -0
  269. /junifer/data/{VOIs → coordinates/VOIs}/meta/Rew_VOIs.txt +0 -0
  270. /junifer/data/{VOIs → coordinates/VOIs}/meta/Somatosensory_VOIs.txt +0 -0
  271. /junifer/data/{VOIs → coordinates/VOIs}/meta/ToM_VOIs.txt +0 -0
  272. /junifer/data/{VOIs → coordinates/VOIs}/meta/VigAtt_VOIs.txt +0 -0
  273. /junifer/data/{VOIs → coordinates/VOIs}/meta/WM_VOIs.txt +0 -0
  274. /junifer/data/{VOIs → coordinates/VOIs}/meta/eMDN_VOIs.txt +0 -0
  275. /junifer/data/{VOIs → coordinates/VOIs}/meta/eSAD_VOIs.txt +0 -0
  276. /junifer/data/{VOIs → coordinates/VOIs}/meta/extDMN_VOIs.txt +0 -0
  277. {junifer-0.0.5.dev240.dist-info → junifer-0.0.6.dist-info/licenses}/AUTHORS.rst +0 -0
  278. {junifer-0.0.5.dev240.dist-info → junifer-0.0.6.dist-info/licenses}/LICENSE.md +0 -0
  279. {junifer-0.0.5.dev240.dist-info → junifer-0.0.6.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
 
7
- from typing import Any, Dict, List, Optional, Union
7
+ from typing import Any, Optional, Union
8
8
 
9
9
  import numpy as np
10
10
 
@@ -24,8 +24,8 @@ class ReHoParcels(ReHoBase):
24
24
  Parameters
25
25
  ----------
26
26
  parcellation : str or list of str
27
- The name(s) of the parcellation(s). Check valid options by calling
28
- :func:`.list_parcellations`.
27
+ The name(s) of the parcellation(s) to use.
28
+ See :func:`.list_data` for options.
29
29
  using : {"junifer", "afni"}
30
30
  Implementation to use for computing ReHo:
31
31
 
@@ -92,12 +92,12 @@ class ReHoParcels(ReHoBase):
92
92
 
93
93
  def __init__(
94
94
  self,
95
- parcellation: Union[str, List[str]],
95
+ parcellation: Union[str, list[str]],
96
96
  using: str,
97
- reho_params: Optional[Dict] = None,
97
+ reho_params: Optional[dict] = None,
98
98
  agg_method: str = "mean",
99
- agg_method_params: Optional[Dict] = None,
100
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
99
+ agg_method_params: Optional[dict] = None,
100
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
101
101
  name: Optional[str] = None,
102
102
  ) -> None:
103
103
  # Superclass init first to validate `using` parameter
@@ -110,9 +110,9 @@ class ReHoParcels(ReHoBase):
110
110
 
111
111
  def compute(
112
112
  self,
113
- input: Dict[str, Any],
114
- extra_input: Optional[Dict[str, Any]] = None,
115
- ) -> Dict[str, Any]:
113
+ input: dict[str, Any],
114
+ extra_input: Optional[dict[str, Any]] = None,
115
+ ) -> dict[str, Any]:
116
116
  """Compute.
117
117
 
118
118
  Parameters
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
 
7
- from typing import Any, Dict, List, Optional, Union
7
+ from typing import Any, Optional, Union
8
8
 
9
9
  import numpy as np
10
10
 
@@ -24,8 +24,8 @@ class ReHoSpheres(ReHoBase):
24
24
  Parameters
25
25
  ----------
26
26
  coords : str
27
- The name of the coordinates list to use. See
28
- :func:`.list_coordinates` for options.
27
+ The name of the coordinates list to use.
28
+ See :func:`.list_data` for options.
29
29
  using : {"junifer", "afni"}
30
30
  Implementation to use for computing ReHo:
31
31
 
@@ -107,10 +107,10 @@ class ReHoSpheres(ReHoBase):
107
107
  using: str,
108
108
  radius: Optional[float] = None,
109
109
  allow_overlap: bool = False,
110
- reho_params: Optional[Dict] = None,
110
+ reho_params: Optional[dict] = None,
111
111
  agg_method: str = "mean",
112
- agg_method_params: Optional[Dict] = None,
113
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
112
+ agg_method_params: Optional[dict] = None,
113
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
114
114
  name: Optional[str] = None,
115
115
  ) -> None:
116
116
  # Superclass init first to validate `using` parameter
@@ -125,9 +125,9 @@ class ReHoSpheres(ReHoBase):
125
125
 
126
126
  def compute(
127
127
  self,
128
- input: Dict[str, Any],
129
- extra_input: Optional[Dict[str, Any]] = None,
130
- ) -> Dict[str, Any]:
128
+ input: dict[str, Any],
129
+ extra_input: Optional[dict[str, Any]] = None,
130
+ ) -> dict[str, Any]:
131
131
  """Compute.
132
132
 
133
133
  Parameters
@@ -4,12 +4,13 @@
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
5
5
  # License: AGPL
6
6
 
7
- from typing import Any, ClassVar, Dict, List, Optional, Set, Union
7
+ from typing import Any, ClassVar, Optional, Union
8
8
 
9
9
  from ..api.decorators import register_marker
10
- from ..data import get_coordinates, get_mask
10
+ from ..data import get_data
11
11
  from ..external.nilearn import JuniferNiftiSpheresMasker
12
12
  from ..stats import get_aggfunc_by_name
13
+ from ..typing import Dependencies, MarkerInOutMappings
13
14
  from ..utils import logger, raise_error, warn_with_log
14
15
  from .base import BaseMarker
15
16
 
@@ -24,8 +25,8 @@ class SphereAggregation(BaseMarker):
24
25
  Parameters
25
26
  ----------
26
27
  coords : str
27
- The name of the coordinates list to use. See
28
- :func:`.list_coordinates` for options.
28
+ The name of the coordinates list to use.
29
+ See :func:`.list_data` for options.
29
30
  radius : float, optional
30
31
  The radius of the sphere in millimeters. If None, the signal will be
31
32
  extracted from a single voxel. See
@@ -66,9 +67,9 @@ class SphereAggregation(BaseMarker):
66
67
 
67
68
  """
68
69
 
69
- _DEPENDENCIES: ClassVar[Set[str]] = {"nilearn", "numpy"}
70
+ _DEPENDENCIES: ClassVar[Dependencies] = {"nilearn", "numpy"}
70
71
 
71
- _MARKER_INOUT_MAPPINGS: ClassVar[Dict[str, Dict[str, str]]] = {
72
+ _MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
72
73
  "T1w": {
73
74
  "aggregation": "vector",
74
75
  },
@@ -104,11 +105,11 @@ class SphereAggregation(BaseMarker):
104
105
  radius: Optional[float] = None,
105
106
  allow_overlap: bool = False,
106
107
  method: str = "mean",
107
- method_params: Optional[Dict[str, Any]] = None,
108
+ method_params: Optional[dict[str, Any]] = None,
108
109
  time_method: Optional[str] = None,
109
- time_method_params: Optional[Dict[str, Any]] = None,
110
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
111
- on: Union[List[str], str, None] = None,
110
+ time_method_params: Optional[dict[str, Any]] = None,
111
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
112
+ on: Union[list[str], str, None] = None,
112
113
  name: Optional[str] = None,
113
114
  ) -> None:
114
115
  self.coords = coords
@@ -135,9 +136,9 @@ class SphereAggregation(BaseMarker):
135
136
 
136
137
  def compute(
137
138
  self,
138
- input: Dict[str, Any],
139
- extra_input: Optional[Dict] = None,
140
- ) -> Dict:
139
+ input: dict[str, Any],
140
+ extra_input: Optional[dict] = None,
141
+ ) -> dict:
141
142
  """Compute.
142
143
 
143
144
  Parameters
@@ -177,8 +178,9 @@ class SphereAggregation(BaseMarker):
177
178
  )
178
179
 
179
180
  # Get seeds and labels tailored to target image
180
- coords, labels = get_coordinates(
181
- coords=self.coords,
181
+ coords, labels = get_data(
182
+ kind="coordinates",
183
+ names=self.coords,
182
184
  target_data=input,
183
185
  extra_input=extra_input,
184
186
  )
@@ -188,8 +190,11 @@ class SphereAggregation(BaseMarker):
188
190
  if self.masks is not None:
189
191
  logger.debug(f"Masking with {self.masks}")
190
192
  # Get tailored mask
191
- mask_img = get_mask(
192
- masks=self.masks, target_data=input, extra_input=extra_input
193
+ mask_img = get_data(
194
+ kind="mask",
195
+ names=self.masks,
196
+ target_data=input,
197
+ extra_input=extra_input,
193
198
  )
194
199
 
195
200
  # Initialize masker
@@ -3,8 +3,7 @@
3
3
  # Authors: Leonard Sasse <l.sasse@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from .temporal_snr_parcels import TemporalSNRParcels
7
- from .temporal_snr_spheres import TemporalSNRSpheres
6
+ import lazy_loader as lazy
8
7
 
9
8
 
10
- __all__ = ["TemporalSNRParcels", "TemporalSNRSpheres"]
9
+ __getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
@@ -0,0 +1,4 @@
1
+ __all__ = ["TemporalSNRParcels", "TemporalSNRSpheres"]
2
+
3
+ from .temporal_snr_parcels import TemporalSNRParcels
4
+ from .temporal_snr_spheres import TemporalSNRSpheres
File without changes
@@ -5,10 +5,11 @@
5
5
 
6
6
 
7
7
  from abc import abstractmethod
8
- from typing import Any, ClassVar, Dict, List, Optional, Set, Union
8
+ from typing import Any, ClassVar, Optional, Union
9
9
 
10
10
  from nilearn import image as nimg
11
11
 
12
+ from ...typing import Dependencies, MarkerInOutMappings
12
13
  from ...utils import raise_error
13
14
  from ..base import BaseMarker
14
15
 
@@ -37,9 +38,9 @@ class TemporalSNRBase(BaseMarker):
37
38
 
38
39
  """
39
40
 
40
- _DEPENDENCIES: ClassVar[Set[str]] = {"nilearn"}
41
+ _DEPENDENCIES: ClassVar[Dependencies] = {"nilearn"}
41
42
 
42
- _MARKER_INOUT_MAPPINGS: ClassVar[Dict[str, Dict[str, str]]] = {
43
+ _MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
43
44
  "BOLD": {
44
45
  "tsnr": "vector",
45
46
  },
@@ -48,8 +49,8 @@ class TemporalSNRBase(BaseMarker):
48
49
  def __init__(
49
50
  self,
50
51
  agg_method: str = "mean",
51
- agg_method_params: Optional[Dict] = None,
52
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
52
+ agg_method_params: Optional[dict] = None,
53
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
53
54
  name: Optional[str] = None,
54
55
  ) -> None:
55
56
  self.agg_method = agg_method
@@ -59,8 +60,8 @@ class TemporalSNRBase(BaseMarker):
59
60
 
60
61
  @abstractmethod
61
62
  def aggregate(
62
- self, input: Dict[str, Any], extra_input: Optional[Dict] = None
63
- ) -> Dict[str, Any]:
63
+ self, input: dict[str, Any], extra_input: Optional[dict] = None
64
+ ) -> dict[str, Any]:
64
65
  """Perform aggregation."""
65
66
  raise_error(
66
67
  msg="Concrete classes need to implement aggregate().",
@@ -69,9 +70,9 @@ class TemporalSNRBase(BaseMarker):
69
70
 
70
71
  def compute(
71
72
  self,
72
- input: Dict[str, Any],
73
- extra_input: Optional[Dict] = None,
74
- ) -> Dict:
73
+ input: dict[str, Any],
74
+ extra_input: Optional[dict] = None,
75
+ ) -> dict:
75
76
  """Compute.
76
77
 
77
78
  Parameters
@@ -3,7 +3,7 @@
3
3
  # Authors: Leonard Sasse <l.sasse@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from typing import Any, Dict, List, Optional, Union
6
+ from typing import Any, Optional, Union
7
7
 
8
8
  from ...api.decorators import register_marker
9
9
  from ..parcel_aggregation import ParcelAggregation
@@ -20,8 +20,8 @@ class TemporalSNRParcels(TemporalSNRBase):
20
20
  Parameters
21
21
  ----------
22
22
  parcellation : str or list of str
23
- The name(s) of the parcellation(s). Check valid options by calling
24
- :func:`.list_parcellations`.
23
+ The name(s) of the parcellation(s) to use.
24
+ See :func:`.list_data` for options.
25
25
  agg_method : str, optional
26
26
  The method to perform aggregation using. Check valid options in
27
27
  :func:`.get_aggfunc_by_name` (default "mean").
@@ -40,10 +40,10 @@ class TemporalSNRParcels(TemporalSNRBase):
40
40
 
41
41
  def __init__(
42
42
  self,
43
- parcellation: Union[str, List[str]],
43
+ parcellation: Union[str, list[str]],
44
44
  agg_method: str = "mean",
45
- agg_method_params: Optional[Dict] = None,
46
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
45
+ agg_method_params: Optional[dict] = None,
46
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
47
47
  name: Optional[str] = None,
48
48
  ) -> None:
49
49
  self.parcellation = parcellation
@@ -55,8 +55,8 @@ class TemporalSNRParcels(TemporalSNRBase):
55
55
  )
56
56
 
57
57
  def aggregate(
58
- self, input: Dict[str, Any], extra_input: Optional[Dict] = None
59
- ) -> Dict:
58
+ self, input: dict[str, Any], extra_input: Optional[dict] = None
59
+ ) -> dict:
60
60
  """Perform parcel aggregation.
61
61
 
62
62
  Parameters
@@ -3,7 +3,7 @@
3
3
  # Authors: Leonard Sasse <l.sasse@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from typing import Any, Dict, List, Optional, Union
6
+ from typing import Any, Optional, Union
7
7
 
8
8
  from ...api.decorators import register_marker
9
9
  from ..sphere_aggregation import SphereAggregation
@@ -21,8 +21,8 @@ class TemporalSNRSpheres(TemporalSNRBase):
21
21
  Parameters
22
22
  ----------
23
23
  coords : str
24
- The name of the coordinates list to use. See
25
- :func:`.list_coordinates` for options.
24
+ The name of the coordinates list to use.
25
+ See :func:`.list_data` for options.
26
26
  radius : float, optional
27
27
  The radius of the sphere in mm. If None, the signal will be extracted
28
28
  from a single voxel. See :class:`nilearn.maskers.NiftiSpheresMasker`
@@ -53,8 +53,8 @@ class TemporalSNRSpheres(TemporalSNRBase):
53
53
  radius: Optional[float] = None,
54
54
  allow_overlap: bool = False,
55
55
  agg_method: str = "mean",
56
- agg_method_params: Optional[Dict] = None,
57
- masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
56
+ agg_method_params: Optional[dict] = None,
57
+ masks: Union[str, dict, list[Union[dict, str]], None] = None,
58
58
  name: Optional[str] = None,
59
59
  ) -> None:
60
60
  self.coords = coords
@@ -70,8 +70,8 @@ class TemporalSNRSpheres(TemporalSNRBase):
70
70
  )
71
71
 
72
72
  def aggregate(
73
- self, input: Dict[str, Any], extra_input: Optional[Dict] = None
74
- ) -> Dict:
73
+ self, input: dict[str, Any], extra_input: Optional[dict] = None
74
+ ) -> dict:
75
75
  """Perform sphere aggregation.
76
76
 
77
77
  Parameters
@@ -10,7 +10,7 @@ from pathlib import Path
10
10
 
11
11
  from nilearn.maskers import NiftiLabelsMasker
12
12
 
13
- from junifer.data import get_parcellation
13
+ from junifer.data import ParcellationRegistry
14
14
  from junifer.datareader import DefaultDataReader
15
15
  from junifer.markers.ets_rss import RSSETSMarker
16
16
  from junifer.storage import SQLiteFeatureStorage
@@ -32,8 +32,8 @@ def test_compute() -> None:
32
32
 
33
33
  # Compare with nilearn
34
34
  # Load testing parcellation
35
- test_parcellation, _ = get_parcellation(
36
- parcellation=[PARCELLATION],
35
+ test_parcellation, _ = ParcellationRegistry().get(
36
+ parcellations=[PARCELLATION],
37
37
  target_data=element_data["BOLD"],
38
38
  )
39
39
  # Extract timeseries
@@ -16,7 +16,7 @@ from nilearn.masking import compute_brain_mask
16
16
  from numpy.testing import assert_array_almost_equal, assert_array_equal
17
17
  from scipy.stats import trim_mean
18
18
 
19
- from junifer.data import get_mask, get_parcellation, register_parcellation
19
+ from junifer.data import MaskRegistry, ParcellationRegistry
20
20
  from junifer.datareader import DefaultDataReader
21
21
  from junifer.markers.parcel_aggregation import ParcelAggregation
22
22
  from junifer.storage import SQLiteFeatureStorage
@@ -98,8 +98,8 @@ def test_ParcelAggregation_3D() -> None:
98
98
 
99
99
  # Compare with nilearn
100
100
  # Load testing parcellation
101
- testing_parcellation, _ = get_parcellation(
102
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
101
+ testing_parcellation, _ = ParcellationRegistry().get(
102
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
103
103
  target_data=element_data["BOLD"],
104
104
  )
105
105
  # Binarize parcellation
@@ -206,8 +206,8 @@ def test_ParcelAggregation_4D():
206
206
 
207
207
  # Compare with nilearn
208
208
  # Load testing parcellation
209
- testing_parcellation, _ = get_parcellation(
210
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
209
+ testing_parcellation, _ = ParcellationRegistry().get(
210
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
211
211
  target_data=element_data["BOLD"],
212
212
  )
213
213
  # Extract data
@@ -295,12 +295,12 @@ def test_ParcelAggregation_3D_mask() -> None:
295
295
 
296
296
  # Compare with nilearn
297
297
  # Load testing parcellation
298
- testing_parcellation, _ = get_parcellation(
299
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
298
+ testing_parcellation, _ = ParcellationRegistry().get(
299
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
300
300
  target_data=element_data["BOLD"],
301
301
  )
302
302
  # Load mask
303
- mask_img = get_mask(
303
+ mask_img = MaskRegistry().get(
304
304
  "compute_brain_mask", target_data=element_data["BOLD"]
305
305
  )
306
306
  # Extract data
@@ -328,8 +328,8 @@ def test_ParcelAggregation_3D_mask_computed() -> None:
328
328
 
329
329
  # Compare with nilearn
330
330
  # Load testing parcellation
331
- testing_parcellation, _ = get_parcellation(
332
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
331
+ testing_parcellation, _ = ParcellationRegistry().get(
332
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
333
333
  target_data=element_data["BOLD"],
334
334
  )
335
335
  # Get a mask
@@ -396,8 +396,8 @@ def test_ParcelAggregation_3D_multiple_non_overlapping(tmp_path: Path) -> None:
396
396
  ]
397
397
 
398
398
  # Load testing parcellation
399
- testing_parcellation, labels = get_parcellation(
400
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
399
+ testing_parcellation, labels = ParcellationRegistry().get(
400
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
401
401
  target_data=element_data["BOLD"],
402
402
  )
403
403
 
@@ -424,14 +424,14 @@ def test_ParcelAggregation_3D_multiple_non_overlapping(tmp_path: Path) -> None:
424
424
  nib.save(parcellation1_img, parcellation1_path)
425
425
  nib.save(parcellation2_img, parcellation2_path)
426
426
 
427
- register_parcellation(
427
+ ParcellationRegistry().register(
428
428
  name="TianxS1x3TxMNInonlinear2009cAsym_low",
429
429
  parcellation_path=parcellation1_path,
430
430
  parcels_labels=labels1,
431
431
  space="MNI152NLin2009cAsym",
432
432
  overwrite=True,
433
433
  )
434
- register_parcellation(
434
+ ParcellationRegistry().register(
435
435
  name="TianxS1x3TxMNInonlinear2009cAsym_high",
436
436
  parcellation_path=parcellation2_path,
437
437
  parcels_labels=labels2,
@@ -498,8 +498,8 @@ def test_ParcelAggregation_3D_multiple_overlapping(tmp_path: Path) -> None:
498
498
  ]
499
499
 
500
500
  # Load testing parcellation
501
- testing_parcellation, labels = get_parcellation(
502
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
501
+ testing_parcellation, labels = ParcellationRegistry().get(
502
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
503
503
  target_data=element_data["BOLD"],
504
504
  )
505
505
 
@@ -528,14 +528,14 @@ def test_ParcelAggregation_3D_multiple_overlapping(tmp_path: Path) -> None:
528
528
  nib.save(parcellation1_img, parcellation1_path)
529
529
  nib.save(parcellation2_img, parcellation2_path)
530
530
 
531
- register_parcellation(
531
+ ParcellationRegistry().register(
532
532
  name="TianxS1x3TxMNInonlinear2009cAsym_low",
533
533
  parcellation_path=parcellation1_path,
534
534
  parcels_labels=labels1,
535
535
  space="MNI152NLin2009cAsym",
536
536
  overwrite=True,
537
537
  )
538
- register_parcellation(
538
+ ParcellationRegistry().register(
539
539
  name="TianxS1x3TxMNInonlinear2009cAsym_high",
540
540
  parcellation_path=parcellation2_path,
541
541
  parcels_labels=labels2,
@@ -609,8 +609,8 @@ def test_ParcelAggregation_3D_multiple_duplicated_labels(
609
609
  ]
610
610
 
611
611
  # Load testing parcellation
612
- testing_parcellation, labels = get_parcellation(
613
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
612
+ testing_parcellation, labels = ParcellationRegistry().get(
613
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
614
614
  target_data=element_data["BOLD"],
615
615
  )
616
616
 
@@ -637,14 +637,14 @@ def test_ParcelAggregation_3D_multiple_duplicated_labels(
637
637
  nib.save(parcellation1_img, parcellation1_path)
638
638
  nib.save(parcellation2_img, parcellation2_path)
639
639
 
640
- register_parcellation(
640
+ ParcellationRegistry().register(
641
641
  name="TianxS1x3TxMNInonlinear2009cAsym_low",
642
642
  parcellation_path=parcellation1_path,
643
643
  parcels_labels=labels1,
644
644
  space="MNI152NLin2009cAsym",
645
645
  overwrite=True,
646
646
  )
647
- register_parcellation(
647
+ ParcellationRegistry().register(
648
648
  name="TianxS1x3TxMNInonlinear2009cAsym_high",
649
649
  parcellation_path=parcellation2_path,
650
650
  parcels_labels=labels2,
@@ -719,8 +719,8 @@ def test_ParcelAggregation_4D_agg_time():
719
719
 
720
720
  # Compare with nilearn
721
721
  # Loading testing parcellation
722
- testing_parcellation, _ = get_parcellation(
723
- parcellation=["TianxS1x3TxMNInonlinear2009cAsym"],
722
+ testing_parcellation, _ = ParcellationRegistry().get(
723
+ parcellations=["TianxS1x3TxMNInonlinear2009cAsym"],
724
724
  target_data=element_data["BOLD"],
725
725
  )
726
726
  # Extract data
@@ -10,7 +10,7 @@ import pytest
10
10
  from nilearn.maskers import NiftiSpheresMasker
11
11
  from numpy.testing import assert_array_equal
12
12
 
13
- from junifer.data import get_coordinates, get_mask
13
+ from junifer.data import CoordinatesRegistry, MaskRegistry
14
14
  from junifer.datareader import DefaultDataReader
15
15
  from junifer.markers.sphere_aggregation import SphereAggregation
16
16
  from junifer.storage import SQLiteFeatureStorage
@@ -100,7 +100,7 @@ def test_SphereAggregation_3D() -> None:
100
100
 
101
101
  # Compare with nilearn
102
102
  # Load testing coordinates
103
- testing_coords, _ = get_coordinates(
103
+ testing_coords, _ = CoordinatesRegistry().get(
104
104
  coords=COORDS, target_data=element_data["VBM_GM"]
105
105
  )
106
106
  # Extract data
@@ -132,7 +132,7 @@ def test_SphereAggregation_4D() -> None:
132
132
 
133
133
  # Compare with nilearn
134
134
  # Load testing coordinates
135
- testing_coords, _ = get_coordinates(
135
+ testing_coords, _ = CoordinatesRegistry().get(
136
136
  coords=COORDS, target_data=element_data["BOLD"]
137
137
  )
138
138
  # Extract data
@@ -210,11 +210,11 @@ def test_SphereAggregation_3D_mask() -> None:
210
210
 
211
211
  # Compare with nilearn
212
212
  # Load testing coordinates
213
- testing_coords, _ = get_coordinates(
213
+ testing_coords, _ = CoordinatesRegistry().get(
214
214
  coords=COORDS, target_data=element_data["VBM_GM"]
215
215
  )
216
216
  # Load mask
217
- mask_img = get_mask(
217
+ mask_img = MaskRegistry().get(
218
218
  "compute_brain_mask", target_data=element_data["VBM_GM"]
219
219
  )
220
220
  # Extract data
@@ -253,7 +253,7 @@ def test_SphereAggregation_4D_agg_time() -> None:
253
253
 
254
254
  # Compare with nilearn
255
255
  # Load testing coordinates
256
- testing_coords, _ = get_coordinates(
256
+ testing_coords, _ = CoordinatesRegistry().get(
257
257
  coords=COORDS, target_data=element_data["BOLD"]
258
258
  )
259
259
  # Extract data
junifer/markers/utils.py CHANGED
@@ -8,7 +8,7 @@
8
8
  # Amir Omidvarnia <a.omidvarnia@fz-juelich.de>
9
9
  # License: AGPL
10
10
 
11
- from typing import Callable, List, Optional, Tuple, Union
11
+ from typing import Callable, Optional, Union
12
12
 
13
13
  import numpy as np
14
14
  import pandas as pd
@@ -19,8 +19,8 @@ from ..utils import raise_error
19
19
 
20
20
  def _ets(
21
21
  bold_ts: np.ndarray,
22
- roi_names: Union[None, List[str]] = None,
23
- ) -> Tuple[np.ndarray, Optional[List[str]]]:
22
+ roi_names: Union[None, list[str]] = None,
23
+ ) -> tuple[np.ndarray, Optional[list[str]]]:
24
24
  """Compute the edge-wise time series based on BOLD time series.
25
25
 
26
26
  Take a timeseries of brain areas, and calculate timeseries for each
@@ -4,6 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  from .read_transform import read_transform
7
+ from . import _brainprint as brainprint
7
8
 
8
9
 
9
- __all__ = ["read_transform"]
10
+ __all__ = ["read_transform", "brainprint"]