Skip to content

Commit 9285966

Browse files
mgxdeffigies
authored andcommitted
TST: Test that fieldmap names are sanitized
1 parent 70c384d commit 9285966

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

fmriprep/workflows/tests/test_base.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
{'suffix': 'magnitude1', 'metadata': {'EchoTime': 0.005}},
6161
{
6262
'suffix': 'epi',
63-
'direction': 'PA',
63+
'dir': 'PA',
6464
'metadata': {'PhaseEncodingDirection': 'j', 'TotalReadoutTime': 0.6},
6565
},
6666
{
6767
'suffix': 'epi',
68-
'direction': 'AP',
68+
'dir': 'AP',
6969
'metadata': {'PhaseEncodingDirection': 'j-', 'TotalReadoutTime': 0.6},
7070
},
7171
],
@@ -230,6 +230,25 @@ def test_init_fmriprep_wf(
230230
generate_expanded_graph(wf._create_flat_graph())
231231

232232

233+
def test_init_fmriprep_wf_sanitize_fmaps(tmp_path):
234+
bids_dir = tmp_path / 'bids'
235+
236+
spec = deepcopy(BASE_LAYOUT)
237+
spec['01']['func'][0]['metadata']['B0FieldSource'] = 'epi<<run1>>'
238+
spec['01']['fmap'][2]['metadata']['B0FieldIdentifier'] = 'epi<<run1>>'
239+
spec['01']['fmap'][3]['metadata']['B0FieldIdentifier'] = 'epi<<run1>>'
240+
del spec['01']['func'][4:]
241+
242+
generate_bids_skeleton(bids_dir, spec)
243+
img = nb.Nifti1Image(np.zeros((10, 10, 10, 10)), np.eye(4))
244+
for img_path in bids_dir.glob('sub-01/*/*.nii.gz'):
245+
img.to_filename(img_path)
246+
247+
with mock_config(bids_dir=bids_dir):
248+
wf = init_fmriprep_wf()
249+
generate_expanded_graph(wf._create_flat_graph())
250+
251+
233252
def test_get_estimator_none(tmp_path):
234253
bids_dir = tmp_path / 'bids'
235254

0 commit comments

Comments
 (0)