File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 28
28
import os
29
29
import sys
30
30
from collections import defaultdict
31
+ from functools import cache
31
32
from pathlib import Path
32
33
33
34
from bids .layout import BIDSLayout
38
39
from ..data import load as load_data
39
40
40
41
42
+ @cache
43
+ def _get_layout (derivatives_dir : Path ) -> BIDSLayout :
44
+ import niworkflows .data
45
+
46
+ return BIDSLayout (
47
+ derivatives_dir , config = [niworkflows .data .load ('nipreps.json' )], validate = False
48
+ )
49
+
50
+
41
51
def collect_derivatives (
42
52
derivatives_dir : Path ,
43
53
entities : dict ,
@@ -57,8 +67,7 @@ def collect_derivatives(
57
67
patterns = _patterns
58
68
59
69
derivs_cache = defaultdict (list , {})
60
- layout = BIDSLayout (derivatives_dir , config = ['bids' , 'derivatives' ], validate = False )
61
- derivatives_dir = Path (derivatives_dir )
70
+ layout = _get_layout (derivatives_dir )
62
71
63
72
# search for both boldrefs
64
73
for k , q in spec ['baseline' ].items ():
You can’t perform that action at this time.
0 commit comments