junifer 0.0.4.dev782__py3-none-any.whl → 0.0.4.dev814__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 (36) hide show
  1. junifer/_version.py +2 -2
  2. junifer/api/res/ants/ResampleImage +0 -0
  3. junifer/api/res/ants/antsApplyTransforms +0 -0
  4. junifer/api/res/ants/antsApplyTransformsToPoints +0 -0
  5. junifer/api/res/ants/run_ants_docker.sh +0 -0
  6. junifer/api/res/fsl/img2imgcoord +0 -0
  7. junifer/api/res/run_venv.sh +0 -0
  8. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +6 -1
  9. junifer/configs/juseless/datagrabbers/camcan_vbm.py +6 -1
  10. junifer/configs/juseless/datagrabbers/ixi_vbm.py +6 -1
  11. junifer/configs/juseless/datagrabbers/ucla.py +42 -24
  12. junifer/configs/juseless/datagrabbers/ukb_vbm.py +6 -1
  13. junifer/datagrabber/aomic/id1000.py +98 -91
  14. junifer/datagrabber/aomic/piop1.py +97 -73
  15. junifer/datagrabber/aomic/piop2.py +97 -73
  16. junifer/datagrabber/base.py +6 -4
  17. junifer/datagrabber/datalad_base.py +0 -2
  18. junifer/datagrabber/dmcc13_benchmark.py +87 -50
  19. junifer/datagrabber/hcp1200/hcp1200.py +21 -19
  20. junifer/datagrabber/pattern.py +124 -25
  21. junifer/datagrabber/pattern_datalad.py +111 -13
  22. junifer/datagrabber/tests/test_base.py +0 -6
  23. junifer/datagrabber/tests/test_datagrabber_utils.py +204 -76
  24. junifer/datagrabber/tests/test_datalad_base.py +0 -6
  25. junifer/datagrabber/tests/test_multiple.py +43 -10
  26. junifer/datagrabber/tests/test_pattern.py +125 -178
  27. junifer/datagrabber/tests/test_pattern_datalad.py +44 -25
  28. junifer/datagrabber/utils.py +141 -21
  29. junifer/datareader/default.py +6 -7
  30. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/METADATA +1 -1
  31. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/RECORD +30 -30
  32. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/AUTHORS.rst +0 -0
  33. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/LICENSE.md +0 -0
  34. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/WHEEL +0 -0
  35. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/entry_points.txt +0 -0
  36. {junifer-0.0.4.dev782.dist-info → junifer-0.0.4.dev814.dist-info}/top_level.txt +0 -0
@@ -74,50 +74,78 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
74
74
  self.tasks = tasks
75
75
  # The patterns
76
76
  patterns = {
77
- "BOLD": (
78
- "derivatives/fmriprep/sub-{subject}/func/"
79
- "sub-{subject}_task-{task}_"
80
- "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
81
- ),
82
- "BOLD_confounds": (
83
- "derivatives/fmriprep/sub-{subject}/func/"
84
- "sub-{subject}_task-{task}_"
85
- "desc-confounds_regressors.tsv"
86
- ),
87
- "BOLD_mask": (
88
- "derivatives/fmriprep/sub-{subject}/func/"
89
- "sub-{subject}_task-{task}_"
90
- "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
91
- ),
92
- "T1w": (
93
- "derivatives/fmriprep/sub-{subject}/anat/"
94
- "sub-{subject}_space-MNI152NLin2009cAsym_"
95
- "desc-preproc_T1w.nii.gz"
96
- ),
97
- "T1w_mask": (
98
- "derivatives/fmriprep/sub-{subject}/anat/"
99
- "sub-{subject}_space-MNI152NLin2009cAsym_"
100
- "desc-brain_mask.nii.gz"
101
- ),
102
- "probseg_CSF": (
103
- "derivatives/fmriprep/sub-{subject}/anat/"
104
- "sub-{subject}_space-MNI152NLin2009cAsym_label-"
105
- "CSF_probseg.nii.gz"
106
- ),
107
- "probseg_GM": (
108
- "derivatives/fmriprep/sub-{subject}/anat/"
109
- "sub-{subject}_space-MNI152NLin2009cAsym_label-"
110
- "GM_probseg.nii.gz"
111
- ),
112
- "probseg_WM": (
113
- "derivatives/fmriprep/sub-{subject}/anat/"
114
- "sub-{subject}_space-MNI152NLin2009cAsym_label-"
115
- "WM_probseg.nii.gz"
116
- ),
117
- "DWI": (
118
- "derivatives/dwipreproc/sub-{subject}/dwi/"
119
- "sub-{subject}_desc-preproc_dwi.nii.gz"
120
- ),
77
+ "BOLD": {
78
+ "pattern": (
79
+ "derivatives/fmriprep/sub-{subject}/func/"
80
+ "sub-{subject}_task-{task}_"
81
+ "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
82
+ ),
83
+ "space": "MNI152NLin2009cAsym",
84
+ "mask_item": "BOLD_mask",
85
+ },
86
+ "BOLD_confounds": {
87
+ "pattern": (
88
+ "derivatives/fmriprep/sub-{subject}/func/"
89
+ "sub-{subject}_task-{task}_"
90
+ "desc-confounds_regressors.tsv"
91
+ ),
92
+ "format": "fmriprep",
93
+ },
94
+ "BOLD_mask": {
95
+ "pattern": (
96
+ "derivatives/fmriprep/sub-{subject}/func/"
97
+ "sub-{subject}_task-{task}_"
98
+ "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
99
+ ),
100
+ "space": "MNI152NLin2009cAsym",
101
+ },
102
+ "T1w": {
103
+ "pattern": (
104
+ "derivatives/fmriprep/sub-{subject}/anat/"
105
+ "sub-{subject}_space-MNI152NLin2009cAsym_"
106
+ "desc-preproc_T1w.nii.gz"
107
+ ),
108
+ "space": "MNI152NLin2009cAsym",
109
+ "mask_item": "T1w_mask",
110
+ },
111
+ "T1w_mask": {
112
+ "pattern": (
113
+ "derivatives/fmriprep/sub-{subject}/anat/"
114
+ "sub-{subject}_space-MNI152NLin2009cAsym_"
115
+ "desc-brain_mask.nii.gz"
116
+ ),
117
+ "space": "MNI152NLin2009cAsym",
118
+ },
119
+ "probseg_CSF": {
120
+ "pattern": (
121
+ "derivatives/fmriprep/sub-{subject}/anat/"
122
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-"
123
+ "CSF_probseg.nii.gz"
124
+ ),
125
+ "space": "MNI152NLin2009cAsym",
126
+ },
127
+ "probseg_GM": {
128
+ "pattern": (
129
+ "derivatives/fmriprep/sub-{subject}/anat/"
130
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-"
131
+ "GM_probseg.nii.gz"
132
+ ),
133
+ "space": "MNI152NLin2009cAsym",
134
+ },
135
+ "probseg_WM": {
136
+ "pattern": (
137
+ "derivatives/fmriprep/sub-{subject}/anat/"
138
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-"
139
+ "WM_probseg.nii.gz"
140
+ ),
141
+ "space": "MNI152NLin2009cAsym",
142
+ },
143
+ "DWI": {
144
+ "pattern": (
145
+ "derivatives/dwipreproc/sub-{subject}/dwi/"
146
+ "sub-{subject}_desc-preproc_dwi.nii.gz"
147
+ ),
148
+ },
121
149
  }
122
150
  # Use native T1w assets
123
151
  self.native_t1w = False
@@ -125,19 +153,30 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
125
153
  self.native_t1w = True
126
154
  patterns.update(
127
155
  {
128
- "T1w": (
129
- "derivatives/fmriprep/sub-{subject}/anat/"
130
- "sub-{subject}_desc-preproc_T1w.nii.gz"
131
- ),
132
- "T1w_mask": (
133
- "derivatives/fmriprep/sub-{subject}/anat/"
134
- "sub-{subject}_desc-brain_mask.nii.gz"
135
- ),
136
- "Warp": (
137
- "derivatives/fmriprep/sub-{subject}/anat/"
138
- "sub-{subject}_from-MNI152NLin2009cAsym_to-T1w_"
139
- "mode-image_xfm.h5"
140
- ),
156
+ "T1w": {
157
+ "pattern": (
158
+ "derivatives/fmriprep/sub-{subject}/anat/"
159
+ "sub-{subject}_desc-preproc_T1w.nii.gz"
160
+ ),
161
+ "space": "native",
162
+ "mask_item": "T1w_mask",
163
+ },
164
+ "T1w_mask": {
165
+ "pattern": (
166
+ "derivatives/fmriprep/sub-{subject}/anat/"
167
+ "sub-{subject}_desc-brain_mask.nii.gz"
168
+ ),
169
+ "space": "native",
170
+ },
171
+ "Warp": {
172
+ "pattern": (
173
+ "derivatives/fmriprep/sub-{subject}/anat/"
174
+ "sub-{subject}_from-MNI152NLin2009cAsym_to-T1w_"
175
+ "mode-image_xfm.h5"
176
+ ),
177
+ "src": "MNI152NLin2009cAsym",
178
+ "dst": "native",
179
+ },
141
180
  }
142
181
  )
143
182
  # Set default types
@@ -192,19 +231,4 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
192
231
  specified element.
193
232
 
194
233
  """
195
- out = super().get_item(subject=subject, task=f"{task}_acq-seq")
196
- if out.get("BOLD"):
197
- out["BOLD"]["mask_item"] = "BOLD_mask"
198
- # Add space information
199
- out["BOLD"].update({"space": "MNI152NLin2009cAsym"})
200
- if out.get("T1w"):
201
- out["T1w"]["mask_item"] = "T1w_mask"
202
- # Add space information
203
- if self.native_t1w:
204
- out["T1w"].update({"space": "native"})
205
- else:
206
- out["T1w"].update({"space": "MNI152NLin2009cAsym"})
207
- if out.get("Warp"):
208
- # Add source space information
209
- out["Warp"].update({"src": "MNI152NLin2009cAsym"})
210
- return out
234
+ return super().get_item(subject=subject, task=f"{task}_acq-seq")
@@ -59,7 +59,9 @@ class BaseDataGrabber(ABC, UpdateMetaMixin):
59
59
  """
60
60
  yield from self.get_elements()
61
61
 
62
- def __getitem__(self, element: Union[str, Tuple[str]]) -> Dict[str, Dict]:
62
+ def __getitem__(
63
+ self, element: Union[str, Tuple[str, ...]]
64
+ ) -> Dict[str, Dict]:
63
65
  """Enable indexing support.
64
66
 
65
67
  Parameters
@@ -183,7 +185,7 @@ class BaseDataGrabber(ABC, UpdateMetaMixin):
183
185
  raise_error(
184
186
  msg="Concrete classes need to implement get_element_keys().",
185
187
  klass=NotImplementedError,
186
- )
188
+ ) # pragma: no cover
187
189
 
188
190
  @abstractmethod
189
191
  def get_elements(self) -> List[Union[str, Tuple[str]]]:
@@ -200,7 +202,7 @@ class BaseDataGrabber(ABC, UpdateMetaMixin):
200
202
  raise_error(
201
203
  msg="Concrete classes need to implement get_elements().",
202
204
  klass=NotImplementedError,
203
- )
205
+ ) # pragma: no cover
204
206
 
205
207
  @abstractmethod
206
208
  def get_item(self, **element: Dict) -> Dict[str, Dict]:
@@ -221,4 +223,4 @@ class BaseDataGrabber(ABC, UpdateMetaMixin):
221
223
  raise_error(
222
224
  msg="Concrete classes need to implement get_item().",
223
225
  klass=NotImplementedError,
224
- )
226
+ ) # pragma: no cover
@@ -17,12 +17,10 @@ import datalad.api as dl
17
17
  from datalad.support.exceptions import IncompleteResultsError
18
18
  from datalad.support.gitrepo import GitRepo
19
19
 
20
- from ..api.decorators import register_datagrabber
21
20
  from ..utils import logger, raise_error, warn_with_log
22
21
  from .base import BaseDataGrabber
23
22
 
24
23
 
25
- @register_datagrabber
26
24
  class DataladDataGrabber(BaseDataGrabber):
27
25
  """Abstract base class for datalad-based data fetching.
28
26
 
@@ -139,43 +139,69 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
139
139
  self.runs = runs
140
140
  # The patterns
141
141
  patterns = {
142
- "BOLD": (
143
- "derivatives/fmriprep-1.3.2/sub-{subject}/ses-{session}/"
144
- "func/sub-{subject}_ses-{session}_task-{task}_acq-mb4"
145
- "{phase_encoding}_run-{run}_"
146
- "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
147
- ),
148
- "BOLD_confounds": (
149
- "derivatives/fmriprep-1.3.2/sub-{subject}/ses-{session}/"
150
- "func/sub-{subject}_ses-{session}_task-{task}_acq-mb4"
151
- "{phase_encoding}_run-{run}_desc-confounds_regressors.tsv"
152
- ),
153
- "BOLD_mask": (
154
- "derivatives/fmriprep-1.3.2/sub-{subject}/ses-{session}/"
155
- "/func/sub-{subject}_ses-{session}_task-{task}_acq-mb4"
156
- "{phase_encoding}_run-{run}_"
157
- "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
158
- ),
159
- "T1w": (
160
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
161
- "sub-{subject}_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz"
162
- ),
163
- "T1w_mask": (
164
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
165
- "sub-{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
166
- ),
167
- "probseg_CSF": (
168
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
169
- "sub-{subject}_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz"
170
- ),
171
- "probseg_GM": (
172
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
173
- "sub-{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz"
174
- ),
175
- "probseg_WM": (
176
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
177
- "sub-{subject}_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz"
178
- ),
142
+ "BOLD": {
143
+ "pattern": (
144
+ "derivatives/fmriprep-1.3.2/sub-{subject}/ses-{session}/"
145
+ "func/sub-{subject}_ses-{session}_task-{task}_acq-mb4"
146
+ "{phase_encoding}_run-{run}_"
147
+ "space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"
148
+ ),
149
+ "space": "MNI152NLin2009cAsym",
150
+ "mask_item": "BOLD_mask",
151
+ },
152
+ "BOLD_confounds": {
153
+ "pattern": (
154
+ "derivatives/fmriprep-1.3.2/sub-{subject}/ses-{session}/"
155
+ "func/sub-{subject}_ses-{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/sub-{subject}/ses-{session}/"
163
+ "/func/sub-{subject}_ses-{session}_task-{task}_acq-mb4"
164
+ "{phase_encoding}_run-{run}_"
165
+ "space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
166
+ ),
167
+ "space": "MNI152NLin2009cAsym",
168
+ },
169
+ "T1w": {
170
+ "pattern": (
171
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
172
+ "sub-{subject}_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz"
173
+ ),
174
+ "space": "MNI152NLin2009cAsym",
175
+ "mask_item": "T1w_mask",
176
+ },
177
+ "T1w_mask": {
178
+ "pattern": (
179
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
180
+ "sub-{subject}_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz"
181
+ ),
182
+ "space": "MNI152NLin2009cAsym",
183
+ },
184
+ "probseg_CSF": {
185
+ "pattern": (
186
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
187
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz"
188
+ ),
189
+ "space": "MNI152NLin2009cAsym",
190
+ },
191
+ "probseg_GM": {
192
+ "pattern": (
193
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
194
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz"
195
+ ),
196
+ "space": "MNI152NLin2009cAsym",
197
+ },
198
+ "probseg_WM": {
199
+ "pattern": (
200
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
201
+ "sub-{subject}_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz"
202
+ ),
203
+ "space": "MNI152NLin2009cAsym",
204
+ },
179
205
  }
180
206
  # Use native T1w assets
181
207
  self.native_t1w = False
@@ -183,19 +209,30 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
183
209
  self.native_t1w = True
184
210
  patterns.update(
185
211
  {
186
- "T1w": (
187
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
188
- "sub-{subject}_desc-preproc_T1w.nii.gz"
189
- ),
190
- "T1w_mask": (
191
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
192
- "sub-{subject}_desc-brain_mask.nii.gz"
193
- ),
194
- "Warp": (
195
- "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
196
- "sub-{subject}_from-MNI152NLin2009cAsym_to-T1w_"
197
- "mode-image_xfm.h5"
198
- ),
212
+ "T1w": {
213
+ "pattern": (
214
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
215
+ "sub-{subject}_desc-preproc_T1w.nii.gz"
216
+ ),
217
+ "space": "native",
218
+ "mask_item": "T1w_mask",
219
+ },
220
+ "T1w_mask": {
221
+ "pattern": (
222
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
223
+ "sub-{subject}_desc-brain_mask.nii.gz"
224
+ ),
225
+ "space": "native",
226
+ },
227
+ "Warp": {
228
+ "pattern": (
229
+ "derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
230
+ "sub-{subject}_from-MNI152NLin2009cAsym_to-T1w_"
231
+ "mode-image_xfm.h5"
232
+ ),
233
+ "src": "MNI152NLin2009cAsym",
234
+ "dst": "native",
235
+ },
199
236
  }
200
237
  )
201
238
  # Set default types
@@ -106,14 +106,26 @@ class HCP1200(PatternDataGrabber):
106
106
  types = ["BOLD", "T1w", "Warp"]
107
107
  # The patterns
108
108
  patterns = {
109
- "BOLD": (
110
- "{subject}/MNINonLinear/Results/"
111
- "{task}_{phase_encoding}/"
112
- "{task}_{phase_encoding}"
113
- f"{suffix}.nii.gz"
114
- ),
115
- "T1w": "{subject}/T1w/T1w_acpc_dc_restore.nii.gz",
116
- "Warp": "{subject}/MNINonLinear/xfms/standard2acpc_dc.nii.gz",
109
+ "BOLD": {
110
+ "pattern": (
111
+ "{subject}/MNINonLinear/Results/"
112
+ "{task}_{phase_encoding}/"
113
+ "{task}_{phase_encoding}"
114
+ f"{suffix}.nii.gz"
115
+ ),
116
+ "space": "MNI152NLin6Asym",
117
+ },
118
+ "T1w": {
119
+ "pattern": "{subject}/T1w/T1w_acpc_dc_restore.nii.gz",
120
+ "space": "native",
121
+ },
122
+ "Warp": {
123
+ "pattern": (
124
+ "{subject}/MNINonLinear/xfms/standard2acpc_dc.nii.gz"
125
+ ),
126
+ "src": "MNI152NLin6Asym",
127
+ "dst": "native",
128
+ },
117
129
  }
118
130
  # The replacements
119
131
  replacements = ["subject", "task", "phase_encoding"]
@@ -150,19 +162,9 @@ class HCP1200(PatternDataGrabber):
150
162
  else:
151
163
  new_task = f"tfMRI_{task}"
152
164
 
153
- out = super().get_item(
165
+ return super().get_item(
154
166
  subject=subject, task=new_task, phase_encoding=phase_encoding
155
167
  )
156
- # Add space for BOLD data type
157
- if "BOLD" in out:
158
- out["BOLD"].update({"space": "MNI152NLin6Asym"})
159
- # Add space for T1w data type
160
- if "T1w" in out:
161
- out["T1w"].update({"space": "native"})
162
- # Add source space for Warp data type
163
- if "Warp" in out:
164
- out["Warp"].update({"src": "MNI152NLin6Asym"})
165
- return out
166
168
 
167
169
  def get_elements(self) -> List:
168
170
  """Implement fetching list of elements in the dataset.