junifer 0.0.4.dev831__py3-none-any.whl → 0.0.5__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 (206) hide show
  1. junifer/__init__.py +17 -0
  2. junifer/_version.py +2 -2
  3. junifer/api/__init__.py +4 -1
  4. junifer/api/cli.py +91 -1
  5. junifer/api/decorators.py +9 -0
  6. junifer/api/functions.py +56 -10
  7. junifer/api/parser.py +3 -0
  8. junifer/api/queue_context/__init__.py +4 -1
  9. junifer/api/queue_context/gnu_parallel_local_adapter.py +16 -6
  10. junifer/api/queue_context/htcondor_adapter.py +16 -5
  11. junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +41 -12
  12. junifer/api/queue_context/tests/test_htcondor_adapter.py +48 -15
  13. junifer/api/res/afni/run_afni_docker.sh +1 -1
  14. junifer/api/res/ants/run_ants_docker.sh +1 -1
  15. junifer/api/res/freesurfer/mri_binarize +3 -0
  16. junifer/api/res/freesurfer/mri_mc +3 -0
  17. junifer/api/res/freesurfer/mri_pretess +3 -0
  18. junifer/api/res/freesurfer/mris_convert +3 -0
  19. junifer/api/res/freesurfer/run_freesurfer_docker.sh +61 -0
  20. junifer/api/res/fsl/run_fsl_docker.sh +1 -1
  21. junifer/api/res/{run_conda.sh → run_conda.bash} +1 -1
  22. junifer/api/res/run_conda.zsh +23 -0
  23. junifer/api/res/run_venv.bash +22 -0
  24. junifer/api/res/{run_venv.sh → run_venv.zsh} +1 -1
  25. junifer/api/tests/test_api_utils.py +4 -2
  26. junifer/api/tests/test_cli.py +83 -0
  27. junifer/api/tests/test_functions.py +27 -2
  28. junifer/configs/__init__.py +1 -1
  29. junifer/configs/juseless/__init__.py +4 -1
  30. junifer/configs/juseless/datagrabbers/__init__.py +10 -1
  31. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +4 -3
  32. junifer/configs/juseless/datagrabbers/camcan_vbm.py +3 -0
  33. junifer/configs/juseless/datagrabbers/ixi_vbm.py +4 -3
  34. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +1 -3
  35. junifer/configs/juseless/datagrabbers/ucla.py +12 -9
  36. junifer/configs/juseless/datagrabbers/ukb_vbm.py +3 -0
  37. junifer/data/__init__.py +21 -1
  38. junifer/data/coordinates.py +10 -19
  39. junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz +0 -0
  40. junifer/data/masks.py +58 -87
  41. junifer/data/parcellations.py +14 -3
  42. junifer/data/template_spaces.py +4 -1
  43. junifer/data/tests/test_masks.py +26 -37
  44. junifer/data/utils.py +3 -0
  45. junifer/datagrabber/__init__.py +18 -1
  46. junifer/datagrabber/aomic/__init__.py +3 -0
  47. junifer/datagrabber/aomic/id1000.py +70 -37
  48. junifer/datagrabber/aomic/piop1.py +69 -36
  49. junifer/datagrabber/aomic/piop2.py +71 -38
  50. junifer/datagrabber/aomic/tests/test_id1000.py +44 -100
  51. junifer/datagrabber/aomic/tests/test_piop1.py +65 -108
  52. junifer/datagrabber/aomic/tests/test_piop2.py +45 -102
  53. junifer/datagrabber/base.py +13 -6
  54. junifer/datagrabber/datalad_base.py +13 -1
  55. junifer/datagrabber/dmcc13_benchmark.py +36 -53
  56. junifer/datagrabber/hcp1200/__init__.py +3 -0
  57. junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -0
  58. junifer/datagrabber/hcp1200/hcp1200.py +4 -1
  59. junifer/datagrabber/multiple.py +45 -6
  60. junifer/datagrabber/pattern.py +170 -62
  61. junifer/datagrabber/pattern_datalad.py +25 -12
  62. junifer/datagrabber/pattern_validation_mixin.py +388 -0
  63. junifer/datagrabber/tests/test_datalad_base.py +4 -4
  64. junifer/datagrabber/tests/test_dmcc13_benchmark.py +46 -19
  65. junifer/datagrabber/tests/test_multiple.py +161 -84
  66. junifer/datagrabber/tests/test_pattern.py +45 -0
  67. junifer/datagrabber/tests/test_pattern_datalad.py +4 -4
  68. junifer/datagrabber/tests/test_pattern_validation_mixin.py +249 -0
  69. junifer/datareader/__init__.py +4 -1
  70. junifer/datareader/default.py +95 -43
  71. junifer/external/BrainPrint/brainprint/__init__.py +4 -0
  72. junifer/external/BrainPrint/brainprint/_version.py +3 -0
  73. junifer/external/BrainPrint/brainprint/asymmetry.py +91 -0
  74. junifer/external/BrainPrint/brainprint/brainprint.py +441 -0
  75. junifer/external/BrainPrint/brainprint/surfaces.py +258 -0
  76. junifer/external/BrainPrint/brainprint/utils/__init__.py +1 -0
  77. junifer/external/BrainPrint/brainprint/utils/_config.py +112 -0
  78. junifer/external/BrainPrint/brainprint/utils/utils.py +188 -0
  79. junifer/external/__init__.py +1 -1
  80. junifer/external/nilearn/__init__.py +5 -1
  81. junifer/external/nilearn/junifer_connectivity_measure.py +483 -0
  82. junifer/external/nilearn/junifer_nifti_spheres_masker.py +23 -9
  83. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +1089 -0
  84. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +76 -1
  85. junifer/markers/__init__.py +23 -1
  86. junifer/markers/base.py +68 -28
  87. junifer/markers/brainprint.py +459 -0
  88. junifer/markers/collection.py +10 -2
  89. junifer/markers/complexity/__init__.py +10 -0
  90. junifer/markers/complexity/complexity_base.py +26 -43
  91. junifer/markers/complexity/hurst_exponent.py +3 -0
  92. junifer/markers/complexity/multiscale_entropy_auc.py +3 -0
  93. junifer/markers/complexity/perm_entropy.py +3 -0
  94. junifer/markers/complexity/range_entropy.py +3 -0
  95. junifer/markers/complexity/range_entropy_auc.py +3 -0
  96. junifer/markers/complexity/sample_entropy.py +3 -0
  97. junifer/markers/complexity/tests/test_hurst_exponent.py +11 -3
  98. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +11 -3
  99. junifer/markers/complexity/tests/test_perm_entropy.py +11 -3
  100. junifer/markers/complexity/tests/test_range_entropy.py +11 -3
  101. junifer/markers/complexity/tests/test_range_entropy_auc.py +11 -3
  102. junifer/markers/complexity/tests/test_sample_entropy.py +11 -3
  103. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +11 -3
  104. junifer/markers/complexity/weighted_perm_entropy.py +3 -0
  105. junifer/markers/ets_rss.py +27 -42
  106. junifer/markers/falff/__init__.py +3 -0
  107. junifer/markers/falff/_afni_falff.py +5 -2
  108. junifer/markers/falff/_junifer_falff.py +3 -0
  109. junifer/markers/falff/falff_base.py +20 -46
  110. junifer/markers/falff/falff_parcels.py +56 -27
  111. junifer/markers/falff/falff_spheres.py +60 -29
  112. junifer/markers/falff/tests/test_falff_parcels.py +39 -23
  113. junifer/markers/falff/tests/test_falff_spheres.py +39 -23
  114. junifer/markers/functional_connectivity/__init__.py +9 -0
  115. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +63 -60
  116. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +45 -32
  117. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +49 -36
  118. junifer/markers/functional_connectivity/functional_connectivity_base.py +71 -70
  119. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +34 -25
  120. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +40 -30
  121. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +11 -7
  122. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +27 -7
  123. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +28 -12
  124. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +35 -11
  125. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +36 -62
  126. junifer/markers/parcel_aggregation.py +47 -61
  127. junifer/markers/reho/__init__.py +3 -0
  128. junifer/markers/reho/_afni_reho.py +5 -2
  129. junifer/markers/reho/_junifer_reho.py +4 -1
  130. junifer/markers/reho/reho_base.py +8 -27
  131. junifer/markers/reho/reho_parcels.py +28 -17
  132. junifer/markers/reho/reho_spheres.py +27 -18
  133. junifer/markers/reho/tests/test_reho_parcels.py +8 -3
  134. junifer/markers/reho/tests/test_reho_spheres.py +8 -3
  135. junifer/markers/sphere_aggregation.py +43 -59
  136. junifer/markers/temporal_snr/__init__.py +3 -0
  137. junifer/markers/temporal_snr/temporal_snr_base.py +23 -32
  138. junifer/markers/temporal_snr/temporal_snr_parcels.py +9 -6
  139. junifer/markers/temporal_snr/temporal_snr_spheres.py +9 -6
  140. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +6 -3
  141. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +6 -3
  142. junifer/markers/tests/test_brainprint.py +58 -0
  143. junifer/markers/tests/test_collection.py +9 -8
  144. junifer/markers/tests/test_ets_rss.py +15 -9
  145. junifer/markers/tests/test_markers_base.py +17 -18
  146. junifer/markers/tests/test_parcel_aggregation.py +93 -32
  147. junifer/markers/tests/test_sphere_aggregation.py +72 -19
  148. junifer/onthefly/__init__.py +4 -1
  149. junifer/onthefly/read_transform.py +3 -0
  150. junifer/pipeline/__init__.py +9 -1
  151. junifer/pipeline/pipeline_step_mixin.py +21 -4
  152. junifer/pipeline/registry.py +3 -0
  153. junifer/pipeline/singleton.py +3 -0
  154. junifer/pipeline/tests/test_registry.py +1 -1
  155. junifer/pipeline/update_meta_mixin.py +3 -0
  156. junifer/pipeline/utils.py +67 -1
  157. junifer/pipeline/workdir_manager.py +3 -0
  158. junifer/preprocess/__init__.py +10 -2
  159. junifer/preprocess/base.py +6 -3
  160. junifer/preprocess/confounds/__init__.py +3 -0
  161. junifer/preprocess/confounds/fmriprep_confound_remover.py +47 -60
  162. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +72 -113
  163. junifer/preprocess/smoothing/__init__.py +9 -0
  164. junifer/preprocess/smoothing/_afni_smoothing.py +119 -0
  165. junifer/preprocess/smoothing/_fsl_smoothing.py +116 -0
  166. junifer/preprocess/smoothing/_nilearn_smoothing.py +69 -0
  167. junifer/preprocess/smoothing/smoothing.py +174 -0
  168. junifer/preprocess/smoothing/tests/test_smoothing.py +94 -0
  169. junifer/preprocess/warping/__init__.py +3 -0
  170. junifer/preprocess/warping/_ants_warper.py +3 -0
  171. junifer/preprocess/warping/_fsl_warper.py +3 -0
  172. junifer/stats.py +4 -1
  173. junifer/storage/__init__.py +9 -1
  174. junifer/storage/base.py +40 -1
  175. junifer/storage/hdf5.py +71 -9
  176. junifer/storage/pandas_base.py +3 -0
  177. junifer/storage/sqlite.py +3 -0
  178. junifer/storage/tests/test_hdf5.py +82 -10
  179. junifer/storage/utils.py +9 -0
  180. junifer/testing/__init__.py +4 -1
  181. junifer/testing/datagrabbers.py +13 -6
  182. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
  183. junifer/testing/utils.py +3 -0
  184. junifer/utils/__init__.py +13 -2
  185. junifer/utils/fs.py +3 -0
  186. junifer/utils/helpers.py +32 -1
  187. junifer/utils/logging.py +33 -4
  188. junifer/utils/tests/test_logging.py +8 -0
  189. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/METADATA +17 -16
  190. junifer-0.0.5.dist-info/RECORD +275 -0
  191. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/WHEEL +1 -1
  192. junifer/datagrabber/tests/test_datagrabber_utils.py +0 -218
  193. junifer/datagrabber/utils.py +0 -230
  194. junifer/preprocess/ants/__init__.py +0 -4
  195. junifer/preprocess/ants/ants_apply_transforms_warper.py +0 -185
  196. junifer/preprocess/ants/tests/test_ants_apply_transforms_warper.py +0 -56
  197. junifer/preprocess/bold_warper.py +0 -265
  198. junifer/preprocess/fsl/__init__.py +0 -4
  199. junifer/preprocess/fsl/apply_warper.py +0 -179
  200. junifer/preprocess/fsl/tests/test_apply_warper.py +0 -45
  201. junifer/preprocess/tests/test_bold_warper.py +0 -159
  202. junifer-0.0.4.dev831.dist-info/RECORD +0 -257
  203. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/AUTHORS.rst +0 -0
  204. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/LICENSE.md +0 -0
  205. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/entry_points.txt +0 -0
  206. {junifer-0.0.4.dev831.dist-info → junifer-0.0.5.dist-info}/top_level.txt +0 -0
@@ -16,6 +16,9 @@ from ...utils import raise_error
16
16
  from ..pattern_datalad import PatternDataladDataGrabber
17
17
 
18
18
 
19
+ __all__ = ["DataladAOMICPIOP1"]
20
+
21
+
19
22
  @register_datagrabber
20
23
  class DataladAOMICPIOP1(PatternDataladDataGrabber):
21
24
  """Concrete implementation for pattern-based data fetching of AOMIC PIOP1.
@@ -26,8 +29,8 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
26
29
  The directory where the datalad dataset will be cloned. If None,
27
30
  the datalad dataset will be cloned into a temporary directory
28
31
  (default None).
29
- types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
30
- "VBM_WM", "DWI"} or a list of the options, optional
32
+ types: {"BOLD", "T1w", "VBM_CSF", "VBM_GM", "VBM_WM", "DWI", \
33
+ "FreeSurfer"} or list of the options, optional
31
34
  AOMIC data types. If None, all available data types are selected.
32
35
  (default None).
33
36
  tasks : {"restingstate", "anticipation", "emomatching", "faces", \
@@ -84,23 +87,22 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
84
87
  "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
85
88
  ),
86
89
  "space": "MNI152NLin2009cAsym",
87
- "mask_item": "BOLD_mask",
88
- },
89
- "BOLD_confounds": {
90
- "pattern": (
91
- "derivatives/fmriprep/{subject}/func/"
92
- "{subject}_task-{task}_"
93
- "desc-confounds_regressors.tsv"
94
- ),
95
- "format": "fmriprep",
96
- },
97
- "BOLD_mask": {
98
- "pattern": (
99
- "derivatives/fmriprep/{subject}/func/"
100
- "{subject}_task-{task}_"
101
- "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
102
- ),
103
- "space": "MNI152NLin2009cAsym",
90
+ "mask": {
91
+ "pattern": (
92
+ "derivatives/fmriprep/{subject}/func/"
93
+ "{subject}_task-{task}_"
94
+ "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
95
+ ),
96
+ "space": "MNI152NLin2009cAsym",
97
+ },
98
+ "confounds": {
99
+ "pattern": (
100
+ "derivatives/fmriprep/{subject}/func/"
101
+ "{subject}_task-{task}_"
102
+ "desc-confounds_regressors.tsv"
103
+ ),
104
+ "format": "fmriprep",
105
+ },
104
106
  },
105
107
  "T1w": {
106
108
  "pattern": (
@@ -109,15 +111,14 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
109
111
  "desc-preproc_T1w.nii.gz"
110
112
  ),
111
113
  "space": "MNI152NLin2009cAsym",
112
- "mask_item": "T1w_mask",
113
- },
114
- "T1w_mask": {
115
- "pattern": (
116
- "derivatives/fmriprep/{subject}/anat/"
117
- "{subject}_space-MNI152NLin2009cAsym_"
118
- "desc-brain_mask.nii.gz"
119
- ),
120
- "space": "MNI152NLin2009cAsym",
114
+ "mask": {
115
+ "pattern": (
116
+ "derivatives/fmriprep/{subject}/anat/"
117
+ "{subject}_space-MNI152NLin2009cAsym_"
118
+ "desc-brain_mask.nii.gz"
119
+ ),
120
+ "space": "MNI152NLin2009cAsym",
121
+ },
121
122
  },
122
123
  "VBM_CSF": {
123
124
  "pattern": (
@@ -149,6 +150,39 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
149
150
  "{subject}_desc-preproc_dwi.nii.gz"
150
151
  ),
151
152
  },
153
+ "FreeSurfer": {
154
+ "pattern": "derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]",
155
+ "aseg": {
156
+ "pattern": (
157
+ "derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]"
158
+ )
159
+ },
160
+ "norm": {
161
+ "pattern": (
162
+ "derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]"
163
+ )
164
+ },
165
+ "lh_white": {
166
+ "pattern": (
167
+ "derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]"
168
+ )
169
+ },
170
+ "rh_white": {
171
+ "pattern": (
172
+ "derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]"
173
+ )
174
+ },
175
+ "lh_pial": {
176
+ "pattern": (
177
+ "derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]"
178
+ )
179
+ },
180
+ "rh_pial": {
181
+ "pattern": (
182
+ "derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]"
183
+ )
184
+ },
185
+ },
152
186
  }
153
187
  # Use native T1w assets
154
188
  self.native_t1w = False
@@ -162,14 +196,13 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
162
196
  "{subject}_desc-preproc_T1w.nii.gz"
163
197
  ),
164
198
  "space": "native",
165
- "mask_item": "T1w_mask",
166
- },
167
- "T1w_mask": {
168
- "pattern": (
169
- "derivatives/fmriprep/{subject}/anat/"
170
- "{subject}_desc-brain_mask.nii.gz"
171
- ),
172
- "space": "native",
199
+ "mask": {
200
+ "pattern": (
201
+ "derivatives/fmriprep/{subject}/anat/"
202
+ "{subject}_desc-brain_mask.nii.gz"
203
+ ),
204
+ "space": "native",
205
+ },
173
206
  },
174
207
  "Warp": {
175
208
  "pattern": (
@@ -16,6 +16,9 @@ from ...utils import raise_error
16
16
  from ..pattern_datalad import PatternDataladDataGrabber
17
17
 
18
18
 
19
+ __all__ = ["DataladAOMICPIOP2"]
20
+
21
+
19
22
  @register_datagrabber
20
23
  class DataladAOMICPIOP2(PatternDataladDataGrabber):
21
24
  """Concrete implementation for pattern-based data fetching of AOMIC PIOP2.
@@ -26,12 +29,12 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
26
29
  The directory where the datalad dataset will be cloned. If None,
27
30
  the datalad dataset will be cloned into a temporary directory
28
31
  (default None).
29
- types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
30
- "VBM_WM", "DWI"} or a list of the options, optional
32
+ types: {"BOLD", "T1w", "VBM_CSF", "VBM_GM", "VBM_WM", "DWI", \
33
+ "FreeSurfer"} or list of the options, optional
31
34
  AOMIC data types. If None, all available data types are selected.
32
35
  (default None).
33
- tasks : {"restingstate", "stopsignal", "workingmemory"} \
34
- or list of the options, optional
36
+ tasks : {"restingstate", "stopsignal", "workingmemory"} or \
37
+ list of the options, optional
35
38
  AOMIC PIOP2 task sessions. If None, all available task sessions are
36
39
  selected (default None).
37
40
  native_t1w : bool, optional
@@ -81,23 +84,22 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
81
84
  "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
82
85
  ),
83
86
  "space": "MNI152NLin2009cAsym",
84
- "mask_item": "BOLD_mask",
85
- },
86
- "BOLD_confounds": {
87
- "pattern": (
88
- "derivatives/fmriprep/{subject}/func/"
89
- "{subject}_task-{task}_"
90
- "desc-confounds_regressors.tsv"
91
- ),
92
- "format": "fmriprep",
93
- },
94
- "BOLD_mask": {
95
- "pattern": (
96
- "derivatives/fmriprep/{subject}/func/"
97
- "{subject}_task-{task}_"
98
- "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
99
- ),
100
- "space": "MNI152NLin2009cAsym",
87
+ "mask": {
88
+ "pattern": (
89
+ "derivatives/fmriprep/{subject}/func/"
90
+ "{subject}_task-{task}_"
91
+ "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
92
+ ),
93
+ "space": "MNI152NLin2009cAsym",
94
+ },
95
+ "confounds": {
96
+ "pattern": (
97
+ "derivatives/fmriprep/{subject}/func/"
98
+ "{subject}_task-{task}_"
99
+ "desc-confounds_regressors.tsv"
100
+ ),
101
+ "format": "fmriprep",
102
+ },
101
103
  },
102
104
  "T1w": {
103
105
  "pattern": (
@@ -106,15 +108,14 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
106
108
  "desc-preproc_T1w.nii.gz"
107
109
  ),
108
110
  "space": "MNI152NLin2009cAsym",
109
- "mask_item": "T1w_mask",
110
- },
111
- "T1w_mask": {
112
- "pattern": (
113
- "derivatives/fmriprep/{subject}/anat/"
114
- "{subject}_space-MNI152NLin2009cAsym_"
115
- "desc-brain_mask.nii.gz"
116
- ),
117
- "space": "MNI152NLin2009cAsym",
111
+ "mask": {
112
+ "pattern": (
113
+ "derivatives/fmriprep/{subject}/anat/"
114
+ "{subject}_space-MNI152NLin2009cAsym_"
115
+ "desc-brain_mask.nii.gz"
116
+ ),
117
+ "space": "MNI152NLin2009cAsym",
118
+ },
118
119
  },
119
120
  "VBM_CSF": {
120
121
  "pattern": (
@@ -146,6 +147,39 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
146
147
  "{subject}_desc-preproc_dwi.nii.gz"
147
148
  ),
148
149
  },
150
+ "FreeSurfer": {
151
+ "pattern": "derivatives/freesurfer/[!f]{subject}/mri/T1.mg[z]",
152
+ "aseg": {
153
+ "pattern": (
154
+ "derivatives/freesurfer/[!f]{subject}/mri/aseg.mg[z]"
155
+ )
156
+ },
157
+ "norm": {
158
+ "pattern": (
159
+ "derivatives/freesurfer/[!f]{subject}/mri/norm.mg[z]"
160
+ )
161
+ },
162
+ "lh_white": {
163
+ "pattern": (
164
+ "derivatives/freesurfer/[!f]{subject}/surf/lh.whit[e]"
165
+ )
166
+ },
167
+ "rh_white": {
168
+ "pattern": (
169
+ "derivatives/freesurfer/[!f]{subject}/surf/rh.whit[e]"
170
+ )
171
+ },
172
+ "lh_pial": {
173
+ "pattern": (
174
+ "derivatives/freesurfer/[!f]{subject}/surf/lh.pia[l]"
175
+ )
176
+ },
177
+ "rh_pial": {
178
+ "pattern": (
179
+ "derivatives/freesurfer/[!f]{subject}/surf/rh.pia[l]"
180
+ )
181
+ },
182
+ },
149
183
  }
150
184
  # Use native T1w assets
151
185
  self.native_t1w = False
@@ -159,14 +193,13 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
159
193
  "{subject}_desc-preproc_T1w.nii.gz"
160
194
  ),
161
195
  "space": "native",
162
- "mask_item": "T1w_mask",
163
- },
164
- "T1w_mask": {
165
- "pattern": (
166
- "derivatives/fmriprep/{subject}/anat/"
167
- "{subject}_desc-brain_mask.nii.gz"
168
- ),
169
- "space": "native",
196
+ "mask": {
197
+ "pattern": (
198
+ "derivatives/fmriprep/{subject}/anat/"
199
+ "{subject}_desc-brain_mask.nii.gz"
200
+ ),
201
+ "space": "native",
202
+ },
170
203
  },
171
204
  "Warp": {
172
205
  "pattern": (
@@ -7,7 +7,7 @@
7
7
  # Synchon Mandal <s.mandal@fz-juelich.de>
8
8
  # License: AGPL
9
9
 
10
- from typing import List, Union
10
+ from typing import List, Optional, Union
11
11
 
12
12
  import pytest
13
13
 
@@ -17,126 +17,70 @@ from junifer.datagrabber.aomic.id1000 import DataladAOMICID1000
17
17
  URI = "https://gin.g-node.org/juaml/datalad-example-aomic1000"
18
18
 
19
19
 
20
- def test_DataladAOMICID1000() -> None:
21
- """Test DataladAOMICID1000 DataGrabber."""
22
- dg = DataladAOMICID1000()
20
+ @pytest.mark.parametrize(
21
+ "type_, nested_types",
22
+ [
23
+ ("BOLD", ["confounds", "mask"]),
24
+ ("T1w", ["mask"]),
25
+ ("VBM_CSF", None),
26
+ ("VBM_GM", None),
27
+ ("VBM_WM", None),
28
+ ("DWI", None),
29
+ ("FreeSurfer", None),
30
+ ],
31
+ )
32
+ def test_DataladAOMICID1000(
33
+ type_: str,
34
+ nested_types: Optional[List[str]],
35
+ ) -> None:
36
+ """Test DataladAOMICID1000 DataGrabber.
37
+
38
+ Parameters
39
+ ----------
40
+ type_ : str
41
+ The parametrized type.
42
+ nested_types : list of str or None
43
+ The parametrized nested types.
44
+
45
+ """
46
+ dg = DataladAOMICID1000(types=type_)
23
47
  # Set URI to Gin
24
48
  dg.uri = URI
25
49
 
26
50
  with dg:
51
+ # Get all elements
27
52
  all_elements = dg.get_elements()
53
+ # Get test element
28
54
  test_element = all_elements[0]
29
-
55
+ # Get test element data
30
56
  out = dg[test_element]
31
-
32
- # asserts type "BOLD"
33
- assert "BOLD" in out
34
-
35
- assert (
36
- out["BOLD"]["path"].name
37
- == f"{test_element}_task-moviewatching_"
38
- "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
39
- )
40
-
41
- assert out["BOLD"]["path"].exists()
42
- assert out["BOLD"]["path"].is_file()
43
-
44
- # asserts type "BOLD_confounds"
45
- assert "BOLD_confounds" in out
46
-
47
- assert (
48
- out["BOLD_confounds"]["path"].name
49
- == f"{test_element}_task-moviewatching_"
50
- "desc-confounds_regressors.tsv"
51
- )
52
-
53
- assert out["BOLD_confounds"]["path"].exists()
54
- assert out["BOLD_confounds"]["path"].is_file()
55
-
56
- # assert BOLD_mask
57
- assert out["BOLD_mask"]["path"].exists()
58
-
59
- # asserts type "T1w"
60
- assert "T1w" in out
61
-
62
- assert (
63
- out["T1w"]["path"].name
64
- == f"{test_element}_space-MNI152NLin2009cAsym_"
65
- "desc-preproc_T1w.nii.gz"
66
- )
67
-
68
- assert out["T1w"]["path"].exists()
69
- assert out["T1w"]["path"].is_file()
70
-
71
- # asserts T1w_mask
72
- assert out["T1w_mask"]["path"].exists()
73
-
74
- # asserts type "VBM_CSF"
75
- assert "VBM_CSF" in out
76
-
77
- assert (
78
- out["VBM_CSF"]["path"].name
79
- == f"{test_element}_space-MNI152NLin2009cAsym_label-"
80
- "CSF_probseg.nii.gz"
81
- )
82
-
83
- assert out["VBM_CSF"]["path"].exists()
84
- assert out["VBM_CSF"]["path"].is_file()
85
-
86
- # asserts type "VBM_GM"
87
- assert "VBM_GM" in out
88
-
89
- assert (
90
- out["VBM_GM"]["path"].name
91
- == f"{test_element}_space-MNI152NLin2009cAsym_label-"
92
- "GM_probseg.nii.gz"
93
- )
94
-
95
- assert out["VBM_GM"]["path"].exists()
96
- assert out["VBM_GM"]["path"].is_file()
97
-
98
- # asserts type "VBM_WM"
99
- assert "VBM_WM" in out
100
-
101
- assert (
102
- out["VBM_WM"]["path"].name
103
- == f"{test_element}_space-MNI152NLin2009cAsym_label-"
104
- "WM_probseg.nii.gz"
105
- )
106
-
107
- assert out["VBM_WM"]["path"].exists()
108
- assert out["VBM_WM"]["path"].is_file()
109
-
110
- # asserts type "DWI"
111
- assert "DWI" in out
112
-
113
- assert (
114
- out["DWI"]["path"].name
115
- == f"{test_element}_desc-preproc_dwi.nii.gz"
116
- )
117
-
118
- assert out["DWI"]["path"].exists()
119
- assert out["DWI"]["path"].is_file()
120
-
121
- # asserts meta
122
- assert "meta" in out["BOLD"]
123
- meta = out["BOLD"]["meta"]
57
+ # Assert data type
58
+ assert type_ in out
59
+ assert out[type_]["path"].exists()
60
+ assert out[type_]["path"].is_file()
61
+ # Asserts data type metadata
62
+ assert "meta" in out[type_]
63
+ meta = out[type_]["meta"]
124
64
  assert "element" in meta
125
65
  assert "subject" in meta["element"]
126
66
  assert test_element == meta["element"]["subject"]
67
+ # Assert nested data type if not None
68
+ if nested_types is not None:
69
+ for nested_type in nested_types:
70
+ assert out[type_][nested_type]["path"].exists()
71
+ assert out[type_][nested_type]["path"].is_file()
127
72
 
128
73
 
129
74
  @pytest.mark.parametrize(
130
75
  "types",
131
76
  [
132
77
  "BOLD",
133
- "BOLD_confounds",
134
78
  "T1w",
135
79
  "VBM_CSF",
136
80
  "VBM_GM",
137
81
  "VBM_WM",
138
82
  "DWI",
139
- ["BOLD", "BOLD_confounds"],
83
+ ["BOLD", "VBM_CSF"],
140
84
  ["T1w", "VBM_CSF"],
141
85
  ["VBM_GM", "VBM_WM"],
142
86
  ["DWI", "BOLD"],