junifer 0.0.6.dev248__py3-none-any.whl → 0.0.6.dev252__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 (131) hide show
  1. junifer/_version.py +2 -2
  2. junifer/api/decorators.py +1 -2
  3. junifer/api/functions.py +18 -18
  4. junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -4
  5. junifer/api/queue_context/htcondor_adapter.py +4 -4
  6. junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +3 -3
  7. junifer/api/queue_context/tests/test_htcondor_adapter.py +3 -3
  8. junifer/api/tests/test_functions.py +32 -32
  9. junifer/cli/cli.py +3 -3
  10. junifer/cli/parser.py +4 -4
  11. junifer/cli/tests/test_cli.py +5 -5
  12. junifer/cli/utils.py +5 -6
  13. junifer/configs/juseless/datagrabbers/ixi_vbm.py +2 -2
  14. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -2
  15. junifer/configs/juseless/datagrabbers/ucla.py +4 -4
  16. junifer/data/_dispatch.py +11 -14
  17. junifer/data/coordinates/_ants_coordinates_warper.py +3 -3
  18. junifer/data/coordinates/_coordinates.py +6 -6
  19. junifer/data/coordinates/_fsl_coordinates_warper.py +3 -3
  20. junifer/data/masks/_ants_mask_warper.py +3 -3
  21. junifer/data/masks/_fsl_mask_warper.py +3 -3
  22. junifer/data/masks/_masks.py +6 -9
  23. junifer/data/masks/tests/test_masks.py +4 -4
  24. junifer/data/parcellations/_ants_parcellation_warper.py +3 -3
  25. junifer/data/parcellations/_fsl_parcellation_warper.py +3 -3
  26. junifer/data/parcellations/_parcellations.py +19 -19
  27. junifer/data/parcellations/tests/test_parcellations.py +1 -2
  28. junifer/data/pipeline_data_registry_base.py +3 -2
  29. junifer/data/template_spaces.py +3 -3
  30. junifer/data/tests/test_data_utils.py +1 -2
  31. junifer/data/utils.py +4 -3
  32. junifer/datagrabber/aomic/id1000.py +2 -2
  33. junifer/datagrabber/aomic/piop1.py +5 -5
  34. junifer/datagrabber/aomic/piop2.py +5 -5
  35. junifer/datagrabber/aomic/tests/test_id1000.py +3 -3
  36. junifer/datagrabber/aomic/tests/test_piop1.py +4 -4
  37. junifer/datagrabber/aomic/tests/test_piop2.py +4 -4
  38. junifer/datagrabber/base.py +12 -11
  39. junifer/datagrabber/datalad_base.py +3 -3
  40. junifer/datagrabber/dmcc13_benchmark.py +8 -8
  41. junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
  42. junifer/datagrabber/hcp1200/hcp1200.py +8 -8
  43. junifer/datagrabber/hcp1200/tests/test_hcp1200.py +2 -1
  44. junifer/datagrabber/multiple.py +7 -7
  45. junifer/datagrabber/pattern.py +10 -10
  46. junifer/datagrabber/pattern_validation_mixin.py +10 -10
  47. junifer/datagrabber/tests/test_datalad_base.py +7 -8
  48. junifer/datagrabber/tests/test_dmcc13_benchmark.py +2 -2
  49. junifer/datagrabber/tests/test_pattern_validation_mixin.py +6 -6
  50. junifer/datareader/default.py +6 -6
  51. junifer/external/nilearn/junifer_connectivity_measure.py +2 -2
  52. junifer/external/nilearn/junifer_nifti_spheres_masker.py +4 -4
  53. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +15 -15
  54. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +2 -3
  55. junifer/markers/base.py +8 -8
  56. junifer/markers/brainprint.py +7 -9
  57. junifer/markers/complexity/complexity_base.py +6 -8
  58. junifer/markers/complexity/hurst_exponent.py +5 -5
  59. junifer/markers/complexity/multiscale_entropy_auc.py +5 -5
  60. junifer/markers/complexity/perm_entropy.py +5 -5
  61. junifer/markers/complexity/range_entropy.py +5 -5
  62. junifer/markers/complexity/range_entropy_auc.py +5 -5
  63. junifer/markers/complexity/sample_entropy.py +5 -5
  64. junifer/markers/complexity/weighted_perm_entropy.py +5 -5
  65. junifer/markers/ets_rss.py +7 -7
  66. junifer/markers/falff/_afni_falff.py +1 -2
  67. junifer/markers/falff/_junifer_falff.py +1 -2
  68. junifer/markers/falff/falff_base.py +2 -4
  69. junifer/markers/falff/falff_parcels.py +7 -7
  70. junifer/markers/falff/falff_spheres.py +6 -6
  71. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +6 -6
  72. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +7 -7
  73. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +6 -6
  74. junifer/markers/functional_connectivity/functional_connectivity_base.py +10 -10
  75. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +7 -7
  76. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +6 -6
  77. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +1 -2
  78. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +1 -2
  79. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +3 -3
  80. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +3 -3
  81. junifer/markers/parcel_aggregation.py +8 -8
  82. junifer/markers/reho/_afni_reho.py +1 -2
  83. junifer/markers/reho/_junifer_reho.py +1 -2
  84. junifer/markers/reho/reho_base.py +2 -4
  85. junifer/markers/reho/reho_parcels.py +8 -8
  86. junifer/markers/reho/reho_spheres.py +7 -7
  87. junifer/markers/sphere_aggregation.py +8 -8
  88. junifer/markers/temporal_snr/temporal_snr_base.py +8 -8
  89. junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -6
  90. junifer/markers/temporal_snr/temporal_snr_spheres.py +5 -5
  91. junifer/markers/utils.py +3 -3
  92. junifer/onthefly/_brainprint.py +2 -2
  93. junifer/onthefly/read_transform.py +3 -3
  94. junifer/pipeline/marker_collection.py +4 -4
  95. junifer/pipeline/pipeline_component_registry.py +5 -4
  96. junifer/pipeline/pipeline_step_mixin.py +7 -7
  97. junifer/pipeline/tests/test_pipeline_component_registry.py +2 -3
  98. junifer/pipeline/tests/test_pipeline_step_mixin.py +19 -19
  99. junifer/pipeline/tests/test_update_meta_mixin.py +4 -4
  100. junifer/pipeline/update_meta_mixin.py +2 -2
  101. junifer/pipeline/utils.py +5 -5
  102. junifer/preprocess/base.py +10 -10
  103. junifer/preprocess/confounds/fmriprep_confound_remover.py +11 -14
  104. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +1 -2
  105. junifer/preprocess/smoothing/smoothing.py +7 -7
  106. junifer/preprocess/warping/_ants_warper.py +3 -4
  107. junifer/preprocess/warping/_fsl_warper.py +3 -4
  108. junifer/preprocess/warping/space_warper.py +6 -6
  109. junifer/preprocess/warping/tests/test_space_warper.py +3 -4
  110. junifer/stats.py +4 -4
  111. junifer/storage/base.py +14 -13
  112. junifer/storage/hdf5.py +21 -20
  113. junifer/storage/pandas_base.py +12 -11
  114. junifer/storage/sqlite.py +11 -11
  115. junifer/storage/tests/test_hdf5.py +1 -2
  116. junifer/storage/tests/test_sqlite.py +2 -2
  117. junifer/storage/tests/test_utils.py +8 -7
  118. junifer/storage/utils.py +7 -7
  119. junifer/testing/datagrabbers.py +9 -10
  120. junifer/tests/test_stats.py +2 -2
  121. junifer/typing/_typing.py +6 -9
  122. junifer/utils/helpers.py +2 -3
  123. junifer/utils/logging.py +5 -5
  124. junifer/utils/singleton.py +3 -3
  125. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/METADATA +2 -2
  126. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/RECORD +131 -131
  127. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/AUTHORS.rst +0 -0
  128. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/LICENSE.md +0 -0
  129. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/WHEEL +0 -0
  130. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/entry_points.txt +0 -0
  131. {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/top_level.txt +0 -0
junifer/data/_dispatch.py CHANGED
@@ -8,10 +8,7 @@ from typing import (
8
8
  TYPE_CHECKING,
9
9
  Any,
10
10
  Callable,
11
- Dict,
12
- List,
13
11
  Optional,
14
- Tuple,
15
12
  Union,
16
13
  )
17
14
 
@@ -40,15 +37,15 @@ def get_data(
40
37
  kind: str,
41
38
  names: Union[
42
39
  str, # coordinates, parcellation, mask
43
- List[str], # parcellation, mask
44
- Dict, # mask
45
- List[Dict], # mask
40
+ list[str], # parcellation, mask
41
+ dict, # mask
42
+ list[dict], # mask
46
43
  ],
47
- target_data: Dict[str, Any],
48
- extra_input: Optional[Dict[str, Any]] = None,
44
+ target_data: dict[str, Any],
45
+ extra_input: Optional[dict[str, Any]] = None,
49
46
  ) -> Union[
50
- Tuple[ArrayLike, List[str]], # coordinates
51
- Tuple["Nifti1Image", List[str]], # parcellation
47
+ tuple[ArrayLike, list[str]], # coordinates
48
+ tuple["Nifti1Image", list[str]], # parcellation
52
49
  "Nifti1Image", # mask
53
50
  ]:
54
51
  """Get tailored ``kind`` for ``target_data``.
@@ -102,7 +99,7 @@ def get_data(
102
99
  raise_error(f"Unknown data kind: {kind}")
103
100
 
104
101
 
105
- def list_data(kind: str) -> List[str]:
102
+ def list_data(kind: str) -> list[str]:
106
103
  """List available data for ``kind``.
107
104
 
108
105
  Parameters
@@ -137,9 +134,9 @@ def load_data(
137
134
  name: str,
138
135
  **kwargs,
139
136
  ) -> Union[
140
- Tuple[ArrayLike, List[str], str], # coordinates
141
- Tuple[Optional["Nifti1Image"], List[str], Path, str], # parcellation
142
- Tuple[
137
+ tuple[ArrayLike, list[str], str], # coordinates
138
+ tuple[Optional["Nifti1Image"], list[str], Path, str], # parcellation
139
+ tuple[
143
140
  Optional[Union["Nifti1Image", Callable]], Optional[Path], str
144
141
  ], # mask
145
142
  ]:
@@ -3,7 +3,7 @@
3
3
  # Authors: Synchon Mandal <s.mandal@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from typing import Any, Dict
6
+ from typing import Any
7
7
 
8
8
  import numpy as np
9
9
  from numpy.typing import ArrayLike
@@ -25,8 +25,8 @@ class ANTsCoordinatesWarper:
25
25
  def warp(
26
26
  self,
27
27
  seeds: ArrayLike,
28
- target_data: Dict[str, Any],
29
- warp_data: Dict[str, Any],
28
+ target_data: dict[str, Any],
29
+ warp_data: dict[str, Any],
30
30
  ) -> ArrayLike:
31
31
  """Warp ``seeds`` to correct space.
32
32
 
@@ -5,7 +5,7 @@
5
5
  # License: AGPL
6
6
 
7
7
  from pathlib import Path
8
- from typing import Any, Dict, List, Optional, Tuple
8
+ from typing import Any, Optional
9
9
 
10
10
  import numpy as np
11
11
  import pandas as pd
@@ -135,7 +135,7 @@ class CoordinatesRegistry(BasePipelineDataRegistry, metaclass=Singleton):
135
135
  self,
136
136
  name: str,
137
137
  coordinates: ArrayLike,
138
- voi_names: List[str],
138
+ voi_names: list[str],
139
139
  space: str,
140
140
  overwrite: Optional[bool] = False,
141
141
  ) -> None:
@@ -236,7 +236,7 @@ class CoordinatesRegistry(BasePipelineDataRegistry, metaclass=Singleton):
236
236
  # Update registry
237
237
  _ = self._registry.pop(name)
238
238
 
239
- def load(self, name: str) -> Tuple[ArrayLike, List[str], str]:
239
+ def load(self, name: str) -> tuple[ArrayLike, list[str], str]:
240
240
  """Load coordinates.
241
241
 
242
242
  Parameters
@@ -285,9 +285,9 @@ class CoordinatesRegistry(BasePipelineDataRegistry, metaclass=Singleton):
285
285
  def get(
286
286
  self,
287
287
  coords: str,
288
- target_data: Dict[str, Any],
289
- extra_input: Optional[Dict[str, Any]] = None,
290
- ) -> Tuple[ArrayLike, List[str]]:
288
+ target_data: dict[str, Any],
289
+ extra_input: Optional[dict[str, Any]] = None,
290
+ ) -> tuple[ArrayLike, list[str]]:
291
291
  """Get coordinates, tailored for the target data.
292
292
 
293
293
  Parameters
@@ -3,7 +3,7 @@
3
3
  # Authors: Synchon Mandal <s.mandal@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from typing import Any, Dict
6
+ from typing import Any
7
7
 
8
8
  import numpy as np
9
9
  from numpy.typing import ArrayLike
@@ -25,8 +25,8 @@ class FSLCoordinatesWarper:
25
25
  def warp(
26
26
  self,
27
27
  seeds: ArrayLike,
28
- target_data: Dict[str, Any],
29
- warp_data: Dict[str, Any],
28
+ target_data: dict[str, Any],
29
+ warp_data: dict[str, Any],
30
30
  ) -> ArrayLike:
31
31
  """Warp ``seeds`` to correct space.
32
32
 
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  import uuid
7
- from typing import TYPE_CHECKING, Any, Dict, Optional
7
+ from typing import TYPE_CHECKING, Any, Optional
8
8
 
9
9
  import nibabel as nib
10
10
 
@@ -33,8 +33,8 @@ class ANTsMaskWarper:
33
33
  mask_img: "Nifti1Image",
34
34
  src: str,
35
35
  dst: str,
36
- target_data: Dict[str, Any],
37
- warp_data: Optional[Dict[str, Any]],
36
+ target_data: dict[str, Any],
37
+ warp_data: Optional[dict[str, Any]],
38
38
  ) -> "Nifti1Image":
39
39
  """Warp ``mask_img`` to correct space.
40
40
 
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  import uuid
7
- from typing import TYPE_CHECKING, Any, Dict
7
+ from typing import TYPE_CHECKING, Any
8
8
 
9
9
  import nibabel as nib
10
10
 
@@ -30,8 +30,8 @@ class FSLMaskWarper:
30
30
  self,
31
31
  mask_name: str,
32
32
  mask_img: "Nifti1Image",
33
- target_data: Dict[str, Any],
34
- warp_data: Dict[str, Any],
33
+ target_data: dict[str, Any],
34
+ warp_data: dict[str, Any],
35
35
  ) -> "Nifti1Image":
36
36
  """Warp ``mask_img`` to correct space.
37
37
 
@@ -9,10 +9,7 @@ from typing import (
9
9
  TYPE_CHECKING,
10
10
  Any,
11
11
  Callable,
12
- Dict,
13
- List,
14
12
  Optional,
15
- Tuple,
16
13
  Union,
17
14
  )
18
15
 
@@ -46,8 +43,8 @@ _masks_path = Path(__file__).parent
46
43
 
47
44
 
48
45
  def compute_brain_mask(
49
- target_data: Dict[str, Any],
50
- extra_input: Optional[Dict[str, Any]] = None,
46
+ target_data: dict[str, Any],
47
+ extra_input: Optional[dict[str, Any]] = None,
51
48
  mask_type: str = "brain",
52
49
  threshold: float = 0.5,
53
50
  ) -> "Nifti1Image":
@@ -266,7 +263,7 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
266
263
  name: str,
267
264
  resolution: Optional[float] = None,
268
265
  path_only: bool = False,
269
- ) -> Tuple[Optional[Union["Nifti1Image", Callable]], Optional[Path], str]:
266
+ ) -> tuple[Optional[Union["Nifti1Image", Callable]], Optional[Path], str]:
270
267
  """Load mask.
271
268
 
272
269
  Parameters
@@ -332,9 +329,9 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
332
329
 
333
330
  def get( # noqa: C901
334
331
  self,
335
- masks: Union[str, Dict, List[Union[Dict, str]]],
336
- target_data: Dict[str, Any],
337
- extra_input: Optional[Dict[str, Any]] = None,
332
+ masks: Union[str, dict, list[Union[dict, str]]],
333
+ target_data: dict[str, Any],
334
+ extra_input: Optional[dict[str, Any]] = None,
338
335
  ) -> "Nifti1Image":
339
336
  """Get mask, tailored for the target image.
340
337
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  import socket
9
9
  from pathlib import Path
10
- from typing import Callable, Dict, List, Optional, Union
10
+ from typing import Callable, Optional, Union
11
11
 
12
12
  import nibabel as nib
13
13
  import numpy as np
@@ -254,7 +254,7 @@ def test_load_incorrect() -> None:
254
254
  def test_vickery_patil(
255
255
  name: str,
256
256
  resolution: Optional[float],
257
- pixdim: List[float],
257
+ pixdim: list[float],
258
258
  fname: str,
259
259
  ) -> None:
260
260
  """Test Vickery-Patil mask.
@@ -396,7 +396,7 @@ def test_get_errors() -> None:
396
396
  def test_nilearn_compute_masks(
397
397
  mask_name: str,
398
398
  function: Callable,
399
- params: Union[Dict, None],
399
+ params: Union[dict, None],
400
400
  resample: bool,
401
401
  ) -> None:
402
402
  """Test using nilearn compute mask functions.
@@ -479,7 +479,7 @@ def test_get_inherit() -> None:
479
479
  ],
480
480
  )
481
481
  def test_get_multiple(
482
- masks: Union[str, Dict, List[Union[Dict, str]]], params: Dict
482
+ masks: Union[str, dict, list[Union[dict, str]]], params: dict
483
483
  ) -> None:
484
484
  """Test getting multiple masks.
485
485
 
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  import uuid
7
- from typing import TYPE_CHECKING, Any, Dict, Optional
7
+ from typing import TYPE_CHECKING, Any, Optional
8
8
 
9
9
  import nibabel as nib
10
10
 
@@ -33,8 +33,8 @@ class ANTsParcellationWarper:
33
33
  parcellation_img: "Nifti1Image",
34
34
  src: str,
35
35
  dst: str,
36
- target_data: Dict[str, Any],
37
- warp_data: Optional[Dict[str, Any]],
36
+ target_data: dict[str, Any],
37
+ warp_data: Optional[dict[str, Any]],
38
38
  ) -> "Nifti1Image":
39
39
  """Warp ``parcellation_img`` to correct space.
40
40
 
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  import uuid
7
- from typing import TYPE_CHECKING, Any, Dict
7
+ from typing import TYPE_CHECKING, Any
8
8
 
9
9
  import nibabel as nib
10
10
 
@@ -30,8 +30,8 @@ class FSLParcellationWarper:
30
30
  self,
31
31
  parcellation_name: str,
32
32
  parcellation_img: "Nifti1Image",
33
- target_data: Dict[str, Any],
34
- warp_data: Dict[str, Any],
33
+ target_data: dict[str, Any],
34
+ warp_data: dict[str, Any],
35
35
  ) -> "Nifti1Image":
36
36
  """Warp ``parcellation_img`` to correct space.
37
37
 
@@ -12,7 +12,7 @@ import tempfile
12
12
  import zipfile
13
13
  from itertools import product
14
14
  from pathlib import Path
15
- from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
15
+ from typing import TYPE_CHECKING, Any, Optional, Union
16
16
 
17
17
  import httpx
18
18
  import nibabel as nib
@@ -190,7 +190,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
190
190
  self,
191
191
  name: str,
192
192
  parcellation_path: Union[str, Path],
193
- parcels_labels: List[str],
193
+ parcels_labels: list[str],
194
194
  space: str,
195
195
  overwrite: bool = False,
196
196
  ) -> None:
@@ -272,7 +272,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
272
272
  parcellations_dir: Union[str, Path, None] = None,
273
273
  resolution: Optional[float] = None,
274
274
  path_only: bool = False,
275
- ) -> Tuple[Optional["Nifti1Image"], List[str], Path, str]:
275
+ ) -> tuple[Optional["Nifti1Image"], list[str], Path, str]:
276
276
  """Load parcellation and labels.
277
277
 
278
278
  If it is a built-in parcellation and the file is not present in the
@@ -367,10 +367,10 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
367
367
 
368
368
  def get(
369
369
  self,
370
- parcellations: Union[str, List[str]],
371
- target_data: Dict[str, Any],
372
- extra_input: Optional[Dict[str, Any]] = None,
373
- ) -> Tuple["Nifti1Image", List[str]]:
370
+ parcellations: Union[str, list[str]],
371
+ target_data: dict[str, Any],
372
+ extra_input: Optional[dict[str, Any]] = None,
373
+ ) -> tuple["Nifti1Image", list[str]]:
374
374
  """Get parcellation, tailored for the target image.
375
375
 
376
376
  Parameters
@@ -503,7 +503,7 @@ def _retrieve_parcellation(
503
503
  parcellations_dir: Union[str, Path, None] = None,
504
504
  resolution: Optional[float] = None,
505
505
  **kwargs,
506
- ) -> Tuple[Path, List[str]]:
506
+ ) -> tuple[Path, list[str]]:
507
507
  """Retrieve a brain parcellation object from nilearn or online source.
508
508
 
509
509
  Only returns one parcellation per call. Call function multiple times for
@@ -647,7 +647,7 @@ def _retrieve_schaefer(
647
647
  resolution: Optional[float] = None,
648
648
  n_rois: Optional[int] = None,
649
649
  yeo_networks: int = 7,
650
- ) -> Tuple[Path, List[str]]:
650
+ ) -> tuple[Path, list[str]]:
651
651
  """Retrieve Schaefer parcellation.
652
652
 
653
653
  Parameters
@@ -749,7 +749,7 @@ def _retrieve_tian(
749
749
  scale: Optional[int] = None,
750
750
  space: str = "MNI152NLin6Asym",
751
751
  magneticfield: str = "3T",
752
- ) -> Tuple[Path, List[str]]:
752
+ ) -> tuple[Path, list[str]]:
753
753
  """Retrieve Tian parcellation.
754
754
 
755
755
  Parameters
@@ -923,7 +923,7 @@ def _retrieve_suit(
923
923
  parcellations_dir: Path,
924
924
  resolution: Optional[float],
925
925
  space: str = "MNI152NLin6Asym",
926
- ) -> Tuple[Path, List[str]]:
926
+ ) -> tuple[Path, list[str]]:
927
927
  """Retrieve SUIT parcellation.
928
928
 
929
929
  Parameters
@@ -1049,7 +1049,7 @@ def _retrieve_aicha(
1049
1049
  parcellations_dir: Path,
1050
1050
  resolution: Optional[float] = None,
1051
1051
  version: int = 2,
1052
- ) -> Tuple[Path, List[str]]:
1052
+ ) -> tuple[Path, list[str]]:
1053
1053
  """Retrieve AICHA parcellation.
1054
1054
 
1055
1055
  Parameters
@@ -1205,7 +1205,7 @@ def _retrieve_shen( # noqa: C901
1205
1205
  resolution: Optional[float] = None,
1206
1206
  year: int = 2015,
1207
1207
  n_rois: int = 268,
1208
- ) -> Tuple[Path, List[str]]:
1208
+ ) -> tuple[Path, list[str]]:
1209
1209
  """Retrieve Shen parcellation.
1210
1210
 
1211
1211
  Parameters
@@ -1410,7 +1410,7 @@ def _retrieve_yan(
1410
1410
  n_rois: Optional[int] = None,
1411
1411
  yeo_networks: Optional[int] = None,
1412
1412
  kong_networks: Optional[int] = None,
1413
- ) -> Tuple[Path, List[str]]:
1413
+ ) -> tuple[Path, list[str]]:
1414
1414
  """Retrieve Yan parcellation.
1415
1415
 
1416
1416
  Parameters
@@ -1607,7 +1607,7 @@ def _retrieve_brainnetome(
1607
1607
  parcellations_dir: Path,
1608
1608
  resolution: Optional[float] = None,
1609
1609
  threshold: Optional[int] = None,
1610
- ) -> Tuple[Path, List[str]]:
1610
+ ) -> tuple[Path, list[str]]:
1611
1611
  """Retrieve Brainnetome parcellation.
1612
1612
 
1613
1613
  Parameters
@@ -1720,10 +1720,10 @@ def _retrieve_brainnetome(
1720
1720
 
1721
1721
 
1722
1722
  def merge_parcellations(
1723
- parcellations_list: List["Nifti1Image"],
1724
- parcellations_names: List[str],
1725
- labels_lists: List[List[str]],
1726
- ) -> Tuple["Nifti1Image", List[str]]:
1723
+ parcellations_list: list["Nifti1Image"],
1724
+ parcellations_names: list[str],
1725
+ labels_lists: list[list[str]],
1726
+ ) -> tuple["Nifti1Image", list[str]]:
1727
1727
  """Merge all parcellations from a list into one parcellation.
1728
1728
 
1729
1729
  Parameters
@@ -6,7 +6,6 @@
6
6
  # License: AGPL
7
7
 
8
8
  from pathlib import Path
9
- from typing import List
10
9
 
11
10
  import nibabel as nib
12
11
  import numpy as np
@@ -171,7 +170,7 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
171
170
  def test_register(
172
171
  name: str,
173
172
  parcellation_path: str,
174
- parcels_labels: List[str],
173
+ parcels_labels: list[str],
175
174
  space: str,
176
175
  overwrite: bool,
177
176
  ) -> None:
@@ -4,7 +4,8 @@
4
4
  # License: AGPL
5
5
 
6
6
  from abc import ABC, abstractmethod
7
- from typing import Any, List, Mapping
7
+ from collections.abc import Mapping
8
+ from typing import Any
8
9
 
9
10
  from ..utils import raise_error
10
11
  from ..utils.singleton import ABCSingleton
@@ -38,7 +39,7 @@ class BasePipelineDataRegistry(ABC, metaclass=ABCSingleton):
38
39
  return self._registry
39
40
 
40
41
  @property
41
- def list(self) -> List[str]:
42
+ def list(self) -> list[str]:
42
43
  """List available pipeline data keys."""
43
44
  return sorted(self._registry.keys())
44
45
 
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
  from pathlib import Path
7
- from typing import Any, Dict, Optional, Union
7
+ from typing import Any, Optional, Union
8
8
 
9
9
  import datalad.api as dl
10
10
  import nibabel as nib
@@ -122,8 +122,8 @@ def get_xfm(
122
122
 
123
123
  def get_template(
124
124
  space: str,
125
- target_data: Dict[str, Any],
126
- extra_input: Optional[Dict[str, Any]] = None,
125
+ target_data: dict[str, Any],
126
+ extra_input: Optional[dict[str, Any]] = None,
127
127
  template_type: str = "T1w",
128
128
  ) -> nib.Nifti1Image:
129
129
  """Get template for the space, tailored for the target image.
@@ -3,7 +3,6 @@
3
3
  # Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
4
4
  # License: AGPL
5
5
 
6
- from typing import List
7
6
 
8
7
  import numpy as np
9
8
  import pytest
@@ -24,7 +23,7 @@ from junifer.data.utils import closest_resolution
24
23
  ],
25
24
  )
26
25
  def test_closest_resolution(
27
- resolution: float, valid_resolutions: List[float], expected: float
26
+ resolution: float, valid_resolutions: list[float], expected: float
28
27
  ):
29
28
  """Test closest_resolution.
30
29
 
junifer/data/utils.py CHANGED
@@ -4,7 +4,8 @@
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
5
5
  # License: AGPL
6
6
 
7
- from typing import Dict, List, MutableMapping, Optional, Union
7
+ from collections.abc import MutableMapping
8
+ from typing import Optional, Union
8
9
 
9
10
  import numpy as np
10
11
 
@@ -16,7 +17,7 @@ __all__ = ["closest_resolution", "get_native_warper"]
16
17
 
17
18
  def closest_resolution(
18
19
  resolution: Optional[Union[float, int]],
19
- valid_resolution: Union[List[float], List[int], np.ndarray],
20
+ valid_resolution: Union[list[float], list[int], np.ndarray],
20
21
  ) -> Union[float, int]:
21
22
  """Find the closest resolution.
22
23
 
@@ -55,7 +56,7 @@ def get_native_warper(
55
56
  target_data: MutableMapping,
56
57
  other_data: MutableMapping,
57
58
  inverse: bool = False,
58
- ) -> Dict:
59
+ ) -> dict:
59
60
  """Get correct warping specification for native space.
60
61
 
61
62
  Parameters
@@ -8,7 +8,7 @@
8
8
  # License: AGPL
9
9
 
10
10
  from pathlib import Path
11
- from typing import List, Union
11
+ from typing import Union
12
12
 
13
13
  from ...api.decorators import register_datagrabber
14
14
  from ..pattern_datalad import PatternDataladDataGrabber
@@ -39,7 +39,7 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
39
39
  def __init__(
40
40
  self,
41
41
  datadir: Union[str, Path, None] = None,
42
- types: Union[str, List[str], None] = None,
42
+ types: Union[str, list[str], None] = None,
43
43
  native_t1w: bool = False,
44
44
  ) -> None:
45
45
  # The patterns
@@ -9,7 +9,7 @@
9
9
 
10
10
  from itertools import product
11
11
  from pathlib import Path
12
- from typing import Dict, List, Union
12
+ from typing import Union
13
13
 
14
14
  from ...api.decorators import register_datagrabber
15
15
  from ...utils import raise_error
@@ -50,8 +50,8 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
50
50
  def __init__(
51
51
  self,
52
52
  datadir: Union[str, Path, None] = None,
53
- types: Union[str, List[str], None] = None,
54
- tasks: Union[str, List[str], None] = None,
53
+ types: Union[str, list[str], None] = None,
54
+ tasks: Union[str, list[str], None] = None,
55
55
  native_t1w: bool = False,
56
56
  ) -> None:
57
57
  # Declare all tasks
@@ -247,7 +247,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
247
247
  confounds_format="fmriprep",
248
248
  )
249
249
 
250
- def get_item(self, subject: str, task: str) -> Dict:
250
+ def get_item(self, subject: str, task: str) -> dict:
251
251
  """Index one element in the dataset.
252
252
 
253
253
  Parameters
@@ -279,7 +279,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
279
279
 
280
280
  return super().get_item(subject=subject, task=new_task)
281
281
 
282
- def get_elements(self) -> List:
282
+ def get_elements(self) -> list:
283
283
  """Implement fetching list of subjects in the dataset.
284
284
 
285
285
  Returns
@@ -9,7 +9,7 @@
9
9
 
10
10
  from itertools import product
11
11
  from pathlib import Path
12
- from typing import Dict, List, Union
12
+ from typing import Union
13
13
 
14
14
  from ...api.decorators import register_datagrabber
15
15
  from ...utils import raise_error
@@ -50,8 +50,8 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
50
50
  def __init__(
51
51
  self,
52
52
  datadir: Union[str, Path, None] = None,
53
- types: Union[str, List[str], None] = None,
54
- tasks: Union[str, List[str], None] = None,
53
+ types: Union[str, list[str], None] = None,
54
+ tasks: Union[str, list[str], None] = None,
55
55
  native_t1w: bool = False,
56
56
  ) -> None:
57
57
  # Declare all tasks
@@ -245,7 +245,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
245
245
  confounds_format="fmriprep",
246
246
  )
247
247
 
248
- def get_elements(self) -> List:
248
+ def get_elements(self) -> list:
249
249
  """Implement fetching list of elements in the dataset.
250
250
 
251
251
  Returns
@@ -261,7 +261,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
261
261
  elems.append((subject, task))
262
262
  return elems
263
263
 
264
- def get_item(self, subject: str, task: str) -> Dict:
264
+ def get_item(self, subject: str, task: str) -> dict:
265
265
  """Index one element in the dataset.
266
266
 
267
267
  Parameters
@@ -7,7 +7,7 @@
7
7
  # Synchon Mandal <s.mandal@fz-juelich.de>
8
8
  # License: AGPL
9
9
 
10
- from typing import List, Optional, Union
10
+ from typing import Optional, Union
11
11
 
12
12
  import pytest
13
13
 
@@ -31,7 +31,7 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomic1000"
31
31
  )
32
32
  def test_DataladAOMICID1000(
33
33
  type_: str,
34
- nested_types: Optional[List[str]],
34
+ nested_types: Optional[list[str]],
35
35
  ) -> None:
36
36
  """Test DataladAOMICID1000 DataGrabber.
37
37
 
@@ -87,7 +87,7 @@ def test_DataladAOMICID1000(
87
87
  ],
88
88
  )
89
89
  def test_DataladAOMICID1000_partial_data_access(
90
- types: Union[str, List[str]],
90
+ types: Union[str, list[str]],
91
91
  ) -> None:
92
92
  """Test DataladAOMICID1000 DataGrabber partial data access.
93
93
 
@@ -7,7 +7,7 @@
7
7
  # Synchon Mandal <s.mandal@fz-juelich.de>
8
8
  # License: AGPL
9
9
 
10
- from typing import List, Optional, Union
10
+ from typing import Optional, Union
11
11
 
12
12
  import pytest
13
13
 
@@ -40,8 +40,8 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomicpiop1"
40
40
  )
41
41
  def test_DataladAOMICPIOP1(
42
42
  type_: str,
43
- nested_types: Optional[List[str]],
44
- tasks: Optional[List[str]],
43
+ nested_types: Optional[list[str]],
44
+ tasks: Optional[list[str]],
45
45
  ) -> None:
46
46
  """Test DataladAOMICPIOP1 DataGrabber.
47
47
 
@@ -117,7 +117,7 @@ def test_DataladAOMICPIOP1(
117
117
  ],
118
118
  )
119
119
  def test_DataladAOMICPIOP1_partial_data_access(
120
- types: Union[str, List[str]],
120
+ types: Union[str, list[str]],
121
121
  ) -> None:
122
122
  """Test DataladAOMICPIOP1 DataGrabber partial data access.
123
123