-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New "associations" metadata #431
Comments
I've been meaning to add something like this for a while, so let's definitely keep this open. Before going down this road though, I want to (a) refactor the |
That sounds pretty sensible to me. A couple of questions: Is (a) already in the works somewhere? I'd love to take a look and maybe try to help with that. For (b), is it really necessary to have |
No, haven't started on (a) at all. You're welcome to take a crack at that if you want—my top priority right now is refactoring the For (b), no, I don't think that would hold up implementing an Just so I can keep this in mind when working on the I/O stuff, what would you want |
Could we add a parameter to >>> layout.get(suffix=['epi', 'fmap', 'phasediff'])
['sub-01/fmap/sub-01_dir-AP_epi.nii.gz',
'sub-02/fmap/sub-02_dir-AP_epi.nii.gz',
'sub-03/fmap/sub-03_dir-AP_epi.nii.gz']
>>> layout.get(suffix=['epi', 'fmap', 'phasediff'],
... associated='sub-01/func/sub-01_task-rest_bold.nii.gz')
['sub-01/fmap/sub-01_dir-AP_epi.nii.gz'] That would reuse the existing |
That's certainly possible—and will be easier to implement efficiently once we're using a database. It's probably worth getting clear on exactly how we're defining "associated". E.g., if there's an |
@oesteban okay now that I have a mostly working SQLAlchemy-backed branch of pybids (the variable ingestion stuff is currently broken, but all the core layout tests pass), I've thought about this a bit more, and I think it will actually be quite easy to implement using the DB, without needing to worry (yet) about all the I/O stuff I mentioned above. It's straightforward to treat this purely at a database level. I'll probably just create a It would be helpful if you could flesh out as many of the association-defining rules you can think of. The main source of potential ambiguity/problems I can see is inheritance—it feels like it could get messy if we associate a root-level file with 600 files that inherit from it. On the other hand, it would still be good to register this association at DB level, as that would make walking up the tree unnecessary past the initial indexing process. So maybe we can have a closed set of relationship types or indicators, with one binary column being, say, |
I've edited my original post to include associations I've thought so far. Please feel free to edit it and update/fix it in place |
@oesteban thanks! The interface I've implemented for this lets you pass a |
@oesteban when you get a chance, please try out the Note: I also added an |
Hi @tyarkoni, sorry for my slow response testing this. I've found a use case that needs revision: >>> bold = layout.get(suffix='bold', extension=['.nii', '.nii.gz'])
>>> # Get associations of the ``phasediff`` informer (index [-1])
>>> bold[0].get_associations(kind='InformedBy')[-1].get_associations()
[<BIDSJSONFile filename='/home/oesteban/Data/sdcflows-tests/testdata/sub-HCP101006/fmap/sub-HCP101006_phasediff.json'>,
<BIDSImageFile filename='/home/oesteban/Data/sdcflows-tests/testdata/sub-HCP101006/func/sub-HCP101006_task-rest_dir-LR_bold.nii.gz'>,
<BIDSImageFile filename='/home/oesteban/Data/sdcflows-tests/testdata/sub-HCP101006/func/sub-HCP101006_task-rest_dir-LR_sbref.nii.gz'>,
<BIDSImageFile filename='/home/oesteban/Data/sdcflows-tests/testdata/sub-HCP101006/func/sub-HCP101006_task-rest_dir-RL_bold.nii.gz'>,
<BIDSImageFile filename='/home/oesteban/Data/sdcflows-tests/testdata/sub-HCP101006/func/sub-HCP101006_task-rest_dir-RL_sbref.nii.gz'>] What I'm missing here is one That would allow reconstructing the whole metadata graph to set up distortion correction:
|
Add a new attribute to
BIDSFile
with a list of files associated to this particularBIDSFile
. Files listed here are, for instance:IntendedFor
metadata pointing to this hit (e.g. fieldmaps).The idea would be to minimize subsequent queries to the layout, and having a quick glimpse at the involvement of this hit in the context of the full dataset.
If this feature can be time consuming, then it could be protected by a
return_associations
argument to get, which would beFalse
by default.What do you guys think? I could work on this if you see it useful.
Proposed associations
BOLD runs:
events
,stim
,physio
.IntendedFor
pointersDWI runs:
IntendedFor
pointersMultiecho anats:
The text was updated successfully, but these errors were encountered: