1
+ import pytest
1
2
from niworkflows .utils .testing import generate_bids_skeleton
2
3
3
4
from ..bids import collect_derivatives
4
5
from . import DERIV_SKELETON
5
6
6
7
7
- def test_collect_derivatives (tmp_path ):
8
+ @pytest .fixture
9
+ def deriv_dset (tmp_path ):
8
10
deriv_dir = tmp_path / 'derivatives'
9
11
generate_bids_skeleton (deriv_dir , str (DERIV_SKELETON ))
12
+ return deriv_dir
13
+
14
+
15
+ def test_collect_derivatives (deriv_dset ):
10
16
output_spaces = ['MNI152NLin2009cAsym' , 'MNIPediatricAsym:cohort-3' ]
11
- collected = collect_derivatives (deriv_dir , '01' , output_spaces )
17
+ collected = collect_derivatives (deriv_dset , '01' , output_spaces )
12
18
for suffix in ('preproc' , 'mask' , 'dseg' ):
13
19
assert collected [f't1w_{ suffix } ' ]
14
20
assert len (collected ['t1w_tpms' ]) == 3
@@ -28,3 +34,13 @@ def test_collect_derivatives(tmp_path):
28
34
'sphere_reg_msm' ,
29
35
):
30
36
assert len (collected [surface ]) == 2
37
+
38
+
39
+ def test_collect_derivatives_transforms (deriv_dset ):
40
+ output_spaces = ['MNI152NLin2009cAsym' , 'MNIPediatricAsym:cohort-3' ]
41
+ collected = collect_derivatives (deriv_dset , '01' , output_spaces )
42
+ xfms = collected ['transforms' ]
43
+ for space in output_spaces :
44
+ template = space .split (':' )[0 ]
45
+ assert template in xfms [space ]['reverse' ]
46
+ assert template in xfms [space ]['forward' ]
0 commit comments