junifer 0.0.4.dev486__py3-none-any.whl → 0.0.4.dev493__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.
junifer/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.0.4.dev486'
16
- __version_tuple__ = version_tuple = (0, 0, 4, 'dev486')
15
+ __version__ = version = '0.0.4.dev493'
16
+ __version_tuple__ = version_tuple = (0, 0, 4, 'dev493')
junifer/data/masks.py CHANGED
@@ -280,12 +280,16 @@ def get_mask( # noqa: C901
280
280
  f"because the item ({inherited_mask_item}) does not exist."
281
281
  )
282
282
  mask_img = extra_input[inherited_mask_item]["data"]
283
+ mask_space = target_data["space"]
283
284
  # Starting with new mask
284
285
  else:
285
286
  # Load mask
286
287
  mask_object, _, mask_space = load_mask(
287
288
  mask_name, path_only=False, resolution=resolution
288
289
  )
290
+ # Replace mask space with target space if mask's space is inherit
291
+ if mask_space == "inherit":
292
+ mask_space = target_data["space"]
289
293
  # If mask is callable like from nilearn
290
294
  if callable(mask_object):
291
295
  if mask_params is None:
@@ -306,20 +310,22 @@ def get_mask( # noqa: C901
306
310
  interpolation="nearest",
307
311
  copy=True,
308
312
  )
309
- all_spaces.append(mask_space)
313
+ all_spaces.append(mask_space)
310
314
  all_masks.append(mask_img)
311
315
 
312
316
  # Multiple masks, need intersection / union
313
317
  if len(all_masks) > 1:
314
- # Filter out "inherit" and make a set for spaces
315
- filtered_spaces = set(filter(lambda x: x != "inherit", all_spaces))
318
+ # Make a set of unique spaces
319
+ unique_spaces = set(all_spaces)
316
320
  # Intersect / union of masks only if all masks are in the same space
317
- if len(filtered_spaces) == 1:
321
+ if len(unique_spaces) == 1:
318
322
  mask_img = intersect_masks(all_masks, **intersect_params)
323
+ # Store the mask space for further checks
324
+ mask_space = next(iter(unique_spaces))
319
325
  else:
320
326
  raise_error(
321
327
  msg=(
322
- f"Masks are in different spaces: {filtered_spaces}, "
328
+ f"Masks are in different spaces: {unique_spaces}, "
323
329
  "unable to merge."
324
330
  ),
325
331
  klass=RuntimeError,
@@ -333,9 +339,10 @@ def get_mask( # noqa: C901
333
339
  "when there is only one mask."
334
340
  )
335
341
  mask_img = all_masks[0]
342
+ mask_space = all_spaces[0]
336
343
 
337
- # Warp mask if target data is native
338
- if target_data["space"] == "native":
344
+ # Warp mask if target data is native and mask space is not native
345
+ if target_data["space"] == "native" and target_data["space"] != mask_space:
339
346
  # Check for extra inputs
340
347
  if extra_input is None:
341
348
  raise_error(
@@ -392,7 +392,9 @@ def test_get_mask_inherit() -> None:
392
392
 
393
393
  # Now get the mask using the inherit functionality, passing the
394
394
  # computed mask as extra data
395
- extra_input = {"BOLD_MASK": {"data": gm_mask}}
395
+ extra_input = {
396
+ "BOLD_MASK": {"data": gm_mask, "space": input["BOLD"]["space"]}
397
+ }
396
398
  input["BOLD"]["mask_item"] = "BOLD_MASK"
397
399
  mask2 = get_mask(
398
400
  masks="inherit", target_data=input["BOLD"], extra_input=extra_input
@@ -405,11 +407,9 @@ def test_get_mask_inherit() -> None:
405
407
  @pytest.mark.parametrize(
406
408
  "masks,params",
407
409
  [
408
- (["GM_prob0.2", "compute_brain_mask"], {}),
409
- (
410
- ["GM_prob0.2", "compute_brain_mask"],
411
- {"threshold": 0.2},
412
- ),
410
+ (["GM_prob0.2", "GM_prob0.2_cortex"], {}),
411
+ (["compute_brain_mask", "compute_background_mask"], {}),
412
+ (["compute_brain_mask", "compute_epi_mask"], {}),
413
413
  ],
414
414
  )
415
415
  def test_get_mask_multiple(
@@ -574,7 +574,10 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
574
574
  # this allows to use "inherit" down the pipeline
575
575
  if extra_input is not None:
576
576
  logger.debug("Setting mask_item")
577
- extra_input["BOLD_mask"] = {"data": mask_img}
577
+ extra_input["BOLD_mask"] = {
578
+ "data": mask_img,
579
+ "space": input["space"],
580
+ }
578
581
  input["mask_item"] = "BOLD_mask"
579
582
 
580
583
  logger.info("Cleaning image")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: junifer
3
- Version: 0.0.4.dev486
3
+ Version: 0.0.4.dev493
4
4
  Summary: JUelich NeuroImaging FEature extractoR
5
5
  Author-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
6
6
  Maintainer-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
@@ -1,5 +1,5 @@
1
1
  junifer/__init__.py,sha256=x1UR2jUcrUdm2HNl-3Qvyi4UUrU6ms5qm2qcmNY7zZk,391
2
- junifer/_version.py,sha256=pv1IAbgY-EBbr6jHiL5xztxQVxFC_WUrz9qFu8tmPHY,428
2
+ junifer/_version.py,sha256=s3b4obIT6-Dm0gw7Hf_6VelPhsN39hihLhhrnI_A6sU,428
3
3
  junifer/stats.py,sha256=sU5IZ2qFZWbzgSutQS_z42miIVItpSGmQYBn6KkD5fA,6162
4
4
  junifer/api/__init__.py,sha256=YILu9M7SC0Ri4CVd90fELH2OnK_gvCYAXCoqBNCFE8E,257
5
5
  junifer/api/cli.py,sha256=xScav2mF-Jr8JjVFt8kaHuLpX5l_jVTaQGPgQL3VNvA,12881
@@ -42,7 +42,7 @@ junifer/configs/juseless/datagrabbers/tests/test_ucla.py,sha256=e-jdvcZ9B0mka6_5
42
42
  junifer/configs/juseless/datagrabbers/tests/test_ukb_vbm.py,sha256=b9hjc1mgO--PSRC3id2EzzfE2yWNsuZ2UI47a6sfGZU,1025
43
43
  junifer/data/__init__.py,sha256=oUjOs8_M6fitNb44izxpXf3su1e4pG_vCdjwVYkjZjQ,550
44
44
  junifer/data/coordinates.py,sha256=rwjPb6hYlCpxqM73UNatl7bLtXEF9o8nIEwXz1iwERE,11317
45
- junifer/data/masks.py,sha256=chWSl-vyv5Nsd9GuQzydXPOY3AdhApOJq_42NSKpykQ,16952
45
+ junifer/data/masks.py,sha256=gsA8_1l011uq2E0hRZvQvfk3_ER8HFsmWd3h6o5qPxE,17311
46
46
  junifer/data/parcellations.py,sha256=wL8lkAYYvg7NDt160EA8N_xFjK8ZtDwoXYJQHNHwbDU,55805
47
47
  junifer/data/utils.py,sha256=K9quLIoWRmm2QFM8Rdy_5bYsWb_XhL0l5Uq_1Sie0kA,1274
48
48
  junifer/data/VOIs/meta/CogAC_VOIs.txt,sha256=Sr5_E712OLdeQRyUcDNM0wLBvZIyO6gc9Q7KkyJHX1A,398
@@ -68,7 +68,7 @@ junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean_3mm.
68
68
  junifer/data/masks/vickery-patil/GMprob0.2_cortex_3mm_NA_rm.nii.gz,sha256=jfMe_4H9XEnArYms5bSQbqS2V1_HbLHTfI5amQa_Pes,8700
69
69
  junifer/data/tests/test_coordinates.py,sha256=BNkz9qFbnwAI0oVlIm_XrT-z4Vsia_rMtMVaoFXT6mU,4328
70
70
  junifer/data/tests/test_data_utils.py,sha256=Vy7x8zaHws5hmn92PKSv3H38hU2kamOpyaH6nG_NNpw,1086
71
- junifer/data/tests/test_masks.py,sha256=njo6yEzrBYDsojm6_7xGV3B8FvjmjK3zX3WBBYAs7aA,14496
71
+ junifer/data/tests/test_masks.py,sha256=Q_iMNktcxweRzoe5esFTpYgjt1pwPqIJk1Gqk0pb5GE,14570
72
72
  junifer/data/tests/test_parcellations.py,sha256=3Tk0bU4xT9TJfdrDWcUMq6ns-IPJUpZzkiR-PEbmM6M,36212
73
73
  junifer/datagrabber/__init__.py,sha256=pZHJIY8nAlbVngsyRScE6a6GKbytiwjJB7SdJNqIbl4,680
74
74
  junifer/datagrabber/base.py,sha256=clErdDX5jz8LTjwPTQPCv3jfELCJ2vObg7ks8imAx8Y,6224
@@ -192,7 +192,7 @@ junifer/preprocess/__init__.py,sha256=-3exohZnw-gJ-MjVM63WcXzBW1mbSetEVozcDfs5et
192
192
  junifer/preprocess/base.py,sha256=syiNqI8pUjoGyShZSjs_RTsd5VHhwoqzIfPfFstr4f4,6230
193
193
  junifer/preprocess/bold_warper.py,sha256=Sia8mCdluYNrFkYsRx0vP-z_RNF7x-dwHcEDkmpvnHo,3277
194
194
  junifer/preprocess/confounds/__init__.py,sha256=EDlcD9jy8O9xluJr6XOnFXtjGCDVqwg6sDIRDMbM8ZU,235
195
- junifer/preprocess/confounds/fmriprep_confound_remover.py,sha256=C6P00Ge5j5vxu7HSz4OXFML2aQAQseGXM45fXl-vTbs,21820
195
+ junifer/preprocess/confounds/fmriprep_confound_remover.py,sha256=23UJ6miqX0iE3dUMsZ1hzWoJDnMLl6WMlT-k9GFmAAU,21904
196
196
  junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py,sha256=OKACXAHytNrOAFZ5I2UcyfcYz5s2qeu31MZ9K71rWGc,22167
197
197
  junifer/preprocess/fsl/__init__.py,sha256=DerGFQ-dIuX5PT9a_BH6QkIXkJZVymjYy-woXF7tYGc,111
198
198
  junifer/preprocess/fsl/apply_warper.py,sha256=QTls4z2oF0qVqZ_S1yc-uYNUE9MeJZR4Lesv98SnJrc,7915
@@ -226,10 +226,10 @@ junifer/utils/fs.py,sha256=Jd9AoV2fIF7pT7KhXsn8T1O1fJ1_SFZgaFuOBAM7DG8,460
226
226
  junifer/utils/logging.py,sha256=4kH8j9X_J2bMdnBJMldVF95C5sURa5UAsLmSgRaD9Ig,9117
227
227
  junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
228
228
  junifer/utils/tests/test_logging.py,sha256=l8oo-AiBV7H6_IzlsNcj__cLeZBUvgIGoaMszD9VaJg,7754
229
- junifer-0.0.4.dev486.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
230
- junifer-0.0.4.dev486.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
231
- junifer-0.0.4.dev486.dist-info/METADATA,sha256=QVPItWF_irR7t8uq9u1SSTqfXWcxzKv__LpOf8qrk9c,7745
232
- junifer-0.0.4.dev486.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
233
- junifer-0.0.4.dev486.dist-info/entry_points.txt,sha256=DxFvKq0pOqRunAK0FxwJcoDfV1-dZvsFDpD5HRqSDhw,48
234
- junifer-0.0.4.dev486.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
235
- junifer-0.0.4.dev486.dist-info/RECORD,,
229
+ junifer-0.0.4.dev493.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
230
+ junifer-0.0.4.dev493.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
231
+ junifer-0.0.4.dev493.dist-info/METADATA,sha256=_3K04VVuQxUyuIslgoc7stjFrg9UP2yAychS_LN6gtY,7745
232
+ junifer-0.0.4.dev493.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
233
+ junifer-0.0.4.dev493.dist-info/entry_points.txt,sha256=DxFvKq0pOqRunAK0FxwJcoDfV1-dZvsFDpD5HRqSDhw,48
234
+ junifer-0.0.4.dev493.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
235
+ junifer-0.0.4.dev493.dist-info/RECORD,,