question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add .get_entities() method to BIDSLayout

See original GitHub issue

Currently, you can get valid entities by running BIDSLayout(bids_root).entities and a little parsing. It would be nice to have a helper function such as bids.layout.list_entities():

def list_entities(domains=('bids',)):
    res = []
    for domain in domains:
        res.extend(...)  # Parse the entities from the JSON files
    return res

The reason this comes up is that, currently, nipype.interfaces.io.BIDSDataGrabber manually parses the JSON files, found in a path relative to bids.__file__. This isn’t great.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tyarkonicommented, Mar 19, 2019

Following up on this, in 0.8, you can do Config.load('bids') to get back a Config object that has a dictionary of entities only valid for that config. This doesn’t require populating a layout, but it only works for a single config at a time. So at this point it would be very straightforward to add a static method in BIDSLayout that takes a list of config names and returns the union of available entities across all resulting Config objects.

0reactions
tyarkonicommented, Apr 20, 2019

0.9 adds a get_entities() method that accepts scope and is_metadata arguments, where the former controls where to look for entities, and the latter allows you to restrict to only metadata or non-metadata entities if desired.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bids.layout.BIDSLayout — PyBIDS 0.15.5 documentation
This provides a convenient way to restrict file indexing to only those files defined in the “core” BIDS spec, as setting validate=True will...
Read more >
pybids/layout.py at master · bids-standard/pybids - GitHub
Python tools for querying and manipulating BIDS datasets. - pybids/layout.py at master · bids-standard/pybids.
Read more >
Querying Acquisition Info and Metadata with pybids - Neurostars
I'd like to query the acquisition info (TR, TE, PED etc) and some meta-data for a given dataset in BIDS format.
Read more >
Princeton Neuroscience Institute - rtCloud documentation
installation process must be added to a list of trusted certificates on your ... getReadme() → bids.layout. ... getEntities() → dict.
Read more >
cloud-bids-layout - PyPI
Cloud-BIDS-Layout: Use pybids with Amazon S3. ... The user can then use pybids' familiar .get() method to select a subset of the study...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found