Skip to content

Commit e8ac59b

Browse files
committed
test(rmsd): Verify reconstruction of FSL rmsd
1 parent 50e4b92 commit e8ac59b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

fmriprep/interfaces/tests/test_confounds.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ def test_FilterDropped(tmp_path, data_dir):
3333
assert filtered_meta == target_meta
3434

3535

36+
def test_FSLRMSDeviation(tmp_path, data_dir):
37+
base = 'sub-01_task-mixedgamblestask_run-01'
38+
xfms = data_dir / f'{base}_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt'
39+
boldref = data_dir / f'{base}_desc-hmc_boldref.nii.gz'
40+
timeseries = data_dir / f'{base}_desc-motion_timeseries.tsv'
41+
42+
rmsd = pe.Node(
43+
confounds.FSLRMSDeviation(xfm_file=str(xfms), boldref_file=str(boldref)),
44+
name='rmsd',
45+
base_dir=str(tmp_path),
46+
)
47+
res = rmsd.run()
48+
49+
orig = pd.read_csv(timeseries, sep='\t')['rmsd']
50+
derived = pd.read_csv(res.outputs.out_file, sep='\t')['rmsd']
51+
52+
# RMSD is nominally in mm, so 0.1um is an acceptable deviation
53+
assert np.allclose(orig.values, derived.values, equal_nan=True, atol=1e-4)
54+
55+
3656
def test_FSLMotionParams(tmp_path, data_dir):
3757
base = 'sub-01_task-mixedgamblestask_run-01'
3858
xfms = data_dir / f'{base}_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt'

0 commit comments

Comments
 (0)