Skip to content

Commit c0279e0

Browse files
committed
Merge tag '1.7.7' into maint/1.7.x
1.7.7 (March 24, 2023) Patch release that optimizes BIDS metadata handling by reusing cached index databases. * ENH: Allow passing a ``database_path`` to create a ``BIDSLayout`` (#788)
2 parents 7d0bc69 + d5bc748 commit c0279e0

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.7.7 (March 24, 2023)
2+
======================
3+
Patch release that optimizes BIDS metadata handling by reusing cached index databases.
4+
5+
* ENH: Allow passing a ``database_path`` to create a ``BIDSLayout`` (#788)
6+
17
1.7.6 (March 06, 2023)
28
======================
39
Patch release in the 1.7.x series.

niworkflows/interfaces/bids.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class _BIDSBaseInputSpec(BaseInterfaceInputSpec):
8484
(None, Directory(exists=True)), usedefault=True, desc="optional bids directory"
8585
)
8686
bids_validate = traits.Bool(True, usedefault=True, desc="enable BIDS validator")
87+
index_db = Directory(exists=True, desc="a PyBIDS layout cache directory")
8788

8889

8990
class _BIDSInfoInputSpec(_BIDSBaseInputSpec):
@@ -832,7 +833,13 @@ def _outputs(self):
832833
def _run_interface(self, runtime):
833834
self.layout = self.inputs.bids_dir or self.layout
834835
self.layout = _init_layout(
835-
self.inputs.in_file, self.layout, self.inputs.bids_validate
836+
self.inputs.in_file,
837+
self.layout,
838+
self.inputs.bids_validate,
839+
database_path=(
840+
self.inputs.index_db if isdefined(self.inputs.index_db)
841+
else None
842+
)
836843
)
837844

838845
# Fill in BIDS entities of the output ("*_id")

niworkflows/utils/bids.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def get_metadata_for_nifti(in_file, bids_dir=None, validate=True):
280280
return _init_layout(in_file, bids_dir, validate).get_metadata(str(in_file))
281281

282282

283-
def _init_layout(in_file=None, bids_dir=None, validate=True):
283+
def _init_layout(in_file=None, bids_dir=None, validate=True, database_path=None):
284284
if isinstance(bids_dir, BIDSLayout):
285285
return bids_dir
286286

@@ -294,7 +294,11 @@ def _init_layout(in_file=None, bids_dir=None, validate=True):
294294
if bids_dir is None:
295295
raise RuntimeError("Could not infer BIDS root")
296296

297-
layout = BIDSLayout(str(bids_dir), validate=validate)
297+
layout = BIDSLayout(
298+
str(bids_dir),
299+
validate=validate,
300+
database_path=database_path,
301+
)
298302
return layout
299303

300304

0 commit comments

Comments
 (0)