junifer 0.0.6.dev344__py3-none-any.whl → 0.0.6.dev358__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/_masks.py +69 -20
- junifer/data/parcellations/_parcellations.py +55 -34
- junifer/data/parcellations/tests/test_parcellations.py +45 -19
- junifer/markers/reho/tests/test_reho_parcels.py +4 -0
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/METADATA +1 -1
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/RECORD +12 -12
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/WHEEL +0 -0
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev344.dist-info → junifer-0.0.6.dev358.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.dev358'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev358')
|
junifer/data/masks/_masks.py
CHANGED
@@ -47,6 +47,8 @@ def compute_brain_mask(
|
|
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
|
|
@@ -72,6 +74,13 @@ def compute_brain_mask(
|
|
72
74
|
(default "brain").
|
73
75
|
threshold : float, optional
|
74
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).
|
75
84
|
|
76
85
|
Returns
|
77
86
|
-------
|
@@ -82,7 +91,13 @@ def compute_brain_mask(
|
|
82
91
|
------
|
83
92
|
ValueError
|
84
93
|
If ``mask_type`` is invalid or
|
85
|
-
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.
|
86
101
|
|
87
102
|
"""
|
88
103
|
logger.debug(f"Computing {mask_type} mask")
|
@@ -90,6 +105,12 @@ def compute_brain_mask(
|
|
90
105
|
if mask_type not in ["brain", "gm", "wm"]:
|
91
106
|
raise_error(f"Unknown mask type: {mask_type}")
|
92
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
|
+
|
93
114
|
# Check pre-requirements for space manipulation
|
94
115
|
if target_data["space"] == "native":
|
95
116
|
# Warp data check
|
@@ -101,25 +122,50 @@ def compute_brain_mask(
|
|
101
122
|
# Set space to fetch template using
|
102
123
|
target_std_space = target_data["space"]
|
103
124
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
125
|
+
if source == "subject":
|
126
|
+
key = f"VBM_{mask_type.upper()}"
|
127
|
+
# Check for extra inputs
|
128
|
+
if extra_input is None:
|
129
|
+
raise_error(
|
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,
|
122
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,
|
168
|
+
)
|
123
169
|
# Resample template to target image
|
124
170
|
else:
|
125
171
|
resampled_template = resample_to_img(
|
@@ -503,7 +549,10 @@ class MaskRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
503
549
|
# custom compute_brain_mask
|
504
550
|
elif mask_name == "compute_brain_mask":
|
505
551
|
mask_img = mask_object(
|
506
|
-
target_data,
|
552
|
+
target_data=target_data,
|
553
|
+
warp_data=warper_spec,
|
554
|
+
extra_input=extra_input,
|
555
|
+
**mask_params,
|
507
556
|
)
|
508
557
|
# custom registered; arm kept for clarity
|
509
558
|
else:
|
@@ -269,6 +269,7 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
269
269
|
def load(
|
270
270
|
self,
|
271
271
|
name: str,
|
272
|
+
target_space: str,
|
272
273
|
parcellations_dir: Union[str, Path, None] = None,
|
273
274
|
resolution: Optional[float] = None,
|
274
275
|
path_only: bool = False,
|
@@ -282,6 +283,8 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
282
283
|
----------
|
283
284
|
name : str
|
284
285
|
The name of the parcellation.
|
286
|
+
target_space : str
|
287
|
+
The desired space of the parcellation.
|
285
288
|
parcellations_dir : str or pathlib.Path, optional
|
286
289
|
Path where the parcellations files are stored. The default location
|
287
290
|
is "$HOME/junifer/data/parcellations" (default None).
|
@@ -328,6 +331,14 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
328
331
|
else:
|
329
332
|
space = parcellation_definition["space"]
|
330
333
|
|
334
|
+
# Check and get highest resolution
|
335
|
+
if space != target_space:
|
336
|
+
logger.info(
|
337
|
+
f"Parcellation will be warped from {space} to {target_space} "
|
338
|
+
"using highest resolution"
|
339
|
+
)
|
340
|
+
resolution = None
|
341
|
+
|
331
342
|
# Check if the parcellation family is custom or built-in
|
332
343
|
if t_family == "CustomUserParcellation":
|
333
344
|
parcellation_fname = Path(parcellation_definition["path"])
|
@@ -441,13 +452,14 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
441
452
|
img, labels, _, space = self.load(
|
442
453
|
name=name,
|
443
454
|
resolution=resolution,
|
455
|
+
target_space=target_space,
|
444
456
|
)
|
445
457
|
|
446
458
|
# Convert parcellation spaces if required;
|
447
459
|
# cannot be "native" due to earlier check
|
448
460
|
if space != target_std_space:
|
449
461
|
logger.debug(
|
450
|
-
f"Warping {name} to {target_std_space} space using
|
462
|
+
f"Warping {name} to {target_std_space} space using ANTs."
|
451
463
|
)
|
452
464
|
raw_img = ANTsParcellationWarper().warp(
|
453
465
|
parcellation_name=name,
|
@@ -459,17 +471,50 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
459
471
|
)
|
460
472
|
# Remove extra dimension added by ANTs
|
461
473
|
img = image.math_img("np.squeeze(img)", img=raw_img)
|
474
|
+
# Set correct affine as resolution won't be correct
|
475
|
+
img = image.resample_img(
|
476
|
+
img=img,
|
477
|
+
target_affine=target_img.affine,
|
478
|
+
interpolation="nearest",
|
479
|
+
)
|
480
|
+
else:
|
481
|
+
if target_space != "native":
|
482
|
+
# No warping is going to happen, just resampling, because
|
483
|
+
# we are in the correct space
|
484
|
+
logger.debug(f"Resampling {name} to target image.")
|
485
|
+
# Resample parcellation to target image
|
486
|
+
img = image.resample_to_img(
|
487
|
+
source_img=img,
|
488
|
+
target_img=target_img,
|
489
|
+
interpolation="nearest",
|
490
|
+
copy=True,
|
491
|
+
)
|
462
492
|
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
493
|
+
# Warp parcellation if target space is native
|
494
|
+
if target_space == "native":
|
495
|
+
logger.debug(
|
496
|
+
"Warping parcellation to native space using "
|
497
|
+
f"{warper_spec['warper']}."
|
498
|
+
)
|
499
|
+
# extra_input check done earlier and warper_spec exists
|
500
|
+
if warper_spec["warper"] == "fsl":
|
501
|
+
img = FSLParcellationWarper().warp(
|
502
|
+
parcellation_name="native",
|
503
|
+
parcellation_img=img,
|
504
|
+
target_data=target_data,
|
505
|
+
warp_data=warper_spec,
|
506
|
+
)
|
507
|
+
elif warper_spec["warper"] == "ants":
|
508
|
+
img = ANTsParcellationWarper().warp(
|
509
|
+
parcellation_name="native",
|
510
|
+
parcellation_img=img,
|
511
|
+
src="",
|
512
|
+
dst="native",
|
513
|
+
target_data=target_data,
|
514
|
+
warp_data=warper_spec,
|
515
|
+
)
|
471
516
|
|
472
|
-
all_parcellations.append(
|
517
|
+
all_parcellations.append(img)
|
473
518
|
all_labels.append(labels)
|
474
519
|
|
475
520
|
# Avoid merging if there is only one parcellation
|
@@ -485,30 +530,6 @@ class ParcellationRegistry(BasePipelineDataRegistry, metaclass=Singleton):
|
|
485
530
|
labels_lists=all_labels,
|
486
531
|
)
|
487
532
|
|
488
|
-
# Warp parcellation if target space is native
|
489
|
-
if target_space == "native":
|
490
|
-
logger.debug(
|
491
|
-
"Warping parcellation to native space using "
|
492
|
-
f"{warper_spec['warper']}."
|
493
|
-
)
|
494
|
-
# extra_input check done earlier and warper_spec exists
|
495
|
-
if warper_spec["warper"] == "fsl":
|
496
|
-
resampled_parcellation_img = FSLParcellationWarper().warp(
|
497
|
-
parcellation_name="native",
|
498
|
-
parcellation_img=resampled_parcellation_img,
|
499
|
-
target_data=target_data,
|
500
|
-
warp_data=warper_spec,
|
501
|
-
)
|
502
|
-
elif warper_spec["warper"] == "ants":
|
503
|
-
resampled_parcellation_img = ANTsParcellationWarper().warp(
|
504
|
-
parcellation_name="native",
|
505
|
-
parcellation_img=resampled_parcellation_img,
|
506
|
-
src="",
|
507
|
-
dst="native",
|
508
|
-
target_data=target_data,
|
509
|
-
warp_data=warper_spec,
|
510
|
-
)
|
511
|
-
|
512
533
|
return resampled_parcellation_img, labels
|
513
534
|
|
514
535
|
|
@@ -60,7 +60,9 @@ def test_register_already_registered() -> None:
|
|
60
60
|
space="MNI152Lin",
|
61
61
|
)
|
62
62
|
assert (
|
63
|
-
ParcellationRegistry()
|
63
|
+
ParcellationRegistry()
|
64
|
+
.load("testparc", target_space="MNI152Lin", path_only=True)[2]
|
65
|
+
.name
|
64
66
|
== "testparc.nii.gz"
|
65
67
|
)
|
66
68
|
|
@@ -81,7 +83,9 @@ def test_register_already_registered() -> None:
|
|
81
83
|
)
|
82
84
|
|
83
85
|
assert (
|
84
|
-
ParcellationRegistry()
|
86
|
+
ParcellationRegistry()
|
87
|
+
.load("testparc", target_space="MNI152Lin", path_only=True)[2]
|
88
|
+
.name
|
85
89
|
== "testparc2.nii.gz"
|
86
90
|
)
|
87
91
|
|
@@ -96,7 +100,8 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
|
|
96
100
|
|
97
101
|
"""
|
98
102
|
schaefer, labels, schaefer_path, _ = ParcellationRegistry().load(
|
99
|
-
"Schaefer100x7"
|
103
|
+
"Schaefer100x7",
|
104
|
+
"MNI152NLin6Asym",
|
100
105
|
)
|
101
106
|
assert schaefer is not None
|
102
107
|
|
@@ -106,7 +111,7 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
|
|
106
111
|
)
|
107
112
|
|
108
113
|
with pytest.raises(ValueError, match=r"has 100 parcels but 10"):
|
109
|
-
ParcellationRegistry().load("WrongLabels")
|
114
|
+
ParcellationRegistry().load("WrongLabels", "MNI152NLin6Asym")
|
110
115
|
|
111
116
|
# Test wrong number of labels
|
112
117
|
ParcellationRegistry().register(
|
@@ -114,7 +119,7 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
|
|
114
119
|
)
|
115
120
|
|
116
121
|
with pytest.raises(ValueError, match=r"has 100 parcels but 101"):
|
117
|
-
ParcellationRegistry().load("WrongLabels2")
|
122
|
+
ParcellationRegistry().load("WrongLabels2", "MNI152NLin6Asym")
|
118
123
|
|
119
124
|
schaefer_data = schaefer.get_fdata().copy()
|
120
125
|
schaefer_data[schaefer_data == 50] = 0
|
@@ -126,7 +131,7 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
|
|
126
131
|
"WrongValues", new_schaefer_path, labels[:-1], "MNI152Lin"
|
127
132
|
)
|
128
133
|
with pytest.raises(ValueError, match=r"must have all the values in the"):
|
129
|
-
ParcellationRegistry().load("WrongValues")
|
134
|
+
ParcellationRegistry().load("WrongValues", "MNI152NLin6Asym")
|
130
135
|
|
131
136
|
schaefer_data = schaefer.get_fdata().copy()
|
132
137
|
schaefer_data[schaefer_data == 50] = 200
|
@@ -138,7 +143,7 @@ def test_parcellation_wrong_labels_values(tmp_path: Path) -> None:
|
|
138
143
|
"WrongValues2", new_schaefer_path, labels, "MNI152Lin"
|
139
144
|
)
|
140
145
|
with pytest.raises(ValueError, match=r"must have all the values in the"):
|
141
|
-
ParcellationRegistry().load("WrongValues2")
|
146
|
+
ParcellationRegistry().load("WrongValues2", "MNI152NLin6Asym")
|
142
147
|
|
143
148
|
|
144
149
|
@pytest.mark.parametrize(
|
@@ -202,7 +207,7 @@ def test_register(
|
|
202
207
|
assert name in ParcellationRegistry().list
|
203
208
|
# Load registered parcellation
|
204
209
|
_, lbl, fname, parcellation_space = ParcellationRegistry().load(
|
205
|
-
name=name, path_only=True
|
210
|
+
name=name, target_space=space, path_only=True
|
206
211
|
)
|
207
212
|
# Check values for registered parcellation
|
208
213
|
assert lbl == parcels_labels
|
@@ -239,7 +244,7 @@ def test_list_correct(parcellation_name: str) -> None:
|
|
239
244
|
def test_load_incorrect() -> None:
|
240
245
|
"""Test loading of invalid parcellations."""
|
241
246
|
with pytest.raises(ValueError, match=r"not found"):
|
242
|
-
ParcellationRegistry().load("wrongparcellation")
|
247
|
+
ParcellationRegistry().load("wrongparcellation", "MNI152NLin6Asym")
|
243
248
|
|
244
249
|
|
245
250
|
def test_retrieve_parcellation_incorrect() -> None:
|
@@ -323,6 +328,7 @@ def test_schaefer(
|
|
323
328
|
# Load parcellation
|
324
329
|
img, label, img_path, space = ParcellationRegistry().load(
|
325
330
|
name=parcellation_name,
|
331
|
+
target_space="MNI152NLin6Asym",
|
326
332
|
parcellations_dir=tmp_path,
|
327
333
|
resolution=resolution,
|
328
334
|
)
|
@@ -392,6 +398,7 @@ def test_suit(tmp_path: Path, space_key: str, space: str) -> None:
|
|
392
398
|
# Load parcellation
|
393
399
|
img, label, img_path, parcellation_space = ParcellationRegistry().load(
|
394
400
|
name=f"SUITx{space_key}",
|
401
|
+
target_space=space,
|
395
402
|
parcellations_dir=tmp_path,
|
396
403
|
)
|
397
404
|
assert img is not None
|
@@ -441,7 +448,9 @@ def test_tian_3T_6thgeneration(
|
|
441
448
|
assert "TianxS4x3TxMNI6thgeneration" in parcellations
|
442
449
|
# Load parcellation
|
443
450
|
img, lbl, fname, parcellation_space_1 = ParcellationRegistry().load(
|
444
|
-
name=f"TianxS{scale}x3TxMNI6thgeneration",
|
451
|
+
name=f"TianxS{scale}x3TxMNI6thgeneration",
|
452
|
+
parcellations_dir=tmp_path,
|
453
|
+
target_space="MNI152NLin2009cAsym",
|
445
454
|
)
|
446
455
|
fname1 = f"Tian_Subcortex_S{scale}_3T_1mm.nii.gz"
|
447
456
|
assert img is not None
|
@@ -452,6 +461,7 @@ def test_tian_3T_6thgeneration(
|
|
452
461
|
# Load parcellation
|
453
462
|
img, lbl, fname, parcellation_space_2 = ParcellationRegistry().load(
|
454
463
|
name=f"TianxS{scale}x3TxMNI6thgeneration",
|
464
|
+
target_space="MNI152NLin6Asym",
|
455
465
|
parcellations_dir=tmp_path,
|
456
466
|
resolution=2,
|
457
467
|
)
|
@@ -489,6 +499,7 @@ def test_tian_3T_nonlinear2009cAsym(
|
|
489
499
|
# Load parcellation
|
490
500
|
img, lbl, fname, space = ParcellationRegistry().load(
|
491
501
|
name=f"TianxS{scale}x3TxMNInonlinear2009cAsym",
|
502
|
+
target_space="MNI152NLin2009cAsym",
|
492
503
|
parcellations_dir=tmp_path,
|
493
504
|
)
|
494
505
|
fname1 = f"Tian_Subcortex_S{scale}_3T_2009cAsym.nii.gz"
|
@@ -524,7 +535,9 @@ def test_tian_7T_6thgeneration(
|
|
524
535
|
assert "TianxS4x7TxMNI6thgeneration" in parcellations
|
525
536
|
# Load parcellation
|
526
537
|
img, lbl, fname, space = ParcellationRegistry().load(
|
527
|
-
name=f"TianxS{scale}x7TxMNI6thgeneration",
|
538
|
+
name=f"TianxS{scale}x7TxMNI6thgeneration",
|
539
|
+
target_space="MNI152NLin6Asym",
|
540
|
+
parcellations_dir=tmp_path,
|
528
541
|
)
|
529
542
|
fname1 = f"Tian_Subcortex_S{scale}_7T.nii.gz"
|
530
543
|
assert img is not None
|
@@ -611,7 +624,9 @@ def test_aicha(tmp_path: Path, version: int) -> None:
|
|
611
624
|
assert f"AICHA_v{version}" in ParcellationRegistry().list
|
612
625
|
# Load parcellation
|
613
626
|
img, label, img_path, space = ParcellationRegistry().load(
|
614
|
-
name=f"AICHA_v{version}",
|
627
|
+
name=f"AICHA_v{version}",
|
628
|
+
target_space="IXI549Space",
|
629
|
+
parcellations_dir=tmp_path,
|
615
630
|
)
|
616
631
|
assert img is not None
|
617
632
|
assert img_path.name == "AICHA.nii"
|
@@ -680,6 +695,7 @@ def test_shen(
|
|
680
695
|
# Load parcellation
|
681
696
|
img, label, img_path, space = ParcellationRegistry().load(
|
682
697
|
name=f"Shen_{year}_{n_rois}",
|
698
|
+
target_space="MNI152NLin2009cAsym",
|
683
699
|
parcellations_dir=tmp_path,
|
684
700
|
resolution=resolution,
|
685
701
|
)
|
@@ -875,7 +891,8 @@ def test_yan(
|
|
875
891
|
)
|
876
892
|
# Load parcellation
|
877
893
|
img, label, img_path, space = ParcellationRegistry().load(
|
878
|
-
name=parcellation_name,
|
894
|
+
name=parcellation_name,
|
895
|
+
target_space="MNI152NLin6Asym",
|
879
896
|
parcellations_dir=tmp_path,
|
880
897
|
resolution=resolution,
|
881
898
|
)
|
@@ -1012,6 +1029,7 @@ def test_brainnetome(
|
|
1012
1029
|
# Load parcellation
|
1013
1030
|
img, label, img_path, space = ParcellationRegistry().load(
|
1014
1031
|
name=parcellation_name,
|
1032
|
+
target_space="MNI152NLin6Asym",
|
1015
1033
|
parcellations_dir=tmp_path,
|
1016
1034
|
resolution=resolution,
|
1017
1035
|
)
|
@@ -1044,10 +1062,11 @@ def test_merge_parcellations() -> None:
|
|
1044
1062
|
"""Test merging parcellations."""
|
1045
1063
|
# load some parcellations for testing
|
1046
1064
|
schaefer_parcellation, schaefer_labels, _, _ = ParcellationRegistry().load(
|
1047
|
-
"Schaefer100x17"
|
1065
|
+
"Schaefer100x17", target_space="MNI152NLin2009cAsym"
|
1048
1066
|
)
|
1049
1067
|
tian_parcellation, tian_labels, _, _ = ParcellationRegistry().load(
|
1050
|
-
"TianxS2x3TxMNInonlinear2009cAsym"
|
1068
|
+
"TianxS2x3TxMNInonlinear2009cAsym",
|
1069
|
+
target_space="MNI152NLin2009cAsym",
|
1051
1070
|
)
|
1052
1071
|
# prepare the list of the actual parcellations
|
1053
1072
|
parcellation_list = [schaefer_parcellation, tian_parcellation]
|
@@ -1079,7 +1098,9 @@ def test_merge_parcellations_3D_multiple_non_overlapping(
|
|
1079
1098
|
|
1080
1099
|
"""
|
1081
1100
|
# Get the testing parcellation
|
1082
|
-
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1101
|
+
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1102
|
+
"Schaefer100x7", target_space="MNI152NLin2009cAsym"
|
1103
|
+
)
|
1083
1104
|
|
1084
1105
|
assert parcellation is not None
|
1085
1106
|
|
@@ -1114,7 +1135,9 @@ def test_merge_parcellations_3D_multiple_overlapping() -> None:
|
|
1114
1135
|
"""Test merge_parcellations with multiple overlapping parcellations."""
|
1115
1136
|
|
1116
1137
|
# Get the testing parcellation
|
1117
|
-
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1138
|
+
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1139
|
+
"Schaefer100x7", target_space="MNI152NLin2009cAsym"
|
1140
|
+
)
|
1118
1141
|
|
1119
1142
|
assert parcellation is not None
|
1120
1143
|
|
@@ -1149,7 +1172,9 @@ def test_merge_parcellations_3D_multiple_duplicated_labels() -> None:
|
|
1149
1172
|
"""Test merge_parcellations with duplicated labels."""
|
1150
1173
|
|
1151
1174
|
# Get the testing parcellation
|
1152
|
-
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1175
|
+
parcellation, labels, _, _ = ParcellationRegistry().load(
|
1176
|
+
"Schaefer100x7", target_space="MNI152NLin2009cAsym"
|
1177
|
+
)
|
1153
1178
|
|
1154
1179
|
assert parcellation is not None
|
1155
1180
|
|
@@ -1198,6 +1223,7 @@ def test_get_single() -> None:
|
|
1198
1223
|
# Get raw parcellation
|
1199
1224
|
raw_parcellation, raw_labels, _, _ = ParcellationRegistry().load(
|
1200
1225
|
"TianxS1x3TxMNInonlinear2009cAsym",
|
1226
|
+
target_space="MNI152NLin2009cAsym",
|
1201
1227
|
resolution=1.5,
|
1202
1228
|
)
|
1203
1229
|
resampled_raw_parcellation = resample_to_img(
|
@@ -1240,7 +1266,7 @@ def test_get_multi_same_space() -> None:
|
|
1240
1266
|
]
|
1241
1267
|
for name in parcellations_names:
|
1242
1268
|
img, labels, _, _ = ParcellationRegistry().load(
|
1243
|
-
name=name, resolution=1.5
|
1269
|
+
name=name, target_space="MNI152NLin2009cAsym", resolution=1.5
|
1244
1270
|
)
|
1245
1271
|
# Resample raw parcellations
|
1246
1272
|
resampled_img = resample_to_img(
|
@@ -86,6 +86,10 @@ def test_ReHoParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
|
|
86
86
|
@pytest.mark.skipif(
|
87
87
|
_check_afni() is False, reason="requires AFNI to be in PATH"
|
88
88
|
)
|
89
|
+
@pytest.mark.xfail(
|
90
|
+
reason="junifer ReHo needs to use the correct mask",
|
91
|
+
raises=AssertionError,
|
92
|
+
)
|
89
93
|
def test_ReHoParcels_comparison(tmp_path: Path) -> None:
|
90
94
|
"""Test ReHoParcels implementation comparison.
|
91
95
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev358
|
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=FgjmOt5uZU0g8aIkualgel30oxeUJfjpBfbQcVNHwH8,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
|
@@ -106,7 +106,7 @@ junifer/data/masks/__init__.py,sha256=eEEhHglyVEx1LrqwXjq3cOmjf4sTsgBstRx5-k7zIQ
|
|
106
106
|
junifer/data/masks/__init__.pyi,sha256=lcgr8gmWDPibC4RxnWBXb8DDpIkO73Aax09u6VXiJJI,114
|
107
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=
|
109
|
+
junifer/data/masks/_masks.py,sha256=8w-J-ZBKuik99gk9tYHntbmanpx_Mbu9oUujzxO7y1w,25874
|
110
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
|
@@ -116,8 +116,8 @@ 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=
|
120
|
-
junifer/data/parcellations/tests/test_parcellations.py,sha256=
|
119
|
+
junifer/data/parcellations/_parcellations.py,sha256=9azcYRBjwGuwZvKdFJj34BWPcCblxe2Ps8obbyl58k8,67179
|
120
|
+
junifer/data/parcellations/tests/test_parcellations.py,sha256=ESQI-KWsepmgKB2BWWWUxjkpjOWeIZhhlKxNuTsRPJg,39268
|
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
|
123
123
|
junifer/datagrabber/__init__.py,sha256=EHIK-lbjuvkt0V8ypFvLSt85OAAXSkaxBmVlCbNNz8M,323
|
@@ -239,7 +239,7 @@ junifer/markers/reho/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
239
239
|
junifer/markers/reho/reho_base.py,sha256=Q88TbhIM4rQWdeQPLwwxwZ9DrR8l09orD1rdTkSYDtc,4077
|
240
240
|
junifer/markers/reho/reho_parcels.py,sha256=UE1ia3uqbmTcZMc_FI625xVPLxBYvwpfrcvhekopbkI,6392
|
241
241
|
junifer/markers/reho/reho_spheres.py,sha256=FCC2qncC85Kd82hg-MOu4T7NAKEkXHUaCcwC9taau9Y,6996
|
242
|
-
junifer/markers/reho/tests/test_reho_parcels.py,sha256=
|
242
|
+
junifer/markers/reho/tests/test_reho_parcels.py,sha256=dek2TMxMZ04o5s_06ZudZihDer55dAIFUhFexWQAH18,4181
|
243
243
|
junifer/markers/reho/tests/test_reho_spheres.py,sha256=VyyQ3hhD6ArFc1BmigmAdePACB1EMQlo1mDr2QKvT2I,3989
|
244
244
|
junifer/markers/temporal_snr/__init__.py,sha256=86hNMyaSfWlWOXZ6m9reSDtMIgUaByOXjcxCvo7LmDw,235
|
245
245
|
junifer/markers/temporal_snr/__init__.pyi,sha256=20FhG9ZkAHQfmJ0r5p6fRMxhK8xrFQeFr0cgTrqu3ik,162
|
@@ -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.dev358.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
|
345
|
+
junifer-0.0.6.dev358.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
|
346
|
+
junifer-0.0.6.dev358.dist-info/METADATA,sha256=aw963eFey-7fsO__-qenMulbVlYGZ6vnMJl7sDRhjDY,8429
|
347
|
+
junifer-0.0.6.dev358.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
348
|
+
junifer-0.0.6.dev358.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
|
349
|
+
junifer-0.0.6.dev358.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
|
350
|
+
junifer-0.0.6.dev358.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|