junifer 0.0.7.dev18__py3-none-any.whl → 0.0.7.dev43__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 (89) hide show
  1. junifer/_version.py +2 -2
  2. junifer/api/decorators.py +0 -1
  3. junifer/api/functions.py +1 -2
  4. junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -7
  5. junifer/api/queue_context/htcondor_adapter.py +6 -10
  6. junifer/cli/tests/test_parser.py +66 -0
  7. junifer/data/_dispatch.py +5 -5
  8. junifer/data/coordinates/_ants_coordinates_warper.py +1 -1
  9. junifer/data/coordinates/_coordinates.py +1 -1
  10. junifer/data/coordinates/_fsl_coordinates_warper.py +1 -1
  11. junifer/data/coordinates/tests/test_coordinates.py +38 -16
  12. junifer/data/masks/_ants_mask_warper.py +1 -1
  13. junifer/data/masks/_fsl_mask_warper.py +1 -1
  14. junifer/data/masks/tests/test_masks.py +66 -33
  15. junifer/data/parcellations/_ants_parcellation_warper.py +1 -1
  16. junifer/data/parcellations/_fsl_parcellation_warper.py +1 -1
  17. junifer/data/parcellations/_parcellations.py +7 -7
  18. junifer/data/parcellations/tests/test_parcellations.py +162 -76
  19. junifer/data/tests/test_data_utils.py +0 -1
  20. junifer/data/utils.py +1 -1
  21. junifer/datagrabber/aomic/id1000.py +6 -0
  22. junifer/datagrabber/aomic/piop1.py +4 -3
  23. junifer/datagrabber/aomic/piop2.py +4 -3
  24. junifer/datagrabber/pattern_datalad.py +0 -1
  25. junifer/datagrabber/pattern_validation_mixin.py +0 -1
  26. junifer/datagrabber/tests/test_dmcc13_benchmark.py +4 -8
  27. junifer/markers/base.py +3 -3
  28. junifer/markers/brainprint.py +5 -5
  29. junifer/markers/complexity/multiscale_entropy_auc.py +3 -3
  30. junifer/markers/complexity/range_entropy.py +3 -3
  31. junifer/markers/complexity/sample_entropy.py +3 -3
  32. junifer/markers/falff/falff_parcels.py +2 -6
  33. junifer/markers/falff/falff_spheres.py +2 -6
  34. junifer/markers/functional_connectivity/functional_connectivity_base.py +0 -1
  35. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +2 -1
  36. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +2 -1
  37. junifer/markers/reho/_afni_reho.py +1 -1
  38. junifer/markers/reho/reho_base.py +0 -1
  39. junifer/markers/reho/reho_parcels.py +0 -1
  40. junifer/markers/reho/reho_spheres.py +0 -1
  41. junifer/markers/temporal_snr/temporal_snr_base.py +0 -1
  42. junifer/markers/tests/test_markers_base.py +0 -1
  43. junifer/onthefly/_brainprint.py +3 -3
  44. junifer/onthefly/read_transform.py +1 -2
  45. junifer/onthefly/tests/test_read_transform.py +0 -1
  46. junifer/pipeline/tests/test_marker_collection.py +2 -1
  47. junifer/pipeline/workdir_manager.py +1 -2
  48. junifer/preprocess/confounds/fmriprep_confound_remover.py +1 -1
  49. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +0 -1
  50. junifer/preprocess/smoothing/tests/test_smoothing.py +0 -1
  51. junifer/preprocess/warping/_ants_warper.py +2 -3
  52. junifer/preprocess/warping/_fsl_warper.py +1 -1
  53. junifer/preprocess/warping/space_warper.py +4 -2
  54. junifer/storage/pandas_base.py +3 -1
  55. junifer/storage/sqlite.py +3 -8
  56. junifer/storage/tests/test_pandas_base.py +6 -3
  57. junifer/storage/tests/test_storage_base.py +2 -1
  58. junifer/utils/logging.py +38 -128
  59. junifer/utils/tests/test_logging.py +12 -4
  60. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/METADATA +3 -2
  61. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/RECORD +66 -89
  62. junifer/data/coordinates/VOIs/meta/AutobiographicalMemory_VOIs.txt +0 -23
  63. junifer/data/coordinates/VOIs/meta/CogAC_VOIs.txt +0 -19
  64. junifer/data/coordinates/VOIs/meta/CogAR_VOIs.txt +0 -8
  65. junifer/data/coordinates/VOIs/meta/DMNBuckner_VOIs.txt +0 -6
  66. junifer/data/coordinates/VOIs/meta/Dosenbach2010_MNI_VOIs.txt +0 -160
  67. junifer/data/coordinates/VOIs/meta/Empathy_VOIs.txt +0 -22
  68. junifer/data/coordinates/VOIs/meta/Motor_VOIs.txt +0 -10
  69. junifer/data/coordinates/VOIs/meta/MultiTask_VOIs.txt +0 -9
  70. junifer/data/coordinates/VOIs/meta/PhysioStress_VOIs.txt +0 -18
  71. junifer/data/coordinates/VOIs/meta/Power2011_MNI_VOIs.txt +0 -264
  72. junifer/data/coordinates/VOIs/meta/Power2013_MNI_VOIs.tsv +0 -264
  73. junifer/data/coordinates/VOIs/meta/Rew_VOIs.txt +0 -25
  74. junifer/data/coordinates/VOIs/meta/Somatosensory_VOIs.txt +0 -10
  75. junifer/data/coordinates/VOIs/meta/ToM_VOIs.txt +0 -15
  76. junifer/data/coordinates/VOIs/meta/VigAtt_VOIs.txt +0 -16
  77. junifer/data/coordinates/VOIs/meta/WM_VOIs.txt +0 -23
  78. junifer/data/coordinates/VOIs/meta/eMDN_VOIs.txt +0 -17
  79. junifer/data/coordinates/VOIs/meta/eSAD_VOIs.txt +0 -12
  80. junifer/data/coordinates/VOIs/meta/extDMN_VOIs.txt +0 -16
  81. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  82. junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean.nii.gz +0 -0
  83. junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean_3mm.nii.gz +0 -0
  84. junifer/data/masks/vickery-patil/GMprob0.2_cortex_3mm_NA_rm.nii.gz +0 -0
  85. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/WHEEL +0 -0
  86. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/entry_points.txt +0 -0
  87. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/licenses/AUTHORS.rst +0 -0
  88. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/licenses/LICENSE.md +0 -0
  89. {junifer-0.0.7.dev18.dist-info → junifer-0.0.7.dev43.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,12 @@ import pytest
13
13
  from nilearn.image import new_img_like, resample_to_img
14
14
  from numpy.testing import assert_array_almost_equal, assert_array_equal
15
15
 
16
- from junifer.data import ParcellationRegistry
16
+ from junifer.data import (
17
+ get_data,
18
+ list_data,
19
+ load_data,
20
+ register_data,
21
+ )
17
22
  from junifer.data.parcellations import merge_parcellations
18
23
  from junifer.data.parcellations._parcellations import (
19
24
  _retrieve_aicha,
@@ -35,7 +40,8 @@ from junifer.testing.datagrabbers import (
35
40
  def test_register_built_in_check() -> None:
36
41
  """Test parcellation registration check for built-in parcellations."""
37
42
  with pytest.raises(ValueError, match=r"built-in parcellation"):
38
- ParcellationRegistry().register(
43
+ register_data(
44
+ kind="parcellation",
39
45
  name="SUITxSUIT",
40
46
  parcellation_path="testparc.nii.gz",
41
47
  parcels_labels=["1", "2", "3"],
@@ -46,34 +52,40 @@ def test_register_built_in_check() -> None:
46
52
 
47
53
  def test_list_incorrect() -> None:
48
54
  """Test incorrect information check for list parcellations."""
49
- assert "testparc" not in ParcellationRegistry().list
55
+ assert "testparc" not in list_data(kind="parcellation")
50
56
 
51
57
 
52
58
  def test_register_already_registered() -> None:
53
59
  """Test parcellation registration check for already registered."""
54
60
  # Register custom parcellation
55
- ParcellationRegistry().register(
61
+ register_data(
62
+ kind="parcellation",
56
63
  name="testparc",
57
64
  parcellation_path="testparc.nii.gz",
58
65
  parcels_labels=["1", "2", "3"],
59
66
  space="MNI152Lin",
60
67
  )
61
68
  assert (
62
- ParcellationRegistry()
63
- .load("testparc", target_space="MNI152Lin", path_only=True)[2]
64
- .name
69
+ load_data(
70
+ kind="parcellation",
71
+ name="testparc",
72
+ target_space="MNI152Lin",
73
+ path_only=True,
74
+ )[2].name
65
75
  == "testparc.nii.gz"
66
76
  )
67
77
 
68
78
  # Try registering again
69
79
  with pytest.raises(ValueError, match=r"already registered."):
70
- ParcellationRegistry().register(
80
+ register_data(
81
+ kind="parcellation",
71
82
  name="testparc",
72
83
  parcellation_path="testparc.nii.gz",
73
84
  parcels_labels=["1", "2", "3"],
74
85
  space="MNI152Lin",
75
86
  )
76
- ParcellationRegistry().register(
87
+ register_data(
88
+ kind="parcellation",
77
89
  name="testparc",
78
90
  parcellation_path="testparc2.nii.gz",
79
91
  parcels_labels=["1", "2", "3"],
@@ -82,9 +94,12 @@ def test_register_already_registered() -> None:
82
94
  )
83
95
 
84
96
  assert (
85
- ParcellationRegistry()
86
- .load("testparc", target_space="MNI152Lin", path_only=True)[2]
87
- .name
97
+ load_data(
98
+ kind="parcellation",
99
+ name="testparc",
100
+ target_space="MNI152Lin",
101
+ path_only=True,
102
+ )[2].name
88
103
  == "testparc2.nii.gz"
89
104
  )
90
105
 
@@ -98,27 +113,44 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
98
113
  The path to the test directory.
99
114
 
100
115
  """
101
- schaefer, labels, schaefer_path, _ = ParcellationRegistry().load(
102
- "Schaefer100x7",
103
- "MNI152NLin6Asym",
116
+ schaefer, labels, schaefer_path, _ = load_data(
117
+ kind="parcellation",
118
+ name="Schaefer100x7",
119
+ target_space="MNI152NLin6Asym",
104
120
  )
105
121
  assert schaefer is not None
106
122
 
107
123
  # Test wrong number of labels
108
- ParcellationRegistry().register(
109
- "WrongLabels", schaefer_path, labels[:10], "MNI152Lin"
124
+ register_data(
125
+ kind="parcellation",
126
+ name="WrongLabels",
127
+ parcellation_path=schaefer_path,
128
+ parcels_labels=labels[:10],
129
+ space="MNI152Lin",
110
130
  )
111
131
 
112
132
  with pytest.raises(ValueError, match=r"has 100 parcels but 10"):
113
- ParcellationRegistry().load("WrongLabels", "MNI152NLin6Asym")
133
+ load_data(
134
+ kind="parcellation",
135
+ name="WrongLabels",
136
+ target_space="MNI152NLin6Asym",
137
+ )
114
138
 
115
139
  # Test wrong number of labels
116
- ParcellationRegistry().register(
117
- "WrongLabels2", schaefer_path, [*labels, "wrong"], "MNI152Lin"
140
+ register_data(
141
+ kind="parcellation",
142
+ name="WrongLabels2",
143
+ parcellation_path=schaefer_path,
144
+ parcels_labels=[*labels, "wrong"],
145
+ space="MNI152Lin",
118
146
  )
119
147
 
120
148
  with pytest.raises(ValueError, match=r"has 100 parcels but 101"):
121
- ParcellationRegistry().load("WrongLabels2", "MNI152NLin6Asym")
149
+ load_data(
150
+ kind="parcellation",
151
+ name="WrongLabels2",
152
+ target_space="MNI152NLin6Asym",
153
+ )
122
154
 
123
155
  schaefer_data = schaefer.get_fdata().copy()
124
156
  schaefer_data[schaefer_data == 50] = 0
@@ -126,11 +158,19 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
126
158
  new_schaefer_img = new_img_like(schaefer, schaefer_data)
127
159
  nib.save(new_schaefer_img, new_schaefer_path)
128
160
 
129
- ParcellationRegistry().register(
130
- "WrongValues", new_schaefer_path, labels[:-1], "MNI152Lin"
161
+ register_data(
162
+ kind="parcellation",
163
+ name="WrongValues",
164
+ parcellation_path=new_schaefer_path,
165
+ parcels_labels=labels[:-1],
166
+ space="MNI152Lin",
131
167
  )
132
168
  with pytest.raises(ValueError, match=r"must have all the values in the"):
133
- ParcellationRegistry().load("WrongValues", "MNI152NLin6Asym")
169
+ load_data(
170
+ kind="parcellation",
171
+ name="WrongValues",
172
+ target_space="MNI152NLin6Asym",
173
+ )
134
174
 
135
175
  schaefer_data = schaefer.get_fdata().copy()
136
176
  schaefer_data[schaefer_data == 50] = 200
@@ -138,11 +178,19 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
138
178
  new_schaefer_img = new_img_like(schaefer, schaefer_data)
139
179
  nib.save(new_schaefer_img, new_schaefer_path)
140
180
 
141
- ParcellationRegistry().register(
142
- "WrongValues2", new_schaefer_path, labels, "MNI152Lin"
181
+ register_data(
182
+ kind="parcellation",
183
+ name="WrongValues2",
184
+ parcellation_path=new_schaefer_path,
185
+ parcels_labels=labels,
186
+ space="MNI152Lin",
143
187
  )
144
188
  with pytest.raises(ValueError, match=r"must have all the values in the"):
145
- ParcellationRegistry().load("WrongValues2", "MNI152NLin6Asym")
189
+ load_data(
190
+ kind="parcellation",
191
+ name="WrongValues2",
192
+ target_space="MNI152NLin6Asym",
193
+ )
146
194
 
147
195
 
148
196
  @pytest.mark.parametrize(
@@ -195,7 +243,8 @@ def test_register(
195
243
 
196
244
  """
197
245
  # Register custom parcellation
198
- ParcellationRegistry().register(
246
+ register_data(
247
+ kind="parcellation",
199
248
  name=name,
200
249
  parcellation_path=parcellation_path,
201
250
  parcels_labels=parcels_labels,
@@ -203,10 +252,13 @@ def test_register(
203
252
  overwrite=overwrite,
204
253
  )
205
254
  # List available parcellation and check registration
206
- assert name in ParcellationRegistry().list
255
+ assert name in list_data(kind="parcellation")
207
256
  # Load registered parcellation
208
- _, lbl, fname, parcellation_space = ParcellationRegistry().load(
209
- name=name, target_space=space, path_only=True
257
+ _, lbl, fname, parcellation_space = load_data(
258
+ kind="parcellation",
259
+ name=name,
260
+ target_space=space,
261
+ path_only=True,
210
262
  )
211
263
  # Check values for registered parcellation
212
264
  assert lbl == parcels_labels
@@ -237,13 +289,17 @@ def test_list_correct(parcellation_name: str) -> None:
237
289
  The parametrized parcellation name.
238
290
 
239
291
  """
240
- assert parcellation_name in ParcellationRegistry().list
292
+ assert parcellation_name in list_data(kind="parcellation")
241
293
 
242
294
 
243
295
  def test_load_incorrect() -> None:
244
296
  """Test loading of invalid parcellations."""
245
297
  with pytest.raises(ValueError, match=r"not found"):
246
- ParcellationRegistry().load("wrongparcellation", "MNI152NLin6Asym")
298
+ load_data(
299
+ kind="parcellation",
300
+ name="wrongparcellation",
301
+ target_space="MNI152NLin6Asym",
302
+ )
247
303
 
248
304
 
249
305
  @pytest.mark.parametrize(
@@ -309,14 +365,15 @@ def test_schaefer(
309
365
 
310
366
  """
311
367
  parcellation_name = f"Schaefer{n_rois}x{yeo_networks}"
312
- assert parcellation_name in ParcellationRegistry().list
368
+ assert parcellation_name in list_data(kind="parcellation")
313
369
 
314
370
  parcellation_file = (
315
371
  f"Schaefer2018_{n_rois}Parcels_{yeo_networks}Networks_order_FSLMNI152_"
316
372
  f"{int(resolution)}mm.nii.gz"
317
373
  )
318
374
  # Load parcellation
319
- img, label, img_path, space = ParcellationRegistry().load(
375
+ img, label, img_path, space = load_data(
376
+ kind="parcellation",
320
377
  name=parcellation_name,
321
378
  target_space="MNI152NLin6Asym",
322
379
  resolution=resolution,
@@ -326,7 +383,8 @@ def test_schaefer(
326
383
  assert len(label) == n_rois
327
384
  assert space == "MNI152NLin6Asym"
328
385
  assert_array_equal(
329
- img.header["pixdim"][1:4], 3 * [resolution] # type: ignore
386
+ img.header["pixdim"][1:4],
387
+ 3 * [resolution], # type: ignore
330
388
  )
331
389
 
332
390
 
@@ -365,9 +423,10 @@ def test_suit(space_key: str, space: str) -> None:
365
423
  The parametrized space values.
366
424
 
367
425
  """
368
- assert f"SUITx{space_key}" in ParcellationRegistry().list
426
+ assert f"SUITx{space_key}" in list_data(kind="parcellation")
369
427
  # Load parcellation
370
- img, label, img_path, parcellation_space = ParcellationRegistry().load(
428
+ img, label, img_path, parcellation_space = load_data(
429
+ kind="parcellation",
371
430
  name=f"SUITx{space_key}",
372
431
  target_space=space,
373
432
  )
@@ -398,13 +457,14 @@ def test_tian_3T_6thgeneration(scale: int, n_label: int) -> None:
398
457
  The parametrized n_label values.
399
458
 
400
459
  """
401
- parcellations = ParcellationRegistry().list
460
+ parcellations = list_data(kind="parcellation")
402
461
  assert "TianxS1x3TxMNI6thgeneration" in parcellations
403
462
  assert "TianxS2x3TxMNI6thgeneration" in parcellations
404
463
  assert "TianxS3x3TxMNI6thgeneration" in parcellations
405
464
  assert "TianxS4x3TxMNI6thgeneration" in parcellations
406
465
  # Load parcellation
407
- img, lbl, fname, space = ParcellationRegistry().load(
466
+ img, lbl, fname, space = load_data(
467
+ kind="parcellation",
408
468
  name=f"TianxS{scale}x3TxMNI6thgeneration",
409
469
  target_space="MNI152NLin2009cAsym", # force highest resolution
410
470
  )
@@ -415,7 +475,8 @@ def test_tian_3T_6thgeneration(scale: int, n_label: int) -> None:
415
475
  assert len(lbl) == n_label
416
476
  assert_array_equal(img.header["pixdim"][1:4], [1, 1, 1])
417
477
  # Load parcellation
418
- img, lbl, fname, space = ParcellationRegistry().load(
478
+ img, lbl, fname, space = load_data(
479
+ kind="parcellation",
419
480
  name=f"TianxS{scale}x3TxMNI6thgeneration",
420
481
  target_space="MNI152NLin6Asym",
421
482
  resolution=2,
@@ -442,13 +503,14 @@ def test_tian_3T_nonlinear2009cAsym(scale: int, n_label: int) -> None:
442
503
  The parametrized n_label values.
443
504
 
444
505
  """
445
- parcellations = ParcellationRegistry().list
506
+ parcellations = list_data(kind="parcellation")
446
507
  assert "TianxS1x3TxMNInonlinear2009cAsym" in parcellations
447
508
  assert "TianxS2x3TxMNInonlinear2009cAsym" in parcellations
448
509
  assert "TianxS3x3TxMNInonlinear2009cAsym" in parcellations
449
510
  assert "TianxS4x3TxMNInonlinear2009cAsym" in parcellations
450
511
  # Load parcellation
451
- img, lbl, fname, space = ParcellationRegistry().load(
512
+ img, lbl, fname, space = load_data(
513
+ kind="parcellation",
452
514
  name=f"TianxS{scale}x3TxMNInonlinear2009cAsym",
453
515
  target_space="MNI152NLin6Asym", # force highest resolution
454
516
  )
@@ -459,7 +521,8 @@ def test_tian_3T_nonlinear2009cAsym(scale: int, n_label: int) -> None:
459
521
  assert len(lbl) == n_label
460
522
  assert_array_equal(img.header["pixdim"][1:4], [1, 1, 1])
461
523
  # Load parcellation
462
- img, lbl, fname, space = ParcellationRegistry().load(
524
+ img, lbl, fname, space = load_data(
525
+ kind="parcellation",
463
526
  name=f"TianxS{scale}x3TxMNInonlinear2009cAsym",
464
527
  target_space="MNI152NLin2009cAsym",
465
528
  resolution=2,
@@ -486,13 +549,14 @@ def test_tian_7T_6thgeneration(scale: int, n_label: int) -> None:
486
549
  The parametrized n_label values.
487
550
 
488
551
  """
489
- parcellations = ParcellationRegistry().list
552
+ parcellations = list_data(kind="parcellation")
490
553
  assert "TianxS1x7TxMNI6thgeneration" in parcellations
491
554
  assert "TianxS2x7TxMNI6thgeneration" in parcellations
492
555
  assert "TianxS3x7TxMNI6thgeneration" in parcellations
493
556
  assert "TianxS4x7TxMNI6thgeneration" in parcellations
494
557
  # Load parcellation
495
- img, lbl, fname, space = ParcellationRegistry().load(
558
+ img, lbl, fname, space = load_data(
559
+ kind="parcellation",
496
560
  name=f"TianxS{scale}x7TxMNI6thgeneration",
497
561
  target_space="MNI152NLin6Asym",
498
562
  )
@@ -502,7 +566,8 @@ def test_tian_7T_6thgeneration(scale: int, n_label: int) -> None:
502
566
  assert space == "MNI152NLin6Asym"
503
567
  assert len(lbl) == n_label
504
568
  assert_array_almost_equal(
505
- img.header["pixdim"][1:4], [1.6, 1.6, 1.6] # type: ignore
569
+ img.header["pixdim"][1:4],
570
+ [1.6, 1.6, 1.6], # type: ignore
506
571
  )
507
572
 
508
573
 
@@ -552,9 +617,10 @@ def test_aicha(version: int) -> None:
552
617
  The parametrized version values.
553
618
 
554
619
  """
555
- assert f"AICHA_v{version}" in ParcellationRegistry().list
620
+ assert f"AICHA_v{version}" in list_data(kind="parcellation")
556
621
  # Load parcellation
557
- img, label, img_path, space = ParcellationRegistry().load(
622
+ img, label, img_path, space = load_data(
623
+ kind="parcellation",
558
624
  name=f"AICHA_v{version}",
559
625
  target_space="IXI549Space",
560
626
  )
@@ -610,9 +676,10 @@ def test_shen(
610
676
  The parametrized partial file names.
611
677
 
612
678
  """
613
- assert f"Shen_{year}_{n_rois}" in ParcellationRegistry().list
679
+ assert f"Shen_{year}_{n_rois}" in list_data(kind="parcellation")
614
680
  # Load parcellation
615
- img, label, img_path, space = ParcellationRegistry().load(
681
+ img, label, img_path, space = load_data(
682
+ kind="parcellation",
616
683
  name=f"Shen_{year}_{n_rois}",
617
684
  target_space="MNI152NLin2009cAsym",
618
685
  resolution=resolution,
@@ -622,7 +689,8 @@ def test_shen(
622
689
  assert space == "MNI152NLin2009cAsym"
623
690
  assert len(label) == n_labels
624
691
  assert_array_equal(
625
- img.header["pixdim"][1:4], 3 * [resolution] # type: ignore
692
+ img.header["pixdim"][1:4],
693
+ 3 * [resolution], # type: ignore
626
694
  )
627
695
 
628
696
 
@@ -771,7 +839,7 @@ def test_yan(
771
839
  The parametrized Kong networks values.
772
840
 
773
841
  """
774
- parcellations = ParcellationRegistry().list
842
+ parcellations = list_data(kind="parcellation")
775
843
  if yeo_networks:
776
844
  parcellation_name = f"Yan{n_rois}xYeo{yeo_networks}"
777
845
  assert parcellation_name in parcellations
@@ -787,7 +855,8 @@ def test_yan(
787
855
  f"{int(resolution)}mm.nii.gz"
788
856
  )
789
857
  # Load parcellation
790
- img, label, img_path, space = ParcellationRegistry().load(
858
+ img, label, img_path, space = load_data(
859
+ kind="parcellation",
791
860
  name=parcellation_name,
792
861
  target_space="MNI152NLin6Asym",
793
862
  resolution=resolution,
@@ -797,7 +866,8 @@ def test_yan(
797
866
  assert space == "MNI152NLin6Asym"
798
867
  assert len(label) == n_rois
799
868
  assert_array_equal(
800
- img.header["pixdim"][1:4], 3 * [resolution] # type: ignore
869
+ img.header["pixdim"][1:4],
870
+ 3 * [resolution], # type: ignore
801
871
  )
802
872
 
803
873
 
@@ -877,7 +947,7 @@ def test_brainnetome(
877
947
  The parametrized threshold values.
878
948
 
879
949
  """
880
- parcellations = ParcellationRegistry().list
950
+ parcellations = list_data(kind="parcellation")
881
951
  parcellation_name = f"Brainnetome_thr{threshold}"
882
952
  assert parcellation_name in parcellations
883
953
 
@@ -887,7 +957,8 @@ def test_brainnetome(
887
957
 
888
958
  parcellation_file = f"BNA-maxprob-thr{threshold}-{resolution}mm.nii.gz"
889
959
  # Load parcellation
890
- img, label, img_path, space = ParcellationRegistry().load(
960
+ img, label, img_path, space = load_data(
961
+ kind="parcellation",
891
962
  name=parcellation_name,
892
963
  target_space="MNI152NLin6Asym",
893
964
  resolution=resolution,
@@ -897,7 +968,8 @@ def test_brainnetome(
897
968
  assert space == "MNI152NLin6Asym"
898
969
  assert len(label) == 246
899
970
  assert_array_equal(
900
- img.header["pixdim"][1:4], 3 * [resolution] # type: ignore
971
+ img.header["pixdim"][1:4],
972
+ 3 * [resolution], # type: ignore
901
973
  )
902
974
 
903
975
 
@@ -912,11 +984,14 @@ def test_retrieve_brainnetome_incorrect_threshold() -> None:
912
984
  def test_merge_parcellations() -> None:
913
985
  """Test merging parcellations."""
914
986
  # load some parcellations for testing
915
- schaefer_parcellation, schaefer_labels, _, _ = ParcellationRegistry().load(
916
- "Schaefer100x17", target_space="MNI152NLin2009cAsym"
987
+ schaefer_parcellation, schaefer_labels, _, _ = load_data(
988
+ kind="parcellation",
989
+ name="Schaefer100x17",
990
+ target_space="MNI152NLin2009cAsym",
917
991
  )
918
- tian_parcellation, tian_labels, _, _ = ParcellationRegistry().load(
919
- "TianxS2x3TxMNInonlinear2009cAsym",
992
+ tian_parcellation, tian_labels, _, _ = load_data(
993
+ kind="parcellation",
994
+ name="TianxS2x3TxMNInonlinear2009cAsym",
920
995
  target_space="MNI152NLin2009cAsym",
921
996
  )
922
997
  # prepare the list of the actual parcellations
@@ -949,8 +1024,10 @@ def test_merge_parcellations_3D_multiple_non_overlapping(
949
1024
 
950
1025
  """
951
1026
  # Get the testing parcellation
952
- parcellation, labels, _, _ = ParcellationRegistry().load(
953
- "Schaefer100x7", target_space="MNI152NLin2009cAsym"
1027
+ parcellation, labels, _, _ = load_data(
1028
+ kind="parcellation",
1029
+ name="Schaefer100x7",
1030
+ target_space="MNI152NLin2009cAsym",
954
1031
  )
955
1032
 
956
1033
  assert parcellation is not None
@@ -986,8 +1063,10 @@ def test_merge_parcellations_3D_multiple_overlapping() -> None:
986
1063
  """Test merge_parcellations with multiple overlapping parcellations."""
987
1064
 
988
1065
  # Get the testing parcellation
989
- parcellation, labels, _, _ = ParcellationRegistry().load(
990
- "Schaefer100x7", target_space="MNI152NLin2009cAsym"
1066
+ parcellation, labels, _, _ = load_data(
1067
+ kind="parcellation",
1068
+ name="Schaefer100x7",
1069
+ target_space="MNI152NLin2009cAsym",
991
1070
  )
992
1071
 
993
1072
  assert parcellation is not None
@@ -1023,8 +1102,10 @@ def test_merge_parcellations_3D_multiple_duplicated_labels() -> None:
1023
1102
  """Test merge_parcellations with duplicated labels."""
1024
1103
 
1025
1104
  # Get the testing parcellation
1026
- parcellation, labels, _, _ = ParcellationRegistry().load(
1027
- "Schaefer100x7", target_space="MNI152NLin2009cAsym"
1105
+ parcellation, labels, _, _ = load_data(
1106
+ kind="parcellation",
1107
+ name="Schaefer100x7",
1108
+ target_space="MNI152NLin2009cAsym",
1028
1109
  )
1029
1110
 
1030
1111
  assert parcellation is not None
@@ -1064,15 +1145,17 @@ def test_get_single() -> None:
1064
1145
  bold = element_data["BOLD"]
1065
1146
  bold_img = bold["data"]
1066
1147
  # Get tailored parcellation
1067
- tailored_parcellation, tailored_labels = ParcellationRegistry().get(
1068
- parcellations=["Shen_2015_268"],
1148
+ tailored_parcellation, tailored_labels = get_data(
1149
+ kind="parcellation",
1150
+ names=["Shen_2015_268"],
1069
1151
  target_data=bold,
1070
1152
  )
1071
1153
  # Check shape and affine with original element data
1072
1154
  assert tailored_parcellation.shape == bold_img.shape[:3]
1073
1155
  assert_array_equal(tailored_parcellation.affine, bold_img.affine)
1074
1156
  # Get raw parcellation
1075
- raw_parcellation, raw_labels, _, _ = ParcellationRegistry().load(
1157
+ raw_parcellation, raw_labels, _, _ = load_data(
1158
+ kind="parcellation",
1076
1159
  name="Shen_2015_268",
1077
1160
  target_space="MNI152NLin2009cAsym",
1078
1161
  resolution=4,
@@ -1098,8 +1181,9 @@ def test_get_multi_same_space() -> None:
1098
1181
  bold = element_data["BOLD"]
1099
1182
  bold_img = bold["data"]
1100
1183
  # Get tailored parcellation
1101
- tailored_parcellation, tailored_labels = ParcellationRegistry().get(
1102
- parcellations=[
1184
+ tailored_parcellation, tailored_labels = get_data(
1185
+ kind="parcellation",
1186
+ names=[
1103
1187
  "Shen_2015_268",
1104
1188
  "TianxS1x3TxMNInonlinear2009cAsym",
1105
1189
  ],
@@ -1116,7 +1200,8 @@ def test_get_multi_same_space() -> None:
1116
1200
  "TianxS1x3TxMNInonlinear2009cAsym",
1117
1201
  ]
1118
1202
  for name in parcellations_names:
1119
- img, labels, _, _ = ParcellationRegistry().load(
1203
+ img, labels, _, _ = load_data(
1204
+ kind="parcellation",
1120
1205
  name=name,
1121
1206
  target_space="MNI152NLin2009cAsym",
1122
1207
  resolution=4,
@@ -1152,8 +1237,9 @@ def test_get_multi_different_space() -> None:
1152
1237
  with OasisVBMTestingDataGrabber() as dg:
1153
1238
  element_data = DefaultDataReader().fit_transform(dg["sub-01"])
1154
1239
  # Get tailored parcellation
1155
- ParcellationRegistry().get(
1156
- parcellations=[
1240
+ get_data(
1241
+ kind="parcellation",
1242
+ names=[
1157
1243
  "Schaefer100x7",
1158
1244
  "TianxS1x3TxMNInonlinear2009cAsym",
1159
1245
  ],
@@ -3,7 +3,6 @@
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
-
7
6
  import numpy as np
8
7
  import pytest
9
8
 
junifer/data/utils.py CHANGED
@@ -76,7 +76,7 @@ def get_native_warper(
76
76
  target_data: MutableMapping,
77
77
  other_data: MutableMapping,
78
78
  inverse: bool = False,
79
- ) -> dict:
79
+ ) -> dict: # pragma: no cover
80
80
  """Get correct warping specification for native space.
81
81
 
82
82
  Parameters
@@ -35,6 +35,12 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
35
35
  space : {"native", "MNI152NLin2009cAsym"}, optional
36
36
  The space to use for the data (default "MNI152NLin2009cAsym").
37
37
 
38
+ Raises
39
+ ------
40
+ ValueError
41
+ If invalid value is passed for:
42
+ * ``space``
43
+
38
44
  """
39
45
 
40
46
  def __init__(
@@ -43,7 +43,9 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
43
43
  Raises
44
44
  ------
45
45
  ValueError
46
- If invalid value is passed for ``tasks``.
46
+ If invalid value is passed for:
47
+ * ``tasks``
48
+ * ``space``
47
49
 
48
50
  """
49
51
 
@@ -79,8 +81,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
79
81
  for t in tasks:
80
82
  if t not in all_tasks:
81
83
  raise_error(
82
- f"{t} is not a valid task in the AOMIC PIOP1"
83
- " dataset!"
84
+ f"{t} is not a valid task in the AOMIC PIOP1 dataset!"
84
85
  )
85
86
  self.tasks = tasks
86
87
  # Descriptor for space in `anat`
@@ -43,7 +43,9 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
43
43
  Raises
44
44
  ------
45
45
  ValueError
46
- If invalid value is passed for ``tasks``.
46
+ If invalid value is passed for:
47
+ * ``tasks``
48
+ * ``space``
47
49
 
48
50
  """
49
51
 
@@ -77,8 +79,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
77
79
  for t in tasks:
78
80
  if t not in all_tasks:
79
81
  raise_error(
80
- f"{t} is not a valid task in the AOMIC PIOP2"
81
- " dataset!"
82
+ f"{t} is not a valid task in the AOMIC PIOP2 dataset!"
82
83
  )
83
84
  self.tasks = tasks
84
85
  # Descriptor for space in `anat`
@@ -5,7 +5,6 @@
5
5
  # Synchon Mandal <s.mandal@fz-juelich.de>
6
6
  # License: AGPL
7
7
 
8
-
9
8
  from ..api.decorators import register_datagrabber
10
9
  from ..utils import logger
11
10
  from .datalad_base import DataladDataGrabber
@@ -3,7 +3,6 @@
3
3
  # Authors: Synchon Mandal <s.mandal@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
-
7
6
  from ..typing import DataGrabberPatterns
8
7
  from ..utils import logger, raise_error, warn_with_log
9
8