junifer 0.0.5.dev62__py3-none-any.whl → 0.0.5.dev86__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/api/cli.py +26 -0
- junifer/api/functions.py +1 -1
- junifer/api/res/freesurfer/mri_binarize +3 -0
- junifer/api/res/freesurfer/mri_mc +3 -0
- junifer/api/res/freesurfer/mri_pretess +3 -0
- junifer/api/res/freesurfer/mris_convert +3 -0
- junifer/api/res/freesurfer/run_freesurfer_docker.sh +61 -0
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +1 -3
- junifer/configs/juseless/datagrabbers/ucla.py +9 -9
- junifer/data/masks.py +10 -22
- junifer/data/parcellations.py +1 -1
- junifer/data/tests/test_masks.py +8 -28
- junifer/datagrabber/aomic/id1000.py +34 -38
- junifer/datagrabber/aomic/piop1.py +33 -37
- junifer/datagrabber/aomic/piop2.py +35 -39
- junifer/datagrabber/aomic/tests/test_id1000.py +10 -11
- junifer/datagrabber/aomic/tests/test_piop1.py +10 -11
- junifer/datagrabber/aomic/tests/test_piop2.py +10 -11
- junifer/datagrabber/datalad_base.py +10 -1
- junifer/datagrabber/dmcc13_benchmark.py +36 -54
- junifer/datagrabber/pattern.py +116 -46
- junifer/datagrabber/pattern_datalad.py +22 -12
- junifer/datagrabber/tests/test_datagrabber_utils.py +15 -9
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +46 -19
- junifer/datagrabber/utils.py +127 -54
- junifer/datareader/default.py +91 -42
- junifer/pipeline/utils.py +64 -1
- junifer/preprocess/base.py +2 -2
- junifer/preprocess/confounds/fmriprep_confound_remover.py +44 -60
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +72 -113
- junifer/testing/datagrabbers.py +5 -5
- junifer/testing/tests/test_partlycloudytesting_datagrabber.py +7 -7
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/METADATA +1 -1
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/RECORD +40 -35
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/WHEEL +0 -0
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.5.dev62.dist-info → junifer-0.0.5.dev86.dist-info}/top_level.txt +0 -0
@@ -203,9 +203,7 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
203
203
|
"include it in the future",
|
204
204
|
klass=ValueError,
|
205
205
|
)
|
206
|
-
super().__init__(
|
207
|
-
on="BOLD", required_data_types=["BOLD", "BOLD_confounds"]
|
208
|
-
)
|
206
|
+
super().__init__(on="BOLD", required_data_types=["BOLD"])
|
209
207
|
|
210
208
|
def get_valid_inputs(self) -> List[str]:
|
211
209
|
"""Get valid data types for input.
|
@@ -361,7 +359,7 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
361
359
|
Parameters
|
362
360
|
----------
|
363
361
|
input : dict
|
364
|
-
Dictionary containing the ``
|
362
|
+
Dictionary containing the ``BOLD.confounds`` value from the
|
365
363
|
Junifer Data object.
|
366
364
|
|
367
365
|
Returns
|
@@ -370,7 +368,6 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
370
368
|
Dataframe containing the relevant confounds.
|
371
369
|
|
372
370
|
"""
|
373
|
-
|
374
371
|
confounds_format = input["format"]
|
375
372
|
if confounds_format == "adhoc":
|
376
373
|
self._map_adhoc_to_fmriprep(input)
|
@@ -416,50 +413,42 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
416
413
|
def _validate_data(
|
417
414
|
self,
|
418
415
|
input: Dict[str, Any],
|
419
|
-
extra_input: Optional[Dict[str, Any]] = None,
|
420
416
|
) -> None:
|
421
417
|
"""Validate input data.
|
422
418
|
|
423
419
|
Parameters
|
424
420
|
----------
|
425
421
|
input : dict
|
426
|
-
Dictionary containing the ``BOLD``
|
422
|
+
Dictionary containing the ``BOLD`` data from the
|
427
423
|
Junifer Data object.
|
428
|
-
extra_input : dict, optional
|
429
|
-
Dictionary containing the rest of the Junifer Data object. Must
|
430
|
-
include the ``BOLD_confounds`` key.
|
431
424
|
|
432
425
|
Raises
|
433
426
|
------
|
434
427
|
ValueError
|
435
|
-
If ``
|
436
|
-
if ``"
|
437
|
-
if ``"data"``
|
438
|
-
if ``"data"`` is not pandas.DataFrame or
|
428
|
+
If ``"confounds"`` is not found in ``input`` or
|
429
|
+
if ``"data"`` key is not found in ``"input.confounds"`` or
|
430
|
+
if ``"input.confounds.data"`` is not pandas.DataFrame or
|
439
431
|
if image time series and confounds have different lengths or
|
440
|
-
if ``
|
441
|
-
|
442
|
-
|
443
|
-
not found or
|
432
|
+
if ``format = "adhoc"`` and ``"mappings"`` key is not found or
|
433
|
+
``"fmriprep"`` key is not found in ``"mappings"`` or
|
434
|
+
``"fmriprep"`` has incorrect fMRIPrep mappings or required
|
435
|
+
fMRIPrep mappings are not found or
|
436
|
+
if invalid confounds format is found.
|
444
437
|
|
445
438
|
"""
|
446
439
|
# BOLD must be 4D niimg
|
447
440
|
check_niimg_4d(input["data"])
|
448
|
-
# Check for
|
449
|
-
if
|
450
|
-
raise_error(
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
if
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
if not isinstance(extra_input["BOLD_confounds"]["data"], pd.DataFrame):
|
460
|
-
raise_error("`BOLD_confounds.data` must be a `pandas.DataFrame`")
|
461
|
-
|
462
|
-
confound_df = extra_input["BOLD_confounds"]["data"]
|
441
|
+
# Check for confound data
|
442
|
+
if "confounds" not in input:
|
443
|
+
raise_error("`BOLD.confounds` data type not provided")
|
444
|
+
if "data" not in input["confounds"]:
|
445
|
+
raise_error("`BOLD.confounds.data` not provided")
|
446
|
+
# Confounds must be a pandas.DataFrame;
|
447
|
+
# if extension is unknown, will not be read, which will give None
|
448
|
+
if not isinstance(input["confounds"]["data"], pd.DataFrame):
|
449
|
+
raise_error("`BOLD.confounds.data` must be a `pandas.DataFrame`")
|
450
|
+
|
451
|
+
confound_df = input["confounds"]["data"]
|
463
452
|
bold_img = input["data"]
|
464
453
|
if bold_img.get_fdata().shape[3] != len(confound_df):
|
465
454
|
raise_error(
|
@@ -469,23 +458,19 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
469
458
|
)
|
470
459
|
|
471
460
|
# Check format
|
472
|
-
|
473
|
-
raise_error("`BOLD_confounds.format` not provided")
|
474
|
-
t_format = extra_input["BOLD_confounds"]["format"]
|
461
|
+
t_format = input["confounds"]["format"]
|
475
462
|
if t_format == "adhoc":
|
476
|
-
if "mappings" not in
|
463
|
+
if "mappings" not in input["confounds"]:
|
477
464
|
raise_error(
|
478
|
-
"`
|
479
|
-
"`
|
465
|
+
"`BOLD.confounds.mappings` need to be set when "
|
466
|
+
"`BOLD.confounds.format == 'adhoc'`"
|
480
467
|
)
|
481
|
-
if "fmriprep" not in
|
468
|
+
if "fmriprep" not in input["confounds"]["mappings"]:
|
482
469
|
raise_error(
|
483
|
-
"`
|
484
|
-
"`
|
470
|
+
"`BOLD.confounds.mappings.fmriprep` need to be set when "
|
471
|
+
"`BOLD.confounds.format == 'adhoc'`"
|
485
472
|
)
|
486
|
-
fmriprep_mappings =
|
487
|
-
"fmriprep"
|
488
|
-
]
|
473
|
+
fmriprep_mappings = input["confounds"]["mappings"]["fmriprep"]
|
489
474
|
wrong_names = [
|
490
475
|
x
|
491
476
|
for x in fmriprep_mappings.values()
|
@@ -525,22 +510,22 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
525
510
|
input : dict
|
526
511
|
A single input from the Junifer Data object to preprocess.
|
527
512
|
extra_input : dict, optional
|
528
|
-
The other fields in the Junifer Data object.
|
529
|
-
``BOLD_confounds`` key.
|
513
|
+
The other fields in the Junifer Data object.
|
530
514
|
|
531
515
|
Returns
|
532
516
|
-------
|
533
517
|
dict
|
534
|
-
The computed result as dictionary.
|
535
|
-
|
536
|
-
|
537
|
-
|
518
|
+
The computed result as dictionary. If `self.masks` is not None,
|
519
|
+
then the target data computed mask is updated for further steps.
|
520
|
+
None
|
521
|
+
Extra "helper" data types as dictionary to add to the Junifer Data
|
522
|
+
object.
|
538
523
|
|
539
524
|
"""
|
540
525
|
# Validate data
|
541
|
-
self._validate_data(input
|
526
|
+
self._validate_data(input)
|
542
527
|
# Pick confounds
|
543
|
-
confounds_df = self._pick_confounds(
|
528
|
+
confounds_df = self._pick_confounds(input["confounds"]) # type: ignore
|
544
529
|
# Get BOLD data
|
545
530
|
bold_img = input["data"]
|
546
531
|
# Set t_r
|
@@ -553,7 +538,6 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
553
538
|
)
|
554
539
|
# Set mask data
|
555
540
|
mask_img = None
|
556
|
-
bold_mask_dict = None
|
557
541
|
if self.masks is not None:
|
558
542
|
logger.debug(f"Masking with {self.masks}")
|
559
543
|
mask_img = get_mask(
|
@@ -561,15 +545,15 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
561
545
|
)
|
562
546
|
# Return the BOLD mask and link it to the BOLD data type dict;
|
563
547
|
# this allows to use "inherit" down the pipeline
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
"BOLD_mask": {
|
548
|
+
logger.debug("Setting `BOLD.mask`")
|
549
|
+
input.update(
|
550
|
+
{
|
551
|
+
"mask": {
|
569
552
|
"data": mask_img,
|
570
553
|
"space": input["space"],
|
571
554
|
}
|
572
555
|
}
|
556
|
+
)
|
573
557
|
# Clean image
|
574
558
|
logger.info("Cleaning image using nilearn")
|
575
559
|
logger.debug(f"\tdetrend: {self.detrend}")
|
@@ -587,4 +571,4 @@ class fMRIPrepConfoundRemover(BasePreprocessor):
|
|
587
571
|
mask_img=mask_img,
|
588
572
|
)
|
589
573
|
|
590
|
-
return input,
|
574
|
+
return input, None
|
@@ -20,6 +20,7 @@ from junifer.testing import get_testing_data
|
|
20
20
|
from junifer.testing.datagrabbers import (
|
21
21
|
OasisVBMTestingDataGrabber,
|
22
22
|
PartlyCloudyTestingDataGrabber,
|
23
|
+
SPMAuditoryTestingDataGrabber,
|
23
24
|
)
|
24
25
|
|
25
26
|
|
@@ -42,35 +43,10 @@ def test_fMRIPrepConfoundRemover_init() -> None:
|
|
42
43
|
@pytest.mark.parametrize(
|
43
44
|
"input_",
|
44
45
|
[
|
45
|
-
["T1w"],
|
46
46
|
["BOLD"],
|
47
47
|
["T1w", "BOLD"],
|
48
48
|
],
|
49
49
|
)
|
50
|
-
def test_fMRIPrepConfoundRemover_validate_input_errors(
|
51
|
-
input_: List[str],
|
52
|
-
) -> None:
|
53
|
-
"""Test errors for fMRIPrepConfoundRemover validate_input.
|
54
|
-
|
55
|
-
Parameters
|
56
|
-
----------
|
57
|
-
input_ : list of str
|
58
|
-
The input data types.
|
59
|
-
|
60
|
-
"""
|
61
|
-
confound_remover = fMRIPrepConfoundRemover()
|
62
|
-
|
63
|
-
with pytest.raises(ValueError, match="not have the required data"):
|
64
|
-
confound_remover.validate_input(input_)
|
65
|
-
|
66
|
-
|
67
|
-
@pytest.mark.parametrize(
|
68
|
-
"input_",
|
69
|
-
[
|
70
|
-
["BOLD", "BOLD_confounds"],
|
71
|
-
["T1w", "BOLD", "BOLD_confounds"],
|
72
|
-
],
|
73
|
-
)
|
74
50
|
def test_fMRIPrepConfoundRemover_validate_input(input_: List[str]) -> None:
|
75
51
|
"""Test fMRIPrepConfoundRemover validate_input.
|
76
52
|
|
@@ -302,13 +278,13 @@ def test_fMRIPRepConfoundRemover__pick_confounds_fmriprep() -> None:
|
|
302
278
|
with PartlyCloudyTestingDataGrabber() as dg:
|
303
279
|
input = dg["sub-01"]
|
304
280
|
input = reader.fit_transform(input)
|
305
|
-
out1 = confound_remover._pick_confounds(input["
|
281
|
+
out1 = confound_remover._pick_confounds(input["BOLD"]["confounds"])
|
306
282
|
assert set(out1.columns) == {*fmriprep_all_vars, "spike"}
|
307
283
|
|
308
284
|
with PartlyCloudyTestingDataGrabber(reduce_confounds=False) as dg:
|
309
285
|
input = dg["sub-01"]
|
310
286
|
input = reader.fit_transform(input)
|
311
|
-
out2 = confound_remover._pick_confounds(input["
|
287
|
+
out2 = confound_remover._pick_confounds(input["BOLD"]["confounds"])
|
312
288
|
assert set(out2.columns) == {*fmriprep_all_vars, "spike"}
|
313
289
|
|
314
290
|
assert_frame_equal(out1, out2)
|
@@ -348,123 +324,106 @@ def test_fMRIPRepConfoundRemover__pick_confounds_fmriprep_compute() -> None:
|
|
348
324
|
def test_fMRIPrepConfoundRemover__validate_data() -> None:
|
349
325
|
"""Test fMRIPrepConfoundRemover validate data."""
|
350
326
|
confound_remover = fMRIPrepConfoundRemover(strategy={"wm_csf": "full"})
|
351
|
-
|
327
|
+
# Check correct data type
|
352
328
|
with OasisVBMTestingDataGrabber() as dg:
|
353
329
|
element_data = DefaultDataReader().fit_transform(dg["sub-01"])
|
354
330
|
vbm = element_data["VBM_GM"]
|
355
331
|
with pytest.raises(
|
356
332
|
DimensionError, match="incompatible dimensionality"
|
357
333
|
):
|
358
|
-
confound_remover._validate_data(vbm
|
359
|
-
|
360
|
-
with
|
334
|
+
confound_remover._validate_data(vbm)
|
335
|
+
# Check missing nested type in correct data type
|
336
|
+
with SPMAuditoryTestingDataGrabber() as dg:
|
361
337
|
element_data = DefaultDataReader().fit_transform(dg["sub-01"])
|
362
338
|
bold = element_data["BOLD"]
|
363
|
-
|
364
|
-
with pytest.raises(ValueError, match="No extra input"):
|
365
|
-
confound_remover._validate_data(bold, None)
|
339
|
+
# Test confound type
|
366
340
|
with pytest.raises(
|
367
|
-
ValueError, match="`
|
341
|
+
ValueError, match="`BOLD.confounds` data type not provided"
|
368
342
|
):
|
369
|
-
confound_remover._validate_data(bold
|
343
|
+
confound_remover._validate_data(bold)
|
344
|
+
# Test confound data
|
345
|
+
bold["confounds"] = {}
|
370
346
|
with pytest.raises(
|
371
|
-
ValueError, match="`
|
347
|
+
ValueError, match="`BOLD.confounds.data` not provided"
|
372
348
|
):
|
373
|
-
confound_remover._validate_data(bold
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
confound_remover._validate_data(bold, extra_input)
|
381
|
-
|
382
|
-
extra_input = {"BOLD_confounds": {"data": pd.DataFrame()}}
|
349
|
+
confound_remover._validate_data(bold)
|
350
|
+
# Test confound data is valid type
|
351
|
+
bold["confounds"] = {"data": None}
|
352
|
+
with pytest.raises(ValueError, match="must be a `pandas.DataFrame`"):
|
353
|
+
confound_remover._validate_data(bold)
|
354
|
+
# Test confound data dimension mismatch with BOLD
|
355
|
+
bold["confounds"] = {"data": pd.DataFrame()}
|
383
356
|
with pytest.raises(ValueError, match="Image time series and"):
|
384
|
-
confound_remover._validate_data(bold
|
385
|
-
|
386
|
-
|
387
|
-
|
357
|
+
confound_remover._validate_data(bold)
|
358
|
+
# Check nested type variations
|
359
|
+
with PartlyCloudyTestingDataGrabber(reduce_confounds=False) as dg:
|
360
|
+
element_data = DefaultDataReader().fit_transform(dg["sub-01"])
|
361
|
+
# Test format
|
362
|
+
modified_bold = {
|
363
|
+
"data": element_data["BOLD"]["data"],
|
364
|
+
"confounds": {
|
365
|
+
"data": element_data["BOLD"]["confounds"]["data"],
|
366
|
+
"format": "adhoc",
|
367
|
+
},
|
388
368
|
}
|
369
|
+
# Test incorrect format
|
370
|
+
modified_bold["confounds"].update({"format": "wrong"})
|
371
|
+
with pytest.raises(ValueError, match="Invalid confounds format"):
|
372
|
+
confound_remover._validate_data(modified_bold)
|
373
|
+
# Test missing mappings for adhoc
|
374
|
+
modified_bold["confounds"].update({"format": "adhoc"})
|
389
375
|
with pytest.raises(
|
390
|
-
ValueError, match="`
|
376
|
+
ValueError, match="`BOLD.confounds.mappings` need to be set"
|
391
377
|
):
|
392
|
-
confound_remover._validate_data(
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
extra_input = {
|
404
|
-
"BOLD_confounds": {
|
405
|
-
"data": element_data["BOLD_confounds"]["data"],
|
406
|
-
"format": "adhoc",
|
407
|
-
}
|
408
|
-
}
|
409
|
-
with pytest.raises(ValueError, match="need to be set"):
|
410
|
-
confound_remover._validate_data(bold, extra_input)
|
411
|
-
|
412
|
-
extra_input = {
|
413
|
-
"BOLD_confounds": {
|
414
|
-
"data": element_data["BOLD_confounds"]["data"],
|
415
|
-
"format": "adhoc",
|
416
|
-
"mappings": {},
|
417
|
-
}
|
418
|
-
}
|
419
|
-
with pytest.raises(ValueError, match="need to be set"):
|
420
|
-
confound_remover._validate_data(bold, extra_input)
|
421
|
-
|
422
|
-
extra_input = {
|
423
|
-
"BOLD_confounds": {
|
424
|
-
"data": element_data["BOLD_confounds"]["data"],
|
425
|
-
"format": "adhoc",
|
378
|
+
confound_remover._validate_data(modified_bold)
|
379
|
+
# Test missing fmriprep mappings for adhoc
|
380
|
+
modified_bold["confounds"].update({"mappings": {}})
|
381
|
+
with pytest.raises(
|
382
|
+
ValueError,
|
383
|
+
match="`BOLD.confounds.mappings.fmriprep` need to be set",
|
384
|
+
):
|
385
|
+
confound_remover._validate_data(modified_bold)
|
386
|
+
# Test incorrect fmriprep mappings for adhoc
|
387
|
+
modified_bold["confounds"].update(
|
388
|
+
{
|
426
389
|
"mappings": {
|
427
390
|
"fmriprep": {
|
428
391
|
"rot_x": "wrong",
|
429
392
|
"rot_y": "rot_z",
|
430
393
|
"rot_z": "rot_y",
|
431
|
-
}
|
432
|
-
}
|
394
|
+
},
|
395
|
+
}
|
433
396
|
}
|
434
|
-
|
397
|
+
)
|
435
398
|
with pytest.raises(ValueError, match=r"names: \['wrong'\]"):
|
436
|
-
confound_remover._validate_data(
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
"data": element_data["BOLD_confounds"]["data"],
|
441
|
-
"format": "adhoc",
|
399
|
+
confound_remover._validate_data(modified_bold)
|
400
|
+
# Test missing fmriprep mappings for adhoc
|
401
|
+
modified_bold["confounds"].update(
|
402
|
+
{
|
442
403
|
"mappings": {
|
443
404
|
"fmriprep": {
|
444
405
|
"wrong": "rot_x",
|
445
406
|
"rot_y": "rot_z",
|
446
407
|
"rot_z": "rot_y",
|
447
|
-
}
|
448
|
-
}
|
408
|
+
},
|
409
|
+
}
|
449
410
|
}
|
450
|
-
|
411
|
+
)
|
451
412
|
with pytest.raises(ValueError, match=r"Missing columns: \['wrong'\]"):
|
452
|
-
confound_remover._validate_data(
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
"data": element_data["BOLD_confounds"]["data"],
|
457
|
-
"format": "adhoc",
|
413
|
+
confound_remover._validate_data(modified_bold)
|
414
|
+
# Test correct adhoc format
|
415
|
+
modified_bold["confounds"].update(
|
416
|
+
{
|
458
417
|
"mappings": {
|
459
418
|
"fmriprep": {
|
460
419
|
"rot_x": "rot_x",
|
461
420
|
"rot_y": "rot_z",
|
462
421
|
"rot_z": "rot_y",
|
463
|
-
}
|
464
|
-
}
|
422
|
+
},
|
423
|
+
}
|
465
424
|
}
|
466
|
-
|
467
|
-
confound_remover._validate_data(
|
425
|
+
)
|
426
|
+
confound_remover._validate_data(modified_bold)
|
468
427
|
|
469
428
|
|
470
429
|
def test_fMRIPrepConfoundRemover_preprocess() -> None:
|
@@ -476,7 +435,9 @@ def test_fMRIPrepConfoundRemover_preprocess() -> None:
|
|
476
435
|
element_data = DefaultDataReader().fit_transform(dg["sub-01"])
|
477
436
|
orig_bold = element_data["BOLD"]["data"].get_fdata().copy()
|
478
437
|
pre_input = element_data["BOLD"]
|
479
|
-
pre_extra_input = {
|
438
|
+
pre_extra_input = {
|
439
|
+
"BOLD": {"confounds": element_data["BOLD"]["confounds"]}
|
440
|
+
}
|
480
441
|
output, _ = confound_remover.preprocess(pre_input, pre_extra_input)
|
481
442
|
trans_bold = output["data"].get_fdata()
|
482
443
|
# Transformation is in place
|
@@ -530,7 +491,7 @@ def test_fMRIPrepConfoundRemover_fit_transform() -> None:
|
|
530
491
|
assert t_meta["t_r"] is None
|
531
492
|
assert t_meta["masks"] is None
|
532
493
|
|
533
|
-
assert "
|
494
|
+
assert "mask" not in output["BOLD"]
|
534
495
|
|
535
496
|
assert "dependencies" in output["BOLD"]["meta"]
|
536
497
|
dependencies = output["BOLD"]["meta"]["dependencies"]
|
@@ -582,9 +543,7 @@ def test_fMRIPrepConfoundRemover_fit_transform_masks() -> None:
|
|
582
543
|
assert "threshold" in t_meta["masks"]["compute_brain_mask"]
|
583
544
|
assert t_meta["masks"]["compute_brain_mask"]["threshold"] == 0.2
|
584
545
|
|
585
|
-
assert "
|
586
|
-
assert "mask_item" in output["BOLD"]
|
587
|
-
assert output["BOLD"]["mask_item"] == "BOLD_mask"
|
546
|
+
assert "mask" in output["BOLD"]
|
588
547
|
|
589
548
|
assert "dependencies" in output["BOLD"]["meta"]
|
590
549
|
dependencies = output["BOLD"]["meta"]["dependencies"]
|
junifer/testing/datagrabbers.py
CHANGED
@@ -181,7 +181,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
181
181
|
"""Initialize the class."""
|
182
182
|
datadir = tempfile.mkdtemp()
|
183
183
|
# Define types
|
184
|
-
types = ["BOLD"
|
184
|
+
types = ["BOLD"]
|
185
185
|
self.reduce_confounds = reduce_confounds
|
186
186
|
self.age_group = age_group
|
187
187
|
super().__init__(types=types, datadir=datadir)
|
@@ -242,10 +242,10 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
242
242
|
out["BOLD"] = {
|
243
243
|
"path": Path(self._dataset["func"][i_sub]),
|
244
244
|
"space": "MNI152NLin2009cAsym",
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
245
|
+
"confounds": {
|
246
|
+
"path": Path(self._dataset["confounds"][i_sub]),
|
247
|
+
"format": "fmriprep",
|
248
|
+
},
|
249
249
|
}
|
250
250
|
|
251
251
|
return out
|
@@ -28,13 +28,13 @@ def test_PartlyCloudyTestingDataGrabber() -> None:
|
|
28
28
|
assert out["BOLD"]["path"].exists()
|
29
29
|
assert out["BOLD"]["path"].is_file()
|
30
30
|
|
31
|
-
assert "
|
32
|
-
assert out["
|
33
|
-
assert out["
|
34
|
-
assert "format" in out["
|
35
|
-
assert "fmriprep" == out["
|
31
|
+
assert "confounds" in out["BOLD"]
|
32
|
+
assert out["BOLD"]["confounds"]["path"].exists()
|
33
|
+
assert out["BOLD"]["confounds"]["path"].is_file()
|
34
|
+
assert "format" in out["BOLD"]["confounds"]
|
35
|
+
assert "fmriprep" == out["BOLD"]["confounds"]["format"]
|
36
36
|
|
37
37
|
with PartlyCloudyTestingDataGrabber(reduce_confounds=False) as dg:
|
38
38
|
out = dg["sub-01"]
|
39
|
-
assert "format" in out["
|
40
|
-
assert "fmriprep" == out["
|
39
|
+
assert "format" in out["BOLD"]["confounds"]
|
40
|
+
assert "fmriprep" == out["BOLD"]["confounds"]["format"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.5.
|
3
|
+
Version: 0.0.5.dev86
|
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>
|