21
21
# https://www.nipreps.org/community/licensing/
22
22
#
23
23
"""Utilities to handle BIDS inputs."""
24
- from collections import defaultdict
25
24
from pathlib import Path
26
25
from json import loads
27
26
from pkg_resources import resource_filename as pkgrf
@@ -40,9 +39,9 @@ def collect_derivatives(derivatives_dir, subject_id, std_spaces, spec=None, patt
40
39
if patterns is None :
41
40
patterns = _patterns
42
41
43
- derivs_cache = defaultdict (list )
44
42
layout = BIDSLayout (derivatives_dir , config = ["bids" , "derivatives" ], validate = False )
45
43
44
+ derivs_cache = {}
46
45
for k , q in spec ["baseline" ].items ():
47
46
q ["subject" ] = subject_id
48
47
item = layout .get (return_type = 'filename' , ** q )
@@ -51,18 +50,6 @@ def collect_derivatives(derivatives_dir, subject_id, std_spaces, spec=None, patt
51
50
52
51
derivs_cache ["t1w_%s" % k ] = item [0 ] if len (item ) == 1 else item
53
52
54
- for space in std_spaces :
55
- for k , q in spec ["std_xfms" ].items ():
56
- q ["subject" ] = subject_id
57
- q ["from" ] = q ["from" ] or space
58
- q ["to" ] = q ["to" ] or space
59
- item = layout .get (return_type = 'filename' , ** q )
60
- if not item :
61
- continue
62
- derivs_cache [k ] += item
63
-
64
- derivs_cache = dict (derivs_cache ) # Back to a standard dictionary
65
-
66
53
transforms = derivs_cache .setdefault ('transforms' , {})
67
54
for space in std_spaces :
68
55
for k , q in spec ["transforms" ].items ():
0 commit comments