Changes
Versioned `bids()` function
This release introduces **versioned** bids functions! Explicitly setting a version for the `bids()` function ensures the output of the function remains stable even as the bids specification continues to evolve.
The problem is especially evident if you use custom entities. Consider the following code:
py
bids(
subject="001",
session="01",
space="MNI6",
tract="SLF",
hemi="L",
suffix="tracts",
desc="corr",
extension=".tck",
) == 'sub-001/ses-01/sub-001_ses-01_hemi-L_space-MNI6_desc-corr_tract-SLF_tracts.tck'
Notice the custom entity `tract` is placed at the end of the path, immediately before the suffix. If this entity were ever to become official however, it's position might be moved earlier in the path:
py
in a hypothetical future version:
bids(
subject="001",
session="01",
space="MNI6",
tract="SLF",
hemi="L",
desc="corr",
suffix="tracts",
extension=".tck",
) == 'sub-001/ses-01/sub-001_ses-01_hemi-L_space-MNI6_tract-SLF_desc-corr_tracts.tck'
This would break any workflows using this path, making it difficult for us to keep the `bids()` function up to date (we'd have to release a new major version every time we need to change the function).
Bids versioning decouples the spec from the snakebids version, so that snakebids can continue to be updated without risk of path breakage. It can be activated like this:
py
from snakebids import set_bids_spec
set_bids_spec("v0_0_0")
The 0 version specified above is the version snakebids has used up until now, and will continue to be the default for some time. In the future, the default spec will change, so setting the version as above ensures long term stability.
This release also comes with a new spec:
py
from snakebids import set_bids_spec
set_bids_spec("v0_11_0")
It comes with a number of new recognized entities, including `staining`, `tracer`, `flip`, `inversion`, `processed`, `part`, `atlas`, `segmentation`, `density`, `roi`, `from`, `to`, `split`, `recording`, `chunk`, `model`, and `subset`. In addition, unrecognized entities will always be placed before the `desc` tag, so `desc-XXX` will always be the last entity before the suffix.
Regex filtering
Regex filters in the config file has been broken for some time, but this release re-enables it with a new syntax. Regex filtering can be performed as follows:
yaml
bids_inputs:
t1w:
filters:
acq:
match: MP2?RAGE
suffix:
search: [Tt]1
The `match` and `search` key use `re.match()` and `re.search()` respectively.
🚀 Features
- Adding argument for metadata indexing by generate\_inputs myousif9 (367)
- Add mechanism for regex filtering pvandyken (365)
- Transition to versioned bids functions pvandyken (349)
- Allow builtins and resolved paths as cli types pvandyken (352)
🐛 Bug Fixes
- Default to case-insensitive search for regex pvandyken (375)
🧰 Maintenance
- Update khanlab/actions integration pvandyken (374)
- Clean old tests when recalculating durations pvandyken (373)
- Add tests of pypi installation in nightly workflow pvandyken (357)