-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Repair search for precomputed transforms (#3369)
- Loading branch information
Showing
3 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from fmriprep.utils import bids | ||
|
||
|
||
@pytest.mark.parametrize('xfm', ['boldref2fmap', 'boldref2anat', 'hmc']) | ||
def test_transforms_found_as_str(tmp_path: Path, xfm: str): | ||
subject = '0' | ||
task = 'rest' | ||
fromto = { | ||
'hmc': 'from-orig_to-boldref', | ||
'boldref2fmap': 'from-boldref_to-auto00000', | ||
'boldref2anat': 'from-boldref_to-anat', | ||
}[xfm] | ||
|
||
to_find = tmp_path.joinpath( | ||
f'sub-{subject}', 'func', f'sub-{subject}_task-{task}_{fromto}_mode-image_xfm.txt' | ||
) | ||
to_find.parent.mkdir(parents=True) | ||
to_find.touch() | ||
|
||
entities = { | ||
'subject': subject, | ||
'task': task, | ||
'suffix': 'bold', | ||
'extension': '.nii.gz', | ||
} | ||
|
||
derivs = bids.collect_derivatives( | ||
derivatives_dir=tmp_path, | ||
entities=entities, | ||
fieldmap_id='auto_00000', | ||
) | ||
assert derivs == {'transforms': {xfm: str(to_find)}} |