junifer 0.0.5__py3-none-any.whl → 0.0.5.dev24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. junifer/__init__.py +0 -17
  2. junifer/_version.py +2 -2
  3. junifer/api/__init__.py +1 -4
  4. junifer/api/cli.py +1 -91
  5. junifer/api/decorators.py +0 -9
  6. junifer/api/functions.py +10 -56
  7. junifer/api/parser.py +0 -3
  8. junifer/api/queue_context/__init__.py +1 -4
  9. junifer/api/res/afni/run_afni_docker.sh +1 -1
  10. junifer/api/res/ants/run_ants_docker.sh +1 -1
  11. junifer/api/res/fsl/run_fsl_docker.sh +1 -1
  12. junifer/api/tests/test_api_utils.py +2 -4
  13. junifer/api/tests/test_cli.py +0 -83
  14. junifer/api/tests/test_functions.py +2 -27
  15. junifer/configs/__init__.py +1 -1
  16. junifer/configs/juseless/__init__.py +1 -4
  17. junifer/configs/juseless/datagrabbers/__init__.py +1 -10
  18. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +0 -3
  19. junifer/configs/juseless/datagrabbers/camcan_vbm.py +0 -3
  20. junifer/configs/juseless/datagrabbers/ixi_vbm.py +0 -3
  21. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +3 -1
  22. junifer/configs/juseless/datagrabbers/ucla.py +9 -12
  23. junifer/configs/juseless/datagrabbers/ukb_vbm.py +0 -3
  24. junifer/data/__init__.py +1 -21
  25. junifer/data/coordinates.py +19 -10
  26. junifer/data/masks.py +87 -58
  27. junifer/data/parcellations.py +3 -14
  28. junifer/data/template_spaces.py +1 -4
  29. junifer/data/tests/test_masks.py +37 -26
  30. junifer/data/utils.py +0 -3
  31. junifer/datagrabber/__init__.py +1 -18
  32. junifer/datagrabber/aomic/__init__.py +0 -3
  33. junifer/datagrabber/aomic/id1000.py +37 -70
  34. junifer/datagrabber/aomic/piop1.py +36 -69
  35. junifer/datagrabber/aomic/piop2.py +38 -71
  36. junifer/datagrabber/aomic/tests/test_id1000.py +99 -44
  37. junifer/datagrabber/aomic/tests/test_piop1.py +108 -65
  38. junifer/datagrabber/aomic/tests/test_piop2.py +102 -45
  39. junifer/datagrabber/base.py +6 -13
  40. junifer/datagrabber/datalad_base.py +1 -13
  41. junifer/datagrabber/dmcc13_benchmark.py +53 -36
  42. junifer/datagrabber/hcp1200/__init__.py +0 -3
  43. junifer/datagrabber/hcp1200/datalad_hcp1200.py +0 -3
  44. junifer/datagrabber/hcp1200/hcp1200.py +1 -4
  45. junifer/datagrabber/multiple.py +6 -45
  46. junifer/datagrabber/pattern.py +62 -170
  47. junifer/datagrabber/pattern_datalad.py +12 -25
  48. junifer/datagrabber/tests/test_datagrabber_utils.py +218 -0
  49. junifer/datagrabber/tests/test_datalad_base.py +4 -4
  50. junifer/datagrabber/tests/test_dmcc13_benchmark.py +19 -46
  51. junifer/datagrabber/tests/test_multiple.py +84 -161
  52. junifer/datagrabber/tests/test_pattern.py +0 -45
  53. junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
  54. junifer/datagrabber/utils.py +230 -0
  55. junifer/datareader/__init__.py +1 -4
  56. junifer/datareader/default.py +43 -95
  57. junifer/external/__init__.py +1 -1
  58. junifer/external/nilearn/__init__.py +1 -5
  59. junifer/external/nilearn/junifer_nifti_spheres_masker.py +9 -23
  60. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +1 -76
  61. junifer/markers/__init__.py +1 -23
  62. junifer/markers/base.py +28 -68
  63. junifer/markers/collection.py +2 -10
  64. junifer/markers/complexity/__init__.py +0 -10
  65. junifer/markers/complexity/complexity_base.py +43 -26
  66. junifer/markers/complexity/hurst_exponent.py +0 -3
  67. junifer/markers/complexity/multiscale_entropy_auc.py +0 -3
  68. junifer/markers/complexity/perm_entropy.py +0 -3
  69. junifer/markers/complexity/range_entropy.py +0 -3
  70. junifer/markers/complexity/range_entropy_auc.py +0 -3
  71. junifer/markers/complexity/sample_entropy.py +0 -3
  72. junifer/markers/complexity/tests/test_hurst_exponent.py +3 -11
  73. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +3 -11
  74. junifer/markers/complexity/tests/test_perm_entropy.py +3 -11
  75. junifer/markers/complexity/tests/test_range_entropy.py +3 -11
  76. junifer/markers/complexity/tests/test_range_entropy_auc.py +3 -11
  77. junifer/markers/complexity/tests/test_sample_entropy.py +3 -11
  78. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +3 -11
  79. junifer/markers/complexity/weighted_perm_entropy.py +0 -3
  80. junifer/markers/ets_rss.py +42 -27
  81. junifer/markers/falff/__init__.py +0 -3
  82. junifer/markers/falff/_afni_falff.py +2 -5
  83. junifer/markers/falff/_junifer_falff.py +0 -3
  84. junifer/markers/falff/falff_base.py +46 -20
  85. junifer/markers/falff/falff_parcels.py +27 -56
  86. junifer/markers/falff/falff_spheres.py +29 -60
  87. junifer/markers/falff/tests/test_falff_parcels.py +23 -39
  88. junifer/markers/falff/tests/test_falff_spheres.py +23 -39
  89. junifer/markers/functional_connectivity/__init__.py +0 -9
  90. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +60 -63
  91. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +32 -45
  92. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +36 -49
  93. junifer/markers/functional_connectivity/functional_connectivity_base.py +70 -71
  94. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +25 -34
  95. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +30 -40
  96. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +7 -11
  97. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +7 -27
  98. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +12 -28
  99. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +11 -35
  100. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +62 -36
  101. junifer/markers/parcel_aggregation.py +61 -47
  102. junifer/markers/reho/__init__.py +0 -3
  103. junifer/markers/reho/_afni_reho.py +2 -5
  104. junifer/markers/reho/_junifer_reho.py +1 -4
  105. junifer/markers/reho/reho_base.py +27 -8
  106. junifer/markers/reho/reho_parcels.py +17 -28
  107. junifer/markers/reho/reho_spheres.py +18 -27
  108. junifer/markers/reho/tests/test_reho_parcels.py +3 -8
  109. junifer/markers/reho/tests/test_reho_spheres.py +3 -8
  110. junifer/markers/sphere_aggregation.py +59 -43
  111. junifer/markers/temporal_snr/__init__.py +0 -3
  112. junifer/markers/temporal_snr/temporal_snr_base.py +32 -23
  113. junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -9
  114. junifer/markers/temporal_snr/temporal_snr_spheres.py +6 -9
  115. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +3 -6
  116. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +3 -6
  117. junifer/markers/tests/test_collection.py +8 -9
  118. junifer/markers/tests/test_ets_rss.py +9 -15
  119. junifer/markers/tests/test_markers_base.py +18 -17
  120. junifer/markers/tests/test_parcel_aggregation.py +32 -93
  121. junifer/markers/tests/test_sphere_aggregation.py +19 -72
  122. junifer/onthefly/__init__.py +1 -4
  123. junifer/onthefly/read_transform.py +0 -3
  124. junifer/pipeline/__init__.py +1 -9
  125. junifer/pipeline/pipeline_step_mixin.py +4 -21
  126. junifer/pipeline/registry.py +0 -3
  127. junifer/pipeline/singleton.py +0 -3
  128. junifer/pipeline/tests/test_registry.py +1 -1
  129. junifer/pipeline/update_meta_mixin.py +0 -3
  130. junifer/pipeline/utils.py +1 -67
  131. junifer/pipeline/workdir_manager.py +0 -3
  132. junifer/preprocess/__init__.py +2 -9
  133. junifer/preprocess/ants/__init__.py +4 -0
  134. junifer/preprocess/ants/ants_apply_transforms_warper.py +185 -0
  135. junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +56 -0
  136. junifer/preprocess/base.py +3 -6
  137. junifer/preprocess/bold_warper.py +265 -0
  138. junifer/preprocess/confounds/__init__.py +0 -3
  139. junifer/preprocess/confounds/fmriprep_confound_remover.py +60 -47
  140. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +113 -72
  141. junifer/preprocess/fsl/__init__.py +4 -0
  142. junifer/preprocess/fsl/apply_warper.py +179 -0
  143. junifer/preprocess/fsl/tests/test_apply_warper.py +45 -0
  144. junifer/preprocess/smoothing/__init__.py +0 -3
  145. junifer/preprocess/smoothing/_afni_smoothing.py +1 -1
  146. junifer/preprocess/tests/test_bold_warper.py +159 -0
  147. junifer/preprocess/warping/__init__.py +0 -3
  148. junifer/preprocess/warping/_ants_warper.py +0 -3
  149. junifer/preprocess/warping/_fsl_warper.py +0 -3
  150. junifer/stats.py +1 -4
  151. junifer/storage/__init__.py +1 -9
  152. junifer/storage/base.py +1 -40
  153. junifer/storage/hdf5.py +9 -71
  154. junifer/storage/pandas_base.py +0 -3
  155. junifer/storage/sqlite.py +0 -3
  156. junifer/storage/tests/test_hdf5.py +10 -82
  157. junifer/storage/utils.py +0 -9
  158. junifer/testing/__init__.py +1 -4
  159. junifer/testing/datagrabbers.py +6 -13
  160. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
  161. junifer/testing/utils.py +0 -3
  162. junifer/utils/__init__.py +2 -13
  163. junifer/utils/fs.py +0 -3
  164. junifer/utils/helpers.py +1 -32
  165. junifer/utils/logging.py +4 -33
  166. junifer/utils/tests/test_logging.py +0 -8
  167. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/METADATA +16 -17
  168. junifer-0.0.5.dev24.dist-info/RECORD +265 -0
  169. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/WHEEL +1 -1
  170. junifer/api/res/freesurfer/mri_binarize +0 -3
  171. junifer/api/res/freesurfer/mri_mc +0 -3
  172. junifer/api/res/freesurfer/mri_pretess +0 -3
  173. junifer/api/res/freesurfer/mris_convert +0 -3
  174. junifer/api/res/freesurfer/run_freesurfer_docker.sh +0 -61
  175. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  176. junifer/datagrabber/pattern_validation_mixin.py +0 -388
  177. junifer/datagrabber/tests/test_pattern_validation_mixin.py +0 -249
  178. junifer/external/BrainPrint/brainprint/__init__.py +0 -4
  179. junifer/external/BrainPrint/brainprint/_version.py +0 -3
  180. junifer/external/BrainPrint/brainprint/asymmetry.py +0 -91
  181. junifer/external/BrainPrint/brainprint/brainprint.py +0 -441
  182. junifer/external/BrainPrint/brainprint/surfaces.py +0 -258
  183. junifer/external/BrainPrint/brainprint/utils/__init__.py +0 -1
  184. junifer/external/BrainPrint/brainprint/utils/_config.py +0 -112
  185. junifer/external/BrainPrint/brainprint/utils/utils.py +0 -188
  186. junifer/external/nilearn/junifer_connectivity_measure.py +0 -483
  187. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +0 -1089
  188. junifer/markers/brainprint.py +0 -459
  189. junifer/markers/tests/test_brainprint.py +0 -58
  190. junifer-0.0.5.dist-info/RECORD +0 -275
  191. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/AUTHORS.rst +0 -0
  192. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/LICENSE.md +0 -0
  193. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/entry_points.txt +0 -0
  194. {junifer-0.0.5.dist-info → junifer-0.0.5.dev24.dist-info}/top_level.txt +0 -0
@@ -18,99 +18,142 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomicpiop1"
18
18
 
19
19
 
20
20
  @pytest.mark.parametrize(
21
- "type_, nested_types, tasks",
22
- [
23
- ("BOLD", ["confounds", "mask"], None),
24
- ("BOLD", ["confounds", "mask"], ["anticipation"]),
25
- ("BOLD", ["confounds", "mask"], ["emomatching", "faces"]),
26
- ("BOLD", ["confounds", "mask"], ["restingstate"]),
27
- ("BOLD", ["confounds", "mask"], ["workingmemory", "gstroop"]),
28
- (
29
- "BOLD",
30
- ["confounds", "mask"],
31
- ["anticipation", "faces", "restingstate"],
32
- ),
33
- ("T1w", ["mask"], None),
34
- ("VBM_CSF", None, None),
35
- ("VBM_GM", None, None),
36
- ("VBM_WM", None, None),
37
- ("DWI", None, None),
38
- ("FreeSurfer", None, None),
39
- ],
21
+ "tasks",
22
+ [None, "restingstate"],
40
23
  )
41
- def test_DataladAOMICPIOP1(
42
- type_: str,
43
- nested_types: Optional[List[str]],
44
- tasks: Optional[List[str]],
45
- ) -> None:
24
+ def test_DataladAOMICPIOP1(tasks: Optional[str]) -> None:
46
25
  """Test DataladAOMICPIOP1 DataGrabber.
47
26
 
48
27
  Parameters
49
28
  ----------
50
- type_ : str
51
- The parametrized type.
52
- nested_types : list of str or None
53
- The parametrized nested types.
54
- tasks : list of str or None
29
+ tasks : str or None
55
30
  The parametrized task values.
56
31
 
57
32
  """
58
- dg = DataladAOMICPIOP1(types=type_, tasks=tasks)
33
+ dg = DataladAOMICPIOP1(tasks=tasks)
59
34
  # Set URI to Gin
60
35
  dg.uri = URI
61
36
 
62
37
  with dg:
63
- # Get all elements
64
- all_elements = dg.get_elements()
65
- # Get test element
66
- test_element = all_elements[0]
67
- # Get test element data
68
- out = dg[test_element]
69
- # Get all elements
70
38
  all_elements = dg.get_elements()
71
- # Get test element
72
39
  test_element = all_elements[0]
73
- # Get test element data
40
+ sub, task = test_element
41
+
74
42
  out = dg[test_element]
75
- # Assert data type
76
- assert type_ in out
77
- # Check task name if BOLD
78
- if type_ == "BOLD" and tasks is not None:
79
- # Depending on task 'acquisition is different'
80
- task_acqs = {
81
- "anticipation": "seq",
82
- "emomatching": "seq",
83
- "faces": "mb3",
84
- "gstroop": "seq",
85
- "restingstate": "mb3",
86
- "workingmemory": "seq",
87
- }
88
- assert task_acqs[test_element[1]] in out[type_]["path"].name
89
- assert out[type_]["path"].exists()
90
- assert out[type_]["path"].is_file()
91
- # Asserts data type metadata
92
- assert "meta" in out[type_]
93
- meta = out[type_]["meta"]
43
+
44
+ # asserts type "BOLD"
45
+ assert "BOLD" in out
46
+
47
+ # depending on task 'acquisition is different'
48
+ task_acqs = {
49
+ "anticipation": "seq",
50
+ "emomatching": "seq",
51
+ "faces": "mb3",
52
+ "gstroop": "seq",
53
+ "restingstate": "mb3",
54
+ "workingmemory": "seq",
55
+ }
56
+ acq = task_acqs[task]
57
+ new_task = f"{task}_acq-{acq}"
58
+ assert (
59
+ out["BOLD"]["path"].name == f"{sub}_task-{new_task}_"
60
+ "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
61
+ )
62
+
63
+ assert out["BOLD"]["path"].exists()
64
+ assert out["BOLD"]["path"].is_file()
65
+
66
+ # asserts type "BOLD_confounds"
67
+ assert "BOLD_confounds" in out
68
+
69
+ assert (
70
+ out["BOLD_confounds"]["path"].name == f"{sub}_task-{new_task}_"
71
+ "desc-confounds_regressors.tsv"
72
+ )
73
+
74
+ assert out["BOLD_confounds"]["path"].exists()
75
+ assert out["BOLD_confounds"]["path"].is_file()
76
+
77
+ # assert BOLD_mask
78
+ assert out["BOLD_mask"]["path"].exists()
79
+
80
+ # asserts type "T1w"
81
+ assert "T1w" in out
82
+
83
+ assert (
84
+ out["T1w"]["path"].name == f"{sub}_space-MNI152NLin2009cAsym_"
85
+ "desc-preproc_T1w.nii.gz"
86
+ )
87
+
88
+ assert out["T1w"]["path"].exists()
89
+ assert out["T1w"]["path"].is_file()
90
+
91
+ # asserts T1w_mask
92
+ assert out["T1w_mask"]["path"].exists()
93
+
94
+ # asserts type "VBM_CSF"
95
+ assert "VBM_CSF" in out
96
+
97
+ assert (
98
+ out["VBM_CSF"]["path"].name
99
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
100
+ "CSF_probseg.nii.gz"
101
+ )
102
+
103
+ assert out["VBM_CSF"]["path"].exists()
104
+ assert out["VBM_CSF"]["path"].is_file()
105
+
106
+ # asserts type "VBM_GM"
107
+ assert "VBM_GM" in out
108
+
109
+ assert (
110
+ out["VBM_GM"]["path"].name
111
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
112
+ "GM_probseg.nii.gz"
113
+ )
114
+
115
+ assert out["VBM_GM"]["path"].exists()
116
+ assert out["VBM_GM"]["path"].is_file()
117
+
118
+ # asserts type "VBM_WM"
119
+ assert "VBM_WM" in out
120
+
121
+ assert (
122
+ out["VBM_WM"]["path"].name
123
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
124
+ "WM_probseg.nii.gz"
125
+ )
126
+
127
+ assert out["VBM_WM"]["path"].exists()
128
+ assert out["VBM_WM"]["path"].is_file()
129
+
130
+ # asserts type "DWI"
131
+ assert "DWI" in out
132
+
133
+ assert out["DWI"]["path"].name == f"{sub}_desc-preproc_dwi.nii.gz"
134
+
135
+ assert out["DWI"]["path"].exists()
136
+ assert out["DWI"]["path"].is_file()
137
+
138
+ # asserts meta
139
+ assert "meta" in out["BOLD"]
140
+ meta = out["BOLD"]["meta"]
94
141
  assert "element" in meta
95
142
  assert "subject" in meta["element"]
96
- assert test_element[0] == meta["element"]["subject"]
97
- # Assert nested data type if not None
98
- if nested_types is not None:
99
- for nested_type in nested_types:
100
- assert out[type_][nested_type]["path"].exists()
101
- assert out[type_][nested_type]["path"].is_file()
143
+ assert sub == meta["element"]["subject"]
102
144
 
103
145
 
104
146
  @pytest.mark.parametrize(
105
147
  "types",
106
148
  [
107
149
  "BOLD",
150
+ "BOLD_confounds",
108
151
  "T1w",
109
152
  "VBM_CSF",
110
153
  "VBM_GM",
111
154
  "VBM_WM",
112
155
  "DWI",
113
- ["BOLD", "VBM_CSF"],
156
+ ["BOLD", "BOLD_confounds"],
114
157
  ["T1w", "VBM_CSF"],
115
158
  ["VBM_GM", "VBM_WM"],
116
159
  ["DWI", "BOLD"],
@@ -18,79 +18,136 @@ URI = "https://gin.g-node.org/juaml/datalad-example-aomicpiop2"
18
18
 
19
19
 
20
20
  @pytest.mark.parametrize(
21
- "type_, nested_types, tasks",
22
- [
23
- ("BOLD", ["confounds", "mask"], None),
24
- ("BOLD", ["confounds", "mask"], ["restingstate"]),
25
- ("BOLD", ["confounds", "mask"], ["restingstate", "stopsignal"]),
26
- ("BOLD", ["confounds", "mask"], ["workingmemory", "stopsignal"]),
27
- ("BOLD", ["confounds", "mask"], ["workingmemory"]),
28
- ("T1w", ["mask"], None),
29
- ("VBM_CSF", None, None),
30
- ("VBM_GM", None, None),
31
- ("VBM_WM", None, None),
32
- ("DWI", None, None),
33
- ("FreeSurfer", None, None),
34
- ],
21
+ "tasks",
22
+ [None, "restingstate"],
35
23
  )
36
- def test_DataladAOMICPIOP2(
37
- type_: str,
38
- nested_types: Optional[List[str]],
39
- tasks: Optional[List[str]],
40
- ) -> None:
24
+ def test_DataladAOMICPIOP2(tasks: Optional[str]) -> None:
41
25
  """Test DataladAOMICPIOP2 DataGrabber.
42
26
 
43
27
  Parameters
44
28
  ----------
45
- type_ : str
46
- The parametrized type.
47
- nested_types : list of str or None
48
- The parametrized nested types.
49
- tasks : list of str or None
29
+ tasks : str or None
50
30
  The parametrized task values.
51
31
 
52
32
  """
53
- dg = DataladAOMICPIOP2(types=type_, tasks=tasks)
33
+ dg = DataladAOMICPIOP2(tasks=tasks)
54
34
  # Set URI to Gin
55
35
  dg.uri = URI
56
36
 
57
37
  with dg:
58
- # Get all elements
59
38
  all_elements = dg.get_elements()
60
- # Get test element
39
+
40
+ if tasks == "restingstate":
41
+ for el in all_elements:
42
+ assert el[1] == "restingstate"
43
+
61
44
  test_element = all_elements[0]
62
- # Get test element data
45
+ sub, task = test_element
63
46
  out = dg[test_element]
64
- # Assert data type
65
- assert type_ in out
66
- # Check task name if BOLD
67
- if type_ == "BOLD" and tasks is not None:
68
- assert test_element[1] in out[type_]["path"].name
69
- assert out[type_]["path"].exists()
70
- assert out[type_]["path"].is_file()
71
- # Asserts data type metadata
72
- assert "meta" in out[type_]
73
- meta = out[type_]["meta"]
47
+
48
+ # asserts type "BOLD"
49
+ assert "BOLD" in out
50
+
51
+ new_task = f"{task}_acq-seq"
52
+ assert (
53
+ out["BOLD"]["path"].name == f"{sub}_task-{new_task}_"
54
+ "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
55
+ )
56
+
57
+ assert out["BOLD"]["path"].exists()
58
+ assert out["BOLD"]["path"].is_file()
59
+
60
+ # asserts type "BOLD_confounds"
61
+ assert "BOLD_confounds" in out
62
+
63
+ assert (
64
+ out["BOLD_confounds"]["path"].name == f"{sub}_task-{new_task}_"
65
+ "desc-confounds_regressors.tsv"
66
+ )
67
+
68
+ assert out["BOLD_confounds"]["path"].exists()
69
+ assert out["BOLD_confounds"]["path"].is_file()
70
+
71
+ # assert BOLD_mask
72
+ assert out["BOLD_mask"]["path"].exists()
73
+
74
+ # asserts type "T1w"
75
+ assert "T1w" in out
76
+
77
+ assert (
78
+ out["T1w"]["path"].name == f"{sub}_space-MNI152NLin2009cAsym_"
79
+ "desc-preproc_T1w.nii.gz"
80
+ )
81
+
82
+ assert out["T1w"]["path"].exists()
83
+ assert out["T1w"]["path"].is_file()
84
+
85
+ # asserts T1w_mask
86
+ assert out["T1w_mask"]["path"].exists()
87
+
88
+ # asserts type "VBM_CSF"
89
+ assert "VBM_CSF" in out
90
+
91
+ assert (
92
+ out["VBM_CSF"]["path"].name
93
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
94
+ "CSF_probseg.nii.gz"
95
+ )
96
+
97
+ assert out["VBM_CSF"]["path"].exists()
98
+ assert out["VBM_CSF"]["path"].is_file()
99
+
100
+ # asserts type "VBM_GM"
101
+ assert "VBM_GM" in out
102
+
103
+ assert (
104
+ out["VBM_GM"]["path"].name
105
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
106
+ "GM_probseg.nii.gz"
107
+ )
108
+
109
+ assert out["VBM_GM"]["path"].exists()
110
+ assert out["VBM_GM"]["path"].is_file()
111
+
112
+ # asserts type "VBM_WM"
113
+ assert "VBM_WM" in out
114
+
115
+ assert (
116
+ out["VBM_WM"]["path"].name
117
+ == f"{sub}_space-MNI152NLin2009cAsym_label-"
118
+ "WM_probseg.nii.gz"
119
+ )
120
+
121
+ assert out["VBM_WM"]["path"].exists()
122
+ assert out["VBM_WM"]["path"].is_file()
123
+
124
+ # asserts type "DWI"
125
+ assert "DWI" in out
126
+
127
+ assert out["DWI"]["path"].name == f"{sub}_desc-preproc_dwi.nii.gz"
128
+
129
+ assert out["DWI"]["path"].exists()
130
+ assert out["DWI"]["path"].is_file()
131
+
132
+ # asserts meta
133
+ assert "meta" in out["BOLD"]
134
+ meta = out["BOLD"]["meta"]
74
135
  assert "element" in meta
75
136
  assert "subject" in meta["element"]
76
- assert test_element[0] == meta["element"]["subject"]
77
- # Assert nested data type if not None
78
- if nested_types is not None:
79
- for nested_type in nested_types:
80
- assert out[type_][nested_type]["path"].exists()
81
- assert out[type_][nested_type]["path"].is_file()
137
+ assert sub == meta["element"]["subject"]
82
138
 
83
139
 
84
140
  @pytest.mark.parametrize(
85
141
  "types",
86
142
  [
87
143
  "BOLD",
144
+ "BOLD_confounds",
88
145
  "T1w",
89
146
  "VBM_CSF",
90
147
  "VBM_GM",
91
148
  "VBM_WM",
92
149
  "DWI",
93
- ["BOLD", "VBM_CSF"],
150
+ ["BOLD", "BOLD_confounds"],
94
151
  ["T1w", "VBM_CSF"],
95
152
  ["VBM_GM", "VBM_WM"],
96
153
  ["DWI", "BOLD"],
@@ -11,9 +11,7 @@ from typing import Dict, Iterator, List, Tuple, Union
11
11
 
12
12
  from ..pipeline import UpdateMetaMixin
13
13
  from ..utils import logger, raise_error
14
-
15
-
16
- __all__ = ["BaseDataGrabber"]
14
+ from .utils import validate_types
17
15
 
18
16
 
19
17
  class BaseDataGrabber(ABC, UpdateMetaMixin):
@@ -29,21 +27,16 @@ class BaseDataGrabber(ABC, UpdateMetaMixin):
29
27
  datadir : str or pathlib.Path
30
28
  The directory where the data is / will be stored.
31
29
 
32
- Raises
33
- ------
34
- TypeError
35
- If ``types`` is not a list or if the values are not string.
30
+ Attributes
31
+ ----------
32
+ datadir : pathlib.Path
33
+ The directory where the data is / will be stored.
36
34
 
37
35
  """
38
36
 
39
37
  def __init__(self, types: List[str], datadir: Union[str, Path]) -> None:
40
38
  # Validate types
41
- if not isinstance(types, list):
42
- raise_error(msg="`types` must be a list", klass=TypeError)
43
- if any(not isinstance(x, str) for x in types):
44
- raise_error(
45
- msg="`types` must be a list of strings", klass=TypeError
46
- )
39
+ validate_types(types)
47
40
  self.types = types
48
41
 
49
42
  # Convert str to Path
@@ -21,9 +21,6 @@ from ..utils import logger, raise_error, warn_with_log
21
21
  from .base import BaseDataGrabber
22
22
 
23
23
 
24
- __all__ = ["DataladDataGrabber"]
25
-
26
-
27
24
  class DataladDataGrabber(BaseDataGrabber):
28
25
  """Abstract base class for datalad-based data fetching.
29
26
 
@@ -179,16 +176,7 @@ class DataladDataGrabber(BaseDataGrabber):
179
176
  The unmodified input dictionary.
180
177
 
181
178
  """
182
- to_get = []
183
- for type_val in out.values():
184
- # Iterate to check for nested "types" like mask
185
- for k, v in type_val.items():
186
- # Add base data type path
187
- if k == "path":
188
- to_get.append(v)
189
- # Add nested data type path
190
- if isinstance(v, dict) and "path" in v:
191
- to_get.append(v["path"])
179
+ to_get = [v["path"] for v in out.values() if "path" in v]
192
180
 
193
181
  if len(to_get) > 0:
194
182
  logger.debug(f"Getting {len(to_get)} files using datalad:")
@@ -25,16 +25,16 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
25
25
  The directory where the datalad dataset will be cloned. If None,
26
26
  the datalad dataset will be cloned into a temporary directory
27
27
  (default None).
28
- types: {"BOLD", "T1w", "VBM_CSF", "VBM_GM", "VBM_WM"} or \
29
- list of the options, optional
28
+ types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
29
+ "VBM_WM"} or a list of the options, optional
30
30
  DMCC data types. If None, all available data types are selected.
31
31
  (default None).
32
- sessions: {"ses-wave1bas", "ses-wave1pro", "ses-wave1rea"} or \
33
- list of the options, optional
32
+ sessions: {"ses-wave1bas", "ses-wave1pro", "ses-wave1rea"} or list of \
33
+ the options, optional
34
34
  DMCC sessions. If None, all available sessions are selected
35
35
  (default None).
36
36
  tasks: {"Rest", "Axcpt", "Cuedts", "Stern", "Stroop"} or \
37
- list of the options, optional
37
+ list of the options, optional
38
38
  DMCC task sessions. If None, all available task sessions are selected
39
39
  (default None).
40
40
  phase_encodings : {"AP", "PA"} or list of the options, optional
@@ -147,23 +147,24 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
147
147
  "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
148
148
  ),
149
149
  "space": "MNI152NLin2009cAsym",
150
- "mask": {
151
- "pattern": (
152
- "derivatives/fmriprep-1.3.2/{subject}/{session}/"
153
- "/func/{subject}_{session}_task-{task}_acq-mb4"
154
- "{phase_encoding}_run-{run}_"
155
- "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
156
- ),
157
- "space": "MNI152NLin2009cAsym",
158
- },
159
- "confounds": {
160
- "pattern": (
161
- "derivatives/fmriprep-1.3.2/{subject}/{session}/"
162
- "func/{subject}_{session}_task-{task}_acq-mb4"
163
- "{phase_encoding}_run-{run}_desc-confounds_regressors.tsv"
164
- ),
165
- "format": "fmriprep",
166
- },
150
+ "mask_item": "BOLD_mask",
151
+ },
152
+ "BOLD_confounds": {
153
+ "pattern": (
154
+ "derivatives/fmriprep-1.3.2/{subject}/{session}/"
155
+ "func/{subject}_{session}_task-{task}_acq-mb4"
156
+ "{phase_encoding}_run-{run}_desc-confounds_regressors.tsv"
157
+ ),
158
+ "format": "fmriprep",
159
+ },
160
+ "BOLD_mask": {
161
+ "pattern": (
162
+ "derivatives/fmriprep-1.3.2/{subject}/{session}/"
163
+ "/func/{subject}_{session}_task-{task}_acq-mb4"
164
+ "{phase_encoding}_run-{run}_"
165
+ "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
166
+ ),
167
+ "space": "MNI152NLin2009cAsym",
167
168
  },
168
169
  "T1w": {
169
170
  "pattern": (
@@ -171,13 +172,14 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
171
172
  "{subject}_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz"
172
173
  ),
173
174
  "space": "MNI152NLin2009cAsym",
174
- "mask": {
175
- "pattern": (
176
- "derivatives/fmriprep-1.3.2/{subject}/anat/"
177
- "{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
178
- ),
179
- "space": "MNI152NLin2009cAsym",
180
- },
175
+ "mask_item": "T1w_mask",
176
+ },
177
+ "T1w_mask": {
178
+ "pattern": (
179
+ "derivatives/fmriprep-1.3.2/{subject}/anat/"
180
+ "{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
181
+ ),
182
+ "space": "MNI152NLin2009cAsym",
181
183
  },
182
184
  "VBM_CSF": {
183
185
  "pattern": (
@@ -213,13 +215,14 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
213
215
  "{subject}_desc-preproc_T1w.nii.gz"
214
216
  ),
215
217
  "space": "native",
216
- "mask": {
217
- "pattern": (
218
- "derivatives/fmriprep-1.3.2/{subject}/anat/"
219
- "{subject}_desc-brain_mask.nii.gz"
220
- ),
221
- "space": "native",
222
- },
218
+ "mask_item": "T1w_mask",
219
+ },
220
+ "T1w_mask": {
221
+ "pattern": (
222
+ "derivatives/fmriprep-1.3.2/{subject}/anat/"
223
+ "{subject}_desc-brain_mask.nii.gz"
224
+ ),
225
+ "space": "native",
223
226
  },
224
227
  "Warp": {
225
228
  "pattern": (
@@ -294,6 +297,20 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
294
297
  phase_encoding=phase_encoding,
295
298
  run=run,
296
299
  )
300
+ if out.get("BOLD"):
301
+ out["BOLD"]["mask_item"] = "BOLD_mask"
302
+ # Add space information
303
+ out["BOLD"].update({"space": "MNI152NLin2009cAsym"})
304
+ if out.get("T1w"):
305
+ out["T1w"]["mask_item"] = "T1w_mask"
306
+ # Add space information
307
+ if self.native_t1w:
308
+ out["T1w"].update({"space": "native"})
309
+ else:
310
+ out["T1w"].update({"space": "MNI152NLin2009cAsym"})
311
+ if out.get("Warp"):
312
+ # Add source space information
313
+ out["Warp"].update({"src": "MNI152NLin2009cAsym"})
297
314
  return out
298
315
 
299
316
  def get_elements(self) -> List:
@@ -5,6 +5,3 @@
5
5
 
6
6
  from .hcp1200 import HCP1200
7
7
  from .datalad_hcp1200 import DataladHCP1200
8
-
9
-
10
- __all__ = ["HCP1200", "DataladHCP1200"]
@@ -14,9 +14,6 @@ from ...api.decorators import register_datagrabber
14
14
  from .hcp1200 import HCP1200
15
15
 
16
16
 
17
- __all__ = ["DataladHCP1200"]
18
-
19
-
20
17
  @register_datagrabber
21
18
  class DataladHCP1200(DataladDataGrabber, HCP1200):
22
19
  """Concrete implementation for datalad-based data fetching of HCP1200.
@@ -10,11 +10,8 @@ from pathlib import Path
10
10
  from typing import Dict, List, Union
11
11
 
12
12
  from ...api.decorators import register_datagrabber
13
- from ...utils import raise_error
14
13
  from ..pattern import PatternDataGrabber
15
-
16
-
17
- __all__ = ["HCP1200"]
14
+ from ..utils import raise_error
18
15
 
19
16
 
20
17
  @register_datagrabber