junifer 0.0.6.dev335__py3-none-any.whl → 0.0.6.dev349__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 +2 -2
- junifer/data/masks/_ants_mask_warper.py +2 -2
- junifer/data/masks/_masks.py +192 -87
- junifer/data/masks/tests/test_masks.py +0 -1
- junifer/data/parcellations/_parcellations.py +18 -1
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/METADATA +1 -1
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/RECORD +12 -12
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/WHEEL +0 -0
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev335.dist-info → junifer-0.0.6.dev349.dist-info}/top_level.txt +0 -0
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.6.
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 6, '
|
15
|
+
__version__ = version = '0.0.6.dev349'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev349')
|
@@ -46,7 +46,7 @@ class ANTsMaskWarper:
|
|
46
46
|
The mask image to transform.
|
47
47
|
src : str
|
48
48
|
The data type or template space to warp from.
|
49
|
-
It should be empty string if ``dst="
|
49
|
+
It should be empty string if ``dst="native"``.
|
50
50
|
dst : str
|
51
51
|
The data type or template space to warp to.
|
52
52
|
`"native"` is the only allowed data type and it uses the resampled
|
@@ -58,7 +58,7 @@ class ANTsMaskWarper:
|
|
58
58
|
will be applied.
|
59
59
|
warp_data : dict or None
|
60
60
|
The warp data item of the data object. The value is unused if
|
61
|
-
``dst!="
|
61
|
+
``dst!="native"``.
|
62
62
|
|
63
63
|
Returns
|
64
64
|
-------
|
junifer/data/masks/_masks.py
CHANGED
@@ -44,23 +44,26 @@ _masks_path = Path(__file__).parent
|
|
44
44
|
|
45
45
|
def compute_brain_mask(
|
46
46
|
target_data: dict[str, Any],
|
47
|
-
|
47
|
+
warp_data: Optional[dict[str, Any]] = None,
|
48
48
|
mask_type: str = "brain",
|
49
49
|
threshold: float = 0.5,
|
50
|
+
source: str = "template",
|
51
|
+
extra_input: Optional[dict[str, Any]] = None,
|
50
52
|
) -> "Nifti1Image":
|
51
53
|
"""Compute the whole-brain, grey-matter or white-matter mask.
|
52
54
|
|
53
55
|
This mask is calculated using the template space and resolution as found
|
54
|
-
in the ``target_data``.
|
56
|
+
in the ``target_data``. If target space is native, then the template is
|
57
|
+
warped to native and then thresholded.
|
55
58
|
|
56
59
|
Parameters
|
57
60
|
----------
|
58
61
|
target_data : dict
|
59
62
|
The corresponding item of the data object for which mask will be
|
60
63
|
loaded.
|
61
|
-
|
62
|
-
The
|
63
|
-
|
64
|
+
warp_data : dict or None, optional
|
65
|
+
The warp data item of the data object. Needs to be provided if
|
66
|
+
``target_data`` is in native space (default None).
|
64
67
|
mask_type : {"brain", "gm", "wm"}, optional
|
65
68
|
Type of mask to be computed:
|
66
69
|
|
@@ -71,6 +74,13 @@ def compute_brain_mask(
|
|
71
74
|
(default "brain").
|
72
75
|
threshold : float, optional
|
73
76
|
The value under which the template is cut off (default 0.5).
|
77
|
+
source : {"subject", "template"}, optional
|
78
|
+
The source of the mask. If "subject", the mask is computed from the
|
79
|
+
subject's data (``VBM_GM`` or ``VBM_WM``). If "template", the mask is
|
80
|
+
computed from the template data (default "template").
|
81
|
+
extra_input : dict, optional
|
82
|
+
The other fields in the data object. Useful for accessing other data
|
83
|
+
types (default None).
|
74
84
|
|
75
85
|
Returns
|
76
86
|
-------
|
@@ -81,7 +91,13 @@ def compute_brain_mask(
|
|
81
91
|
------
|
82
92
|
ValueError
|
83
93
|
If ``mask_type`` is invalid or
|
84
|
-
if ``
|
94
|
+
if ``source`` is invalid or
|
95
|
+
if ``source="subject"`` and ``mask_type`` is invalid or
|
96
|
+
if ``warp_data`` is None when ``target_data``'s space is native or
|
97
|
+
if ``extra_input`` is None when ``source="subject"`` or
|
98
|
+
if ``VBM_GM`` or ``VBM_WM`` data types are not in ``extra_input``
|
99
|
+
when ``source="subject"`` and ``mask_type`` is ``"gm"`` or ``"wm"``
|
100
|
+
respectively.
|
85
101
|
|
86
102
|
"""
|
87
103
|
logger.debug(f"Computing {mask_type} mask")
|
@@ -89,40 +105,77 @@ def compute_brain_mask(
|
|
89
105
|
if mask_type not in ["brain", "gm", "wm"]:
|
90
106
|
raise_error(f"Unknown mask type: {mask_type}")
|
91
107
|
|
108
|
+
if source not in ["subject", "template"]:
|
109
|
+
raise_error(f"Unknown mask source: {source}")
|
110
|
+
|
111
|
+
if source == "subject" and mask_type not in ["gm", "wm"]:
|
112
|
+
raise_error(f"Unknown mask type: {mask_type} for subject space")
|
113
|
+
|
92
114
|
# Check pre-requirements for space manipulation
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
115
|
+
if target_data["space"] == "native":
|
116
|
+
# Warp data check
|
117
|
+
if warp_data is None:
|
118
|
+
raise_error("No `warp_data` provided")
|
119
|
+
# Set space to fetch template using
|
120
|
+
target_std_space = warp_data["src"]
|
121
|
+
else:
|
122
|
+
# Set space to fetch template using
|
123
|
+
target_std_space = target_data["space"]
|
124
|
+
|
125
|
+
if source == "subject":
|
126
|
+
key = f"VBM_{mask_type.upper()}"
|
98
127
|
# Check for extra inputs
|
99
128
|
if extra_input is None:
|
100
129
|
raise_error(
|
101
|
-
"No extra input provided, requires `
|
102
|
-
"data type to infer target template space."
|
130
|
+
f"No extra input provided, requires `{key}` "
|
131
|
+
"data type to infer target template data and space."
|
132
|
+
)
|
133
|
+
# Check for missing data type
|
134
|
+
if key not in extra_input:
|
135
|
+
raise_error(
|
136
|
+
f"Cannot compute {mask_type} from subject's data. "
|
137
|
+
f"Missing {key} in extra input."
|
138
|
+
)
|
139
|
+
template = extra_input[key]["data"]
|
140
|
+
template_space = extra_input[key]["space"]
|
141
|
+
else:
|
142
|
+
# Fetch template in closest resolution
|
143
|
+
template = get_template(
|
144
|
+
space=target_std_space,
|
145
|
+
target_img=target_data["data"],
|
146
|
+
extra_input=None,
|
147
|
+
template_type=mask_type,
|
148
|
+
)
|
149
|
+
template_space = target_std_space
|
150
|
+
# Resample and warp template if target space is native
|
151
|
+
if target_data["space"] == "native" and template_space != "native":
|
152
|
+
if warp_data["warper"] == "fsl":
|
153
|
+
resampled_template = FSLMaskWarper().warp(
|
154
|
+
mask_name=f"template_{target_std_space}_for_compute_brain_mask",
|
155
|
+
mask_img=template,
|
156
|
+
target_data=target_data,
|
157
|
+
warp_data=warp_data,
|
158
|
+
)
|
159
|
+
elif warp_data["warper"] == "ants":
|
160
|
+
resampled_template = ANTsMaskWarper().warp(
|
161
|
+
mask_name=f"template_{target_std_space}_for_compute_brain_mask",
|
162
|
+
# use template here
|
163
|
+
mask_img=template,
|
164
|
+
src=target_std_space,
|
165
|
+
dst="native",
|
166
|
+
target_data=target_data,
|
167
|
+
warp_data=warp_data,
|
103
168
|
)
|
104
|
-
# Set target standard space to warp file space source
|
105
|
-
for entry in extra_input["Warp"]:
|
106
|
-
if entry["dst"] == "native":
|
107
|
-
target_std_space = entry["src"]
|
108
|
-
|
109
|
-
target_img = target_data["data"]
|
110
|
-
# Fetch template in closest resolution
|
111
|
-
template = get_template(
|
112
|
-
space=target_std_space,
|
113
|
-
target_img=target_img,
|
114
|
-
extra_input=extra_input,
|
115
|
-
template_type=mask_type,
|
116
|
-
)
|
117
169
|
# Resample template to target image
|
118
|
-
|
119
|
-
|
120
|
-
|
170
|
+
else:
|
171
|
+
resampled_template = resample_to_img(
|
172
|
+
source_img=template, target_img=target_data["data"]
|
173
|
+
)
|
121
174
|
|
122
|
-
# Threshold and get mask
|
175
|
+
# Threshold resampled template and get mask
|
123
176
|
mask = (get_data(resampled_template) >= threshold).astype("int8")
|
124
177
|
|
125
|
-
return new_img_like(
|
178
|
+
return new_img_like(target_data["data"], mask) # type: ignore
|
126
179
|
|
127
180
|
|
128
181
|
class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
@@ -369,6 +422,8 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
369
422
|
"""
|
370
423
|
# Check pre-requirements for space manipulation
|
371
424
|
target_space = target_data["space"]
|
425
|
+
logger.debug(f"Getting masks: {masks} in {target_space} space")
|
426
|
+
|
372
427
|
# Extra data type requirement check if target space is native
|
373
428
|
if target_space == "native":
|
374
429
|
# Check for extra inputs
|
@@ -385,7 +440,13 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
385
440
|
)
|
386
441
|
# Set target standard space to warp file space source
|
387
442
|
target_std_space = warper_spec["src"]
|
443
|
+
logger.debug(
|
444
|
+
f"Target space is native. Will warp from {target_std_space}"
|
445
|
+
)
|
388
446
|
else:
|
447
|
+
# Set warper_spec so that compute_brain_mask does not fail when
|
448
|
+
# target space is non-native
|
449
|
+
warper_spec = None
|
389
450
|
# Set target standard space to target space
|
390
451
|
target_std_space = target_space
|
391
452
|
|
@@ -398,31 +459,33 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
398
459
|
masks = [masks]
|
399
460
|
|
400
461
|
# Check that masks passed as dicts have only one key
|
401
|
-
|
462
|
+
invalid_mask_specs = [
|
402
463
|
x for x in masks if isinstance(x, dict) and len(x) != 1
|
403
464
|
]
|
404
|
-
if
|
465
|
+
if invalid_mask_specs:
|
405
466
|
raise_error(
|
406
467
|
"Each of the masks dictionary must have only one key, "
|
407
468
|
"the name of the mask. The following dictionaries are "
|
408
|
-
f"invalid: {
|
469
|
+
f"invalid: {invalid_mask_specs}"
|
409
470
|
)
|
410
471
|
|
411
|
-
#
|
472
|
+
# Store params for nilearn.masking.intersect_mask()
|
412
473
|
intersect_params = {}
|
413
|
-
|
474
|
+
# Store all mask specs for further operations
|
475
|
+
mask_specs = []
|
414
476
|
for t_mask in masks:
|
415
477
|
if isinstance(t_mask, dict):
|
478
|
+
# Get params to pass to nilearn.masking.intersect_mask()
|
416
479
|
if "threshold" in t_mask:
|
417
480
|
intersect_params["threshold"] = t_mask["threshold"]
|
418
481
|
continue
|
419
|
-
|
482
|
+
if "connected" in t_mask:
|
420
483
|
intersect_params["connected"] = t_mask["connected"]
|
421
484
|
continue
|
422
|
-
#
|
423
|
-
|
485
|
+
# Add mask spec
|
486
|
+
mask_specs.append(t_mask)
|
424
487
|
|
425
|
-
if
|
488
|
+
if not mask_specs:
|
426
489
|
raise_error("No mask was passed. At least one mask is required.")
|
427
490
|
|
428
491
|
# Get the nested mask data type for the input data type
|
@@ -430,7 +493,7 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
430
493
|
|
431
494
|
# Get all the masks
|
432
495
|
all_masks = []
|
433
|
-
for t_mask in
|
496
|
+
for t_mask in mask_specs:
|
434
497
|
if isinstance(t_mask, dict):
|
435
498
|
mask_name = next(iter(t_mask.keys()))
|
436
499
|
mask_params = t_mask[mask_name]
|
@@ -441,33 +504,60 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
441
504
|
# If mask is being inherited from the datagrabber or a
|
442
505
|
# preprocessor, check that it's accessible
|
443
506
|
if mask_name == "inherit":
|
507
|
+
logger.debug("Using inherited mask.")
|
444
508
|
if inherited_mask_item is None:
|
445
509
|
raise_error(
|
446
510
|
"Cannot inherit mask from the target data. Either the "
|
447
511
|
"DataGrabber or a Preprocessor does not provide "
|
448
512
|
"`mask` for the target data type."
|
449
513
|
)
|
514
|
+
logger.debug(
|
515
|
+
f"Inherited mask is in {inherited_mask_item['space']} "
|
516
|
+
"space."
|
517
|
+
)
|
450
518
|
mask_img = inherited_mask_item["data"]
|
519
|
+
|
520
|
+
if inherited_mask_item["space"] != target_space:
|
521
|
+
raise_error(
|
522
|
+
"Inherited mask space does not match target space."
|
523
|
+
)
|
524
|
+
logger.debug("Resampling inherited mask to target image.")
|
525
|
+
# Resample inherited mask to target image
|
526
|
+
mask_img = resample_to_img(
|
527
|
+
source_img=mask_img,
|
528
|
+
target_img=target_data["data"],
|
529
|
+
)
|
451
530
|
# Starting with new mask
|
452
531
|
else:
|
453
532
|
# Load mask
|
533
|
+
logger.debug(f"Loading mask {t_mask}.")
|
454
534
|
mask_object, _, mask_space = self.load(
|
455
535
|
mask_name, path_only=False, resolution=resolution
|
456
536
|
)
|
457
|
-
#
|
458
|
-
#
|
459
|
-
if mask_space == "inherit":
|
460
|
-
mask_space = target_std_space
|
461
|
-
# If mask is callable like from nilearn
|
537
|
+
# If mask is callable like from nilearn; space will be inherit
|
538
|
+
# so no check for that
|
462
539
|
if callable(mask_object):
|
540
|
+
logger.debug("Computing mask (callable).")
|
463
541
|
if mask_params is None:
|
464
542
|
mask_params = {}
|
465
543
|
# From nilearn
|
466
|
-
if mask_name
|
544
|
+
if mask_name in [
|
545
|
+
"compute_epi_mask",
|
546
|
+
"compute_background_mask",
|
547
|
+
]:
|
467
548
|
mask_img = mask_object(target_img, **mask_params)
|
468
|
-
#
|
549
|
+
# custom compute_brain_mask
|
550
|
+
elif mask_name == "compute_brain_mask":
|
551
|
+
mask_img = mask_object(
|
552
|
+
target_data=target_data,
|
553
|
+
warp_data=warper_spec,
|
554
|
+
extra_input=extra_input,
|
555
|
+
**mask_params,
|
556
|
+
)
|
557
|
+
# custom registered; arm kept for clarity
|
469
558
|
else:
|
470
|
-
mask_img = mask_object(
|
559
|
+
mask_img = mask_object(target_img, **mask_params)
|
560
|
+
|
471
561
|
# Mask is a Nifti1Image
|
472
562
|
else:
|
473
563
|
# Mask params provided
|
@@ -477,33 +567,68 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
477
567
|
"Cannot pass callable params to a non-callable "
|
478
568
|
"mask."
|
479
569
|
)
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
570
|
+
|
571
|
+
# Resample and warp mask to standard space
|
572
|
+
if mask_space != target_std_space:
|
573
|
+
logger.debug(
|
574
|
+
f"Warping {t_mask} to {target_std_space} space "
|
575
|
+
"using ants."
|
576
|
+
)
|
577
|
+
mask_img = ANTsMaskWarper().warp(
|
578
|
+
mask_name=mask_name,
|
579
|
+
mask_img=mask_object,
|
580
|
+
src=mask_space,
|
581
|
+
dst=target_std_space,
|
582
|
+
target_data=target_data,
|
583
|
+
warp_data=warper_spec,
|
584
|
+
)
|
585
|
+
|
586
|
+
else:
|
587
|
+
# Resample mask to target image; no further warping
|
588
|
+
logger.debug(f"Resampling {t_mask} to target image.")
|
589
|
+
if target_space != "native":
|
590
|
+
mask_img = resample_to_img(
|
591
|
+
source_img=mask_object,
|
592
|
+
target_img=target_data["data"],
|
593
|
+
)
|
594
|
+
# Set mask_img in case no warping happens before this
|
595
|
+
else:
|
596
|
+
mask_img = mask_object
|
597
|
+
# Resample and warp mask if target data is native
|
598
|
+
if target_space == "native":
|
599
|
+
logger.debug(
|
600
|
+
"Warping mask to native space using "
|
601
|
+
f"{warper_spec['warper']}."
|
602
|
+
)
|
603
|
+
mask_name = f"{mask_name}_to_native"
|
604
|
+
# extra_input check done earlier and warper_spec exists
|
605
|
+
if warper_spec["warper"] == "fsl":
|
606
|
+
mask_img = FSLMaskWarper().warp(
|
607
|
+
mask_name=mask_name,
|
608
|
+
mask_img=mask_img,
|
609
|
+
target_data=target_data,
|
610
|
+
warp_data=warper_spec,
|
611
|
+
)
|
612
|
+
elif warper_spec["warper"] == "ants":
|
613
|
+
mask_img = ANTsMaskWarper().warp(
|
614
|
+
mask_name=mask_name,
|
615
|
+
mask_img=mask_img,
|
616
|
+
src="",
|
617
|
+
dst="native",
|
618
|
+
target_data=target_data,
|
619
|
+
warp_data=warper_spec,
|
620
|
+
)
|
497
621
|
|
498
622
|
all_masks.append(mask_img)
|
499
623
|
|
500
624
|
# Multiple masks, need intersection / union
|
501
625
|
if len(all_masks) > 1:
|
502
626
|
# Intersect / union of masks
|
627
|
+
logger.debug("Intersecting masks.")
|
503
628
|
mask_img = intersect_masks(all_masks, **intersect_params)
|
504
629
|
# Single mask
|
505
630
|
else:
|
506
|
-
if
|
631
|
+
if intersect_params:
|
507
632
|
# Yes, I'm this strict!
|
508
633
|
raise_error(
|
509
634
|
"Cannot pass parameters to the intersection function "
|
@@ -511,26 +636,6 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
511
636
|
)
|
512
637
|
mask_img = all_masks[0]
|
513
638
|
|
514
|
-
# Warp mask if target data is native
|
515
|
-
if target_space == "native":
|
516
|
-
# extra_input check done earlier and warper_spec exists
|
517
|
-
if warper_spec["warper"] == "fsl":
|
518
|
-
mask_img = FSLMaskWarper().warp(
|
519
|
-
mask_name="native",
|
520
|
-
mask_img=mask_img,
|
521
|
-
target_data=target_data,
|
522
|
-
warp_data=warper_spec,
|
523
|
-
)
|
524
|
-
elif warper_spec["warper"] == "ants":
|
525
|
-
mask_img = ANTsMaskWarper().warp(
|
526
|
-
mask_name="native",
|
527
|
-
mask_img=mask_img,
|
528
|
-
src="",
|
529
|
-
dst="native",
|
530
|
-
target_data=target_data,
|
531
|
-
warp_data=warper_spec,
|
532
|
-
)
|
533
|
-
|
534
639
|
return mask_img
|
535
640
|
|
536
641
|
|
@@ -64,7 +64,6 @@ def test_compute_brain_mask(mask_type: str, threshold: float) -> None:
|
|
64
64
|
element_data = DefaultDataReader().fit_transform(dg["sub-01"])
|
65
65
|
mask = compute_brain_mask(
|
66
66
|
target_data=element_data["BOLD"],
|
67
|
-
extra_input=None,
|
68
67
|
mask_type=mask_type,
|
69
68
|
)
|
70
69
|
assert isinstance(mask, nib.nifti1.Nifti1Image)
|
@@ -400,6 +400,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
400
400
|
"""
|
401
401
|
# Check pre-requirements for space manipulation
|
402
402
|
target_space = target_data["space"]
|
403
|
+
logger.debug(f"Getting {parcellations} in {target_space} space.")
|
403
404
|
# Extra data type requirement check if target space is native
|
404
405
|
if target_space == "native":
|
405
406
|
# Check for extra inputs
|
@@ -416,6 +417,9 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
416
417
|
)
|
417
418
|
# Set target standard space to warp file space source
|
418
419
|
target_std_space = warper_spec["src"]
|
420
|
+
logger.debug(
|
421
|
+
f"Target space is native. Will warp from {target_std_space}"
|
422
|
+
)
|
419
423
|
else:
|
420
424
|
# Set target standard space to target space
|
421
425
|
target_std_space = target_space
|
@@ -433,6 +437,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
433
437
|
all_labels = []
|
434
438
|
for name in parcellations:
|
435
439
|
# Load parcellation
|
440
|
+
logger.debug(f"Loading parcellation {name}")
|
436
441
|
img, labels, _, space = self.load(
|
437
442
|
name=name,
|
438
443
|
resolution=resolution,
|
@@ -441,6 +446,9 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
441
446
|
# Convert parcellation spaces if required;
|
442
447
|
# cannot be "native" due to earlier check
|
443
448
|
if space != target_std_space:
|
449
|
+
logger.debug(
|
450
|
+
f"Warping {name} to {target_std_space} space using ants."
|
451
|
+
)
|
444
452
|
raw_img = ANTsParcellationWarper().warp(
|
445
453
|
parcellation_name=name,
|
446
454
|
parcellation_img=img,
|
@@ -452,6 +460,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
452
460
|
# Remove extra dimension added by ANTs
|
453
461
|
img = image.math_img("np.squeeze(img)", img=raw_img)
|
454
462
|
|
463
|
+
logger.debug(f"Resampling {name} to target image.")
|
455
464
|
# Resample parcellation to target image
|
456
465
|
img_to_merge = image.resample_to_img(
|
457
466
|
source_img=img,
|
@@ -469,6 +478,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
469
478
|
labels = all_labels[0]
|
470
479
|
# Parcellations are already transformed to target standard space
|
471
480
|
else:
|
481
|
+
logger.debug("Merging parcellations.")
|
472
482
|
resampled_parcellation_img, labels = merge_parcellations(
|
473
483
|
parcellations_list=all_parcellations,
|
474
484
|
parcellations_names=parcellations,
|
@@ -477,6 +487,10 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
477
487
|
|
478
488
|
# Warp parcellation if target space is native
|
479
489
|
if target_space == "native":
|
490
|
+
logger.debug(
|
491
|
+
"Warping parcellation to native space using "
|
492
|
+
f"{warper_spec['warper']}."
|
493
|
+
)
|
480
494
|
# extra_input check done earlier and warper_spec exists
|
481
495
|
if warper_spec["warper"] == "fsl":
|
482
496
|
resampled_parcellation_img = FSLParcellationWarper().warp(
|
@@ -1194,7 +1208,10 @@ def _retrieve_aicha(
|
|
1194
1208
|
|
1195
1209
|
# Load labels
|
1196
1210
|
labels = pd.read_csv(
|
1197
|
-
parcellation_lname,
|
1211
|
+
parcellation_lname,
|
1212
|
+
sep="\t",
|
1213
|
+
header=None,
|
1214
|
+
skiprows=[0], # type: ignore
|
1198
1215
|
)[0].to_list()
|
1199
1216
|
|
1200
1217
|
return parcellation_fname, labels
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev349
|
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,6 +1,6 @@
|
|
1
1
|
junifer/__init__.py,sha256=2McgH1yNue6Z1V26-uN_mfMjbTcx4CLhym-DMBl5xA4,266
|
2
2
|
junifer/__init__.pyi,sha256=SsTvgq2Dod6UqJN96GH1lCphH6hJQQurEJHGNhHjGUI,508
|
3
|
-
junifer/_version.py,sha256=
|
3
|
+
junifer/_version.py,sha256=aHBrRVpok6-bqJl1ZQ6KAqY2zMxvhfYBv8BAfrUa6tE,428
|
4
4
|
junifer/conftest.py,sha256=PWYkkRDU8ly2lYwv7VBKMHje4et6HX7Yey3Md_I2KbA,613
|
5
5
|
junifer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
junifer/stats.py,sha256=e9aaagMGtgpRfW3Wdpz9ocpnYld1IWylCDcjFUgX9Mk,6225
|
@@ -104,10 +104,10 @@ junifer/data/coordinates/VOIs/meta/extDMN_VOIs.txt,sha256=Ogx1QvqZcnXDM3ncF2ha78
|
|
104
104
|
junifer/data/coordinates/tests/test_coordinates.py,sha256=_c2P4oaDGpsmui5gJBe_jN6HLGiKxONkYPR69sRBUlU,4219
|
105
105
|
junifer/data/masks/__init__.py,sha256=eEEhHglyVEx1LrqwXjq3cOmjf4sTsgBstRx5-k7zIQU,180
|
106
106
|
junifer/data/masks/__init__.pyi,sha256=lcgr8gmWDPibC4RxnWBXb8DDpIkO73Aax09u6VXiJJI,114
|
107
|
-
junifer/data/masks/_ants_mask_warper.py,sha256=
|
107
|
+
junifer/data/masks/_ants_mask_warper.py,sha256=Mwgc2_ZMf28vS_-fviRvZnHyT7JoQ1cQLozo7nUZSyM,5350
|
108
108
|
junifer/data/masks/_fsl_mask_warper.py,sha256=VApp-ofGBKePNmCdgTg1HoEA66lMQiAPT0ihkhB2ezY,2415
|
109
|
-
junifer/data/masks/_masks.py,sha256=
|
110
|
-
junifer/data/masks/tests/test_masks.py,sha256=
|
109
|
+
junifer/data/masks/_masks.py,sha256=8w-J-ZBKuik99gk9tYHntbmanpx_Mbu9oUujzxO7y1w,25874
|
110
|
+
junifer/data/masks/tests/test_masks.py,sha256=W0bzRB5Bp-iGO44VtEmaf7BuT-joe_2tQI0lma5NQHA,16090
|
111
111
|
junifer/data/masks/ukb/UKB_15K_GM_template.nii.gz,sha256=jcX1pDOrDsoph8cPMNFVKH5gZYio5G4rJNpOFXm9wJI,946636
|
112
112
|
junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean.nii.gz,sha256=j6EY8EtRnUuRxeKgD65Q6B0GPEPIALKDJEIje1TfnAU,88270
|
113
113
|
junifer/data/masks/vickery-patil/CAT12_IXI555_MNI152_TMP_GS_GMprob0.2_clean_3mm.nii.gz,sha256=crb_y7YO1vjjf2PwbRJUm8KamPK6fx1y0B_l-E3g8FY,12862
|
@@ -116,7 +116,7 @@ junifer/data/parcellations/__init__.py,sha256=6-Ysil3NyZ69V6rWx4RO15_d-iDKizfbHu
|
|
116
116
|
junifer/data/parcellations/__init__.pyi,sha256=lhBHTbMDizzqUqVHrx2eyfPFodrTBgMFeTgxfESSkQ8,140
|
117
117
|
junifer/data/parcellations/_ants_parcellation_warper.py,sha256=YUCJC0_wutGw7j_n9JRU3LCwm9Ttg5PIlJUgqejfRhs,5806
|
118
118
|
junifer/data/parcellations/_fsl_parcellation_warper.py,sha256=JfJ022flg5OR48P4OAALVHHQgTVxdMBXT-fAqBl3nUM,2679
|
119
|
-
junifer/data/parcellations/_parcellations.py,sha256=
|
119
|
+
junifer/data/parcellations/_parcellations.py,sha256=xXCyJ9b_TTHzzXXChPvk9qakkjabxTb5wJaRNEjRgWY,66271
|
120
120
|
junifer/data/parcellations/tests/test_parcellations.py,sha256=crluGgUjocVZ0ZIkMpUVol27A-Px6oc2eflY5g0C4BY,38315
|
121
121
|
junifer/data/tests/test_data_utils.py,sha256=136iGPjGecCxyqgUwU8VZMHoE6imcYJ0WNC32PDGK4g,1063
|
122
122
|
junifer/data/tests/test_template_spaces.py,sha256=ZEicEcLqOJ-NpuBZ5SYh4yZ0xZRkhYHnYXiC_YSxjrY,3219
|
@@ -341,10 +341,10 @@ junifer/utils/tests/test_config.py,sha256=7ltIXuwb_W4Mv_1dxQWyiyM10XgUAfsWKV6D_i
|
|
341
341
|
junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
|
342
342
|
junifer/utils/tests/test_helpers.py,sha256=k5qqfxK8dFyuewTJyR1Qn6-nFaYNuVr0ysc18bfPjyU,929
|
343
343
|
junifer/utils/tests/test_logging.py,sha256=duO4ou365hxwa_kwihFtKPLaL6LC5XHiyhOijrrngbA,8009
|
344
|
-
junifer-0.0.6.
|
345
|
-
junifer-0.0.6.
|
346
|
-
junifer-0.0.6.
|
347
|
-
junifer-0.0.6.
|
348
|
-
junifer-0.0.6.
|
349
|
-
junifer-0.0.6.
|
350
|
-
junifer-0.0.6.
|
344
|
+
junifer-0.0.6.dev349.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
|
345
|
+
junifer-0.0.6.dev349.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
|
346
|
+
junifer-0.0.6.dev349.dist-info/METADATA,sha256=rzDvV7h-fyKVUrFJWcNNyC6UFs-Y1fXs-7xT6loyXKs,8429
|
347
|
+
junifer-0.0.6.dev349.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
348
|
+
junifer-0.0.6.dev349.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
|
349
|
+
junifer-0.0.6.dev349.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
|
350
|
+
junifer-0.0.6.dev349.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|